FunctionConfig.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. using Autofac;
  2. using GreenTree.Nachtragsmanagement.Core;
  3. using GreenTree.Nachtragsmanagement.Core.Domain.User;
  4. using GreenTree.Nachtragsmanagement.Services.User;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Web;
  9. namespace GreenTree.Nachtragsmanagement.Web.App_Start
  10. {
  11. public class FunctionConfig
  12. {
  13. /// <summary>
  14. /// Registers all system functions provided by the base system
  15. /// </summary>
  16. public static void RegisterFunctions()
  17. {
  18. var userService = Singleton<IContainer>.Instance.Resolve<IUserService>();
  19. var systemFunctions = AllSystemFunctions();
  20. foreach (var function in systemFunctions)
  21. {
  22. var existingFunction = userService.GetFunctionByName(function.Name);
  23. if (existingFunction != null)
  24. {
  25. var equals =
  26. existingFunction.Description == function.Description &&
  27. existingFunction.ImageUrl == function.ImageUrl &&
  28. existingFunction.GroupName == function.GroupName &&
  29. existingFunction.RouteName == function.RouteName &&
  30. existingFunction.IsMenuMember == function.IsMenuMember &&
  31. existingFunction.Plugin == function.Plugin &&
  32. existingFunction.BaseWidth == function.BaseWidth &&
  33. existingFunction.MinWidth == function.MinWidth &&
  34. existingFunction.BaseHeight == function.BaseHeight &&
  35. existingFunction.MinHeight == function.MinHeight &&
  36. existingFunction.AllowMaximize == function.AllowMaximize;
  37. if (!equals)
  38. {
  39. existingFunction.Description = function.Description;
  40. existingFunction.ImageUrl = function.ImageUrl;
  41. existingFunction.GroupName = function.GroupName;
  42. existingFunction.RouteName = function.RouteName;
  43. existingFunction.IsMenuMember = function.IsMenuMember;
  44. existingFunction.Plugin = function.Plugin;
  45. existingFunction.BaseWidth = function.BaseWidth;
  46. existingFunction.MinWidth = function.MinWidth;
  47. existingFunction.BaseHeight = function.BaseHeight;
  48. existingFunction.MinHeight = function.MinHeight;
  49. existingFunction.AllowMaximize = function.AllowMaximize;
  50. userService.UpdateFunction(existingFunction);
  51. }
  52. }
  53. else
  54. userService.InsertFunction(function);
  55. }
  56. }
  57. private static Function[] AllSystemFunctions()
  58. {
  59. return new[]
  60. {
  61. new Function
  62. {
  63. Name = "Administration",
  64. Description = "Administration",
  65. ImageUrl = "~/Content/Images/function-Administration-32.png",
  66. IsMenuMember = true,
  67. Plugin = "System"
  68. },
  69. new Function
  70. {
  71. Name = "Administration-Users",
  72. Description = "Benutzerverwaltung",
  73. ImageUrl = "~/Content/Images/function-Administration-Users-32.png",
  74. GroupName = "Administration",
  75. RouteName = "GreenTree.Nachtragsmanagement.Web.Administration.Users",
  76. IsMenuMember = true,
  77. Plugin = "System",
  78. BaseWidth = 900,
  79. MinWidth = 600,
  80. BaseHeight = 600,
  81. MinHeight = 400,
  82. AllowMaximize = true,
  83. MaximizedOnStart = true
  84. },
  85. new Function
  86. {
  87. Name = "Administration-Users-Edit",
  88. Description = "Benutzer editieren",
  89. GroupName = "Administration-Users",
  90. IsMenuMember = false,
  91. Plugin = "System"
  92. },
  93. new Function
  94. {
  95. Name = "Administration-Roles",
  96. Description = "Rollenverwaltung",
  97. ImageUrl = "~/Content/Images/function-Administration-Roles-32.png",
  98. GroupName = "Administration",
  99. RouteName = "GreenTree.Nachtragsmanagement.Web.Administration.Roles",
  100. IsMenuMember = true,
  101. Plugin = "System",
  102. BaseWidth = 800,
  103. MinWidth = 600,
  104. BaseHeight = 500,
  105. MinHeight = 400,
  106. AllowMaximize = true,
  107. MaximizedOnStart = true
  108. },
  109. new Function
  110. {
  111. Name = "Administration-Roles-Edit",
  112. Description = "Rollen editieren",
  113. GroupName = "Administration-Roles",
  114. IsMenuMember = false,
  115. Plugin = "System"
  116. },
  117. new Function
  118. {
  119. Name = "Administration-Plugins",
  120. Description = "Pluginverwaltung",
  121. ImageUrl = "~/Content/Images/function-Administration-Plugins-32.png",
  122. GroupName = "Administration",
  123. RouteName = "GreenTree.Nachtragsmanagement.Web.Administration.Plugins",
  124. IsMenuMember = true,
  125. Plugin = "System",
  126. BaseWidth = 800,
  127. MinWidth = 500,
  128. BaseHeight = 450,
  129. MinHeight = 300,
  130. AllowMaximize = true,
  131. MaximizedOnStart = true
  132. },
  133. new Function
  134. {
  135. Name = "Administration-Plugins-Edit",
  136. Description = "Plugins installieren / deinstallieren",
  137. GroupName = "Administration-Plugins",
  138. IsMenuMember = false,
  139. Plugin = "System"
  140. },
  141. new Function
  142. {
  143. Name = "Administration-AppInfo",
  144. Description = "Anwendungsinformationen",
  145. ImageUrl = "~/Content/Images/function-Administration-AppInfo-32.png",
  146. GroupName = "Administration",
  147. RouteName = "GreenTree.Nachtragsmanagement.Web.Administration.AppInfo",
  148. IsMenuMember = true,
  149. Plugin = "System",
  150. BaseWidth = 1000,
  151. MinWidth = 700,
  152. BaseHeight = 600,
  153. MinHeight = 400,
  154. AllowMaximize = true,
  155. MaximizedOnStart = true
  156. },
  157. new Function
  158. {
  159. Name = "Administration-AppInfo-Update",
  160. Description = "Updates installieren",
  161. GroupName = "Administration-AppInfo",
  162. IsMenuMember = false,
  163. Plugin = "System"
  164. },
  165. new Function
  166. {
  167. Name = "Site",
  168. Description = "Baustellen",
  169. ImageUrl = "~/Content/Images/function-Site-32.png",
  170. IsMenuMember = true,
  171. Plugin = "System"
  172. },
  173. new Function
  174. {
  175. Name = "Site-Sites",
  176. Description = "Baustellenliste",
  177. ImageUrl = "~/Content/Images/function-Site-Sites-32.png",
  178. GroupName = "Site",
  179. RouteName = "GreenTree.Nachtragsmanagement.Web.Site.Sites",
  180. IsMenuMember = true,
  181. Plugin = "System",
  182. BaseWidth = 1100,
  183. MinWidth = 800,
  184. BaseHeight = 650,
  185. MinHeight = 500,
  186. AllowMaximize = true,
  187. MaximizedOnStart = true
  188. },
  189. new Function
  190. {
  191. Name = "Site-Sites-Edit",
  192. Description = "Baustellen editieren",
  193. GroupName = "Site-Sites",
  194. IsMenuMember = false,
  195. Plugin = "System"
  196. },
  197. new Function
  198. {
  199. Name = "Site-Sites-Edit-Comment",
  200. Description = "Baustellen Kommentar editieren",
  201. GroupName = "Site-Sites",
  202. IsMenuMember = false,
  203. Plugin = "System"
  204. },
  205. new Function
  206. {
  207. Name = "Site-Sites-Delete",
  208. Description = "Baustellen löschen",
  209. GroupName = "Site-Sites",
  210. IsMenuMember = false,
  211. Plugin = "System"
  212. },
  213. new Function
  214. {
  215. Name = "Deviation",
  216. Description = "Vertragsabweichungen",
  217. ImageUrl = "~/Content/Images/function-Deviation-32.png",
  218. IsMenuMember = true,
  219. Plugin = "System"
  220. },
  221. new Function
  222. {
  223. Name = "Deviation-Deviations",
  224. Description = "Vertragsabweichungsliste",
  225. ImageUrl = "~/Content/Images/function-Deviation-Deviations-32.png",
  226. GroupName = "Deviation",
  227. RouteName = "GreenTree.Nachtragsmanagement.Web.Deviation.Deviations",
  228. IsMenuMember = true,
  229. Plugin = "System",
  230. BaseWidth = 1000,
  231. MinWidth = 800,
  232. BaseHeight = 650,
  233. MinHeight = 500,
  234. AllowMaximize = true,
  235. MaximizedOnStart = true
  236. },
  237. new Function
  238. {
  239. Name = "Deviation-Deviations-Edit",
  240. Description = "Vertragsabweichungen editieren",
  241. GroupName = "Deviation-Deviations",
  242. IsMenuMember = false,
  243. Plugin = "System"
  244. },
  245. new Function
  246. {
  247. Name = "Deviation-Deviations-Edit-Comment",
  248. Description = "Vertragsabweichungen Kommentar editieren",
  249. GroupName = "Deviation-Deviations",
  250. IsMenuMember = false,
  251. Plugin = "System"
  252. },
  253. new Function
  254. {
  255. Name = "Deviation-Claims",
  256. Description = "VA-Stammdaten",
  257. ImageUrl = "~/Content/Images/function-Deviation-Claims-32.png",
  258. GroupName = "Deviation",
  259. RouteName = "GreenTree.Nachtragsmanagement.Web.Deviation.Claims",
  260. IsMenuMember = true,
  261. Plugin = "System",
  262. BaseWidth = 1000,
  263. MinWidth = 600,
  264. BaseHeight = 500,
  265. MinHeight = 350,
  266. AllowMaximize = true,
  267. MaximizedOnStart = false
  268. },
  269. new Function
  270. {
  271. Name = "Deviation-Claims-Edit",
  272. Description = "VA-Stammdaten editieren",
  273. GroupName = "Deviation-Claims",
  274. IsMenuMember = false,
  275. Plugin = "System"
  276. },
  277. new Function
  278. {
  279. Name = "Appendix",
  280. Description = "Nachträge",
  281. ImageUrl = "~/Content/Images/function-Appendix-32.png",
  282. IsMenuMember = true,
  283. Plugin = "System"
  284. },
  285. new Function
  286. {
  287. Name = "Appendix-Appendices",
  288. Description = "Nachtragsliste",
  289. ImageUrl = "~/Content/Images/function-Appendix-Appendices-32.png",
  290. GroupName = "Appendix",
  291. RouteName = "GreenTree.Nachtragsmanagement.Web.Appendix.Appendices",
  292. IsMenuMember = true,
  293. Plugin = "System",
  294. BaseWidth = 1100,
  295. MinWidth = 800,
  296. BaseHeight = 650,
  297. MinHeight = 500,
  298. AllowMaximize = true,
  299. MaximizedOnStart = true
  300. },
  301. new Function
  302. {
  303. Name = "Appendix-Appendices-Edit",
  304. Description = "Nachträge editieren",
  305. GroupName = "Appendix-Appendices",
  306. IsMenuMember = false,
  307. Plugin = "System"
  308. },
  309. new Function
  310. {
  311. Name = "Appendix-Appendices-Edit-Comment",
  312. Description = "Nachträge Kommentar editieren",
  313. GroupName = "Appendix-Appendices",
  314. IsMenuMember = false,
  315. Plugin = "System"
  316. },
  317. new Function
  318. {
  319. Name = "Appendix-Claims",
  320. Description = "NT-Stammdaten",
  321. ImageUrl = "~/Content/Images/function-Appendix-Claims-32.png",
  322. GroupName = "Appendix",
  323. RouteName = "GreenTree.Nachtragsmanagement.Web.Appendix.Claims",
  324. IsMenuMember = true,
  325. Plugin = "System",
  326. BaseWidth = 800,
  327. MinWidth = 600,
  328. BaseHeight = 500,
  329. MinHeight = 350,
  330. AllowMaximize = true,
  331. MaximizedOnStart = false
  332. },
  333. new Function
  334. {
  335. Name = "Appendix-Claims-Edit",
  336. Description = "NT-Stammdaten editieren",
  337. GroupName = "Appendix-Claims",
  338. IsMenuMember = false,
  339. Plugin = "System"
  340. },
  341. new Function
  342. {
  343. Name = "Misc",
  344. Description = "Sonstiges",
  345. ImageUrl = "~/Content/Images/function-Misc-32.png",
  346. IsMenuMember = true,
  347. Plugin = "System"
  348. },
  349. new Function
  350. {
  351. Name = "Misc-MailNotifications",
  352. Description = "Benachrichtigungen",
  353. ImageUrl = "~/Content/Images/function-Misc-MailNotifications-32.png",
  354. GroupName = "Misc",
  355. RouteName = "GreenTree.Nachtragsmanagement.Web.Misc.MailNotifications",
  356. IsMenuMember = true,
  357. Plugin = "System",
  358. BaseWidth = 900,
  359. MinWidth = 700,
  360. BaseHeight = 550,
  361. MinHeight = 450,
  362. AllowMaximize = true,
  363. MaximizedOnStart = true
  364. },
  365. new Function
  366. {
  367. Name = "Misc-MailNotifications-Edit",
  368. Description = "Benachrichtigungen editieren",
  369. GroupName = "Misc-MailNotifications",
  370. IsMenuMember = false,
  371. Plugin = "System"
  372. },
  373. new Function
  374. {
  375. Name = "Misc-HelpPages",
  376. Description = "Hilfe",
  377. ImageUrl = "~/Content/Images/function-Misc-HelpPages-32.png",
  378. GroupName = "Misc",
  379. RouteName = "GreenTree.Nachtragsmanagement.Web.Misc.HelpPages",
  380. IsMenuMember = true,
  381. Plugin = "System",
  382. BaseWidth = 1000,
  383. MinWidth = 700,
  384. BaseHeight = 600,
  385. MinHeight = 450,
  386. AllowMaximize = true,
  387. MaximizedOnStart = true
  388. },
  389. new Function
  390. {
  391. Name = "Misc-HelpPages-Edit",
  392. Description = "Hilfe editieren",
  393. GroupName = "Misc-HelpPages",
  394. IsMenuMember = false,
  395. Plugin = "System"
  396. },
  397. new Function
  398. {
  399. Name = "Misc-Logs",
  400. Description = "Logs",
  401. ImageUrl = "~/Content/Images/function-Misc-Logs-32.png",
  402. GroupName = "Misc",
  403. RouteName = "GreenTree.Nachtragsmanagement.Web.Misc.Logs",
  404. IsMenuMember = true,
  405. Plugin = "System",
  406. BaseWidth = 900,
  407. MinWidth = 700,
  408. BaseHeight = 550,
  409. MinHeight = 450,
  410. AllowMaximize = true,
  411. MaximizedOnStart = true
  412. },
  413. new Function
  414. {
  415. Name = "Misc-Logs-Delete",
  416. Description = "Logs löschen",
  417. GroupName = "Misc-Logs",
  418. IsMenuMember = false,
  419. Plugin = "System"
  420. },
  421. new Function
  422. {
  423. Name = "Misc-ConfigItems",
  424. Description = "Einstellungen",
  425. ImageUrl = "~/Content/Images/function-Misc-ConfigItems-32.png",
  426. GroupName = "Misc",
  427. RouteName = "GreenTree.Nachtragsmanagement.Web.Misc.ConfigItems",
  428. IsMenuMember = true,
  429. Plugin = "System",
  430. BaseWidth = 900,
  431. MinWidth = 700,
  432. BaseHeight = 550,
  433. MinHeight = 450,
  434. AllowMaximize = true,
  435. MaximizedOnStart = true
  436. },
  437. new Function
  438. {
  439. Name = "Misc-ConfigItems-Edit",
  440. Description = "Einstellungen ändern",
  441. GroupName = "Misc-ConfigItems",
  442. IsMenuMember = false,
  443. Plugin = "System"
  444. }
  445. };
  446. }
  447. }
  448. }