| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- using Autofac;
- using GreenTree.Nachtragsmanagement.Core;
- using GreenTree.Nachtragsmanagement.Core.Domain.User;
- using GreenTree.Nachtragsmanagement.Services.User;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace GreenTree.Nachtragsmanagement.Web.App_Start
- {
- public class FunctionConfig
- {
- /// <summary>
- /// Registers all system functions provided by the base system
- /// </summary>
- public static void RegisterFunctions()
- {
- var userService = Singleton<IContainer>.Instance.Resolve<IUserService>();
- var systemFunctions = AllSystemFunctions();
- foreach (var function in systemFunctions)
- {
- var existingFunction = userService.GetFunctionByName(function.Name);
- if (existingFunction != null)
- {
- var equals =
- existingFunction.Description == function.Description &&
- existingFunction.ImageUrl == function.ImageUrl &&
- existingFunction.GroupName == function.GroupName &&
- existingFunction.RouteName == function.RouteName &&
- existingFunction.IsMenuMember == function.IsMenuMember &&
- existingFunction.Plugin == function.Plugin &&
- existingFunction.BaseWidth == function.BaseWidth &&
- existingFunction.MinWidth == function.MinWidth &&
- existingFunction.BaseHeight == function.BaseHeight &&
- existingFunction.MinHeight == function.MinHeight &&
- existingFunction.AllowMaximize == function.AllowMaximize;
- if (!equals)
- {
- existingFunction.Description = function.Description;
- existingFunction.ImageUrl = function.ImageUrl;
- existingFunction.GroupName = function.GroupName;
- existingFunction.RouteName = function.RouteName;
- existingFunction.IsMenuMember = function.IsMenuMember;
- existingFunction.Plugin = function.Plugin;
- existingFunction.BaseWidth = function.BaseWidth;
- existingFunction.MinWidth = function.MinWidth;
- existingFunction.BaseHeight = function.BaseHeight;
- existingFunction.MinHeight = function.MinHeight;
- existingFunction.AllowMaximize = function.AllowMaximize;
- userService.UpdateFunction(existingFunction);
- }
- }
- else
- userService.InsertFunction(function);
- }
- }
- private static Function[] AllSystemFunctions()
- {
- return new[]
- {
- new Function
- {
- Name = "Administration",
- Description = "Administration",
- ImageUrl = "~/Content/Images/function-Administration-32.png",
- IsMenuMember = true,
- Plugin = "System"
- },
- new Function
- {
- Name = "Administration-Users",
- Description = "Benutzerverwaltung",
- ImageUrl = "~/Content/Images/function-Administration-Users-32.png",
- GroupName = "Administration",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Administration.Users",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 900,
- MinWidth = 600,
- BaseHeight = 600,
- MinHeight = 400,
- AllowMaximize = true
- },
- new Function
- {
- Name = "Administration-Users-Edit",
- Description = "Benutzer editieren",
- GroupName = "Administration-Users",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Administration-Roles",
- Description = "Rollenverwaltung",
- ImageUrl = "~/Content/Images/function-Administration-Roles-32.png",
- GroupName = "Administration",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Administration.Roles",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 800,
- MinWidth = 600,
- BaseHeight = 500,
- MinHeight = 400,
- AllowMaximize = true
- },
- new Function
- {
- Name = "Administration-Roles-Edit",
- Description = "Rollen editieren",
- GroupName = "Administration-Roles",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Administration-Plugins",
- Description = "Pluginverwaltung",
- ImageUrl = "~/Content/Images/function-Administration-Plugins-32.png",
- GroupName = "Administration",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Administration.Plugins",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 800,
- MinWidth = 500,
- BaseHeight = 450,
- MinHeight = 300,
- AllowMaximize = true
- },
- new Function
- {
- Name = "Site",
- Description = "Baustellen",
- ImageUrl = "~/Content/Images/function-Site-32.png",
- IsMenuMember = true,
- Plugin = "System"
- },
- new Function
- {
- Name = "Site-Sites",
- Description = "Baustellenliste",
- ImageUrl = "~/Content/Images/function-Site-Sites-32.png",
- GroupName = "Site",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Site.Sites",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 1100,
- MinWidth = 800,
- BaseHeight = 650,
- MinHeight = 500,
- AllowMaximize = true,
- MaximizedOnStart = true
- },
- new Function
- {
- Name = "Site-Sites-Edit",
- Description = "Baustellen editieren",
- GroupName = "Site-Sites",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Site-Sites-Delete",
- Description = "Baustellen löschen",
- GroupName = "Site-Sites",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Deviation",
- Description = "Vertragsabweichungen",
- ImageUrl = "~/Content/Images/function-Deviation-32.png",
- IsMenuMember = true,
- Plugin = "System"
- },
- new Function
- {
- Name = "Deviation-Deviations",
- Description = "Vertragsabweichungsliste",
- ImageUrl = "~/Content/Images/function-Deviation-Deviations-32.png",
- GroupName = "Deviation",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Deviation.Deviations",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 1000,
- MinWidth = 800,
- BaseHeight = 650,
- MinHeight = 500,
- AllowMaximize = true,
- MaximizedOnStart = true
- },
- new Function
- {
- Name = "Deviation-Deviations-Edit",
- Description = "Vertragsabweichungen editieren",
- GroupName = "Deviation-Deviations",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Deviation-Claims",
- Description = "VA-Stammdaten",
- ImageUrl = "~/Content/Images/function-Deviation-Claims-32.png",
- GroupName = "Deviation",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Deviation.Claims",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 1000,
- MinWidth = 600,
- BaseHeight = 500,
- MinHeight = 350,
- AllowMaximize = true
- },
- new Function
- {
- Name = "Deviation-Claims-Edit",
- Description = "VA-Stammdaten editieren",
- GroupName = "Deviation-Claims",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Appendix",
- Description = "Nachträge",
- ImageUrl = "~/Content/Images/function-Appendix-32.png",
- IsMenuMember = true,
- Plugin = "System"
- },
- new Function
- {
- Name = "Appendix-Appendices",
- Description = "Nachtragsliste",
- ImageUrl = "~/Content/Images/function-Appendix-Appendices-32.png",
- GroupName = "Appendix",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Appendix.Appendices",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 1100,
- MinWidth = 800,
- BaseHeight = 650,
- MinHeight = 500,
- AllowMaximize = true,
- MaximizedOnStart = true
- },
- new Function
- {
- Name = "Appendix-Appendices-Edit",
- Description = "Nachträge editieren",
- GroupName = "Appendix-Appendices",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Appendix-Claims",
- Description = "NT-Stammdaten",
- ImageUrl = "~/Content/Images/function-Appendix-Claims-32.png",
- GroupName = "Appendix",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Appendix.Claims",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 800,
- MinWidth = 600,
- BaseHeight = 500,
- MinHeight = 350,
- AllowMaximize = true
- },
- new Function
- {
- Name = "Appendix-Claims-Edit",
- Description = "NT-Stammdaten editieren",
- GroupName = "Appendix-Claims",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Misc",
- Description = "Sonstiges",
- ImageUrl = "~/Content/Images/function-Misc-32.png",
- IsMenuMember = true,
- Plugin = "System"
- },
- new Function
- {
- Name = "Misc-MailNotifications",
- Description = "Benachrichtigungen",
- ImageUrl = "~/Content/Images/function-Misc-MailNotifications-32.png",
- GroupName = "Misc",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Misc.MailNotifications",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 900,
- MinWidth = 700,
- BaseHeight = 550,
- MinHeight = 450,
- AllowMaximize = true,
- MaximizedOnStart = false
- },
- new Function
- {
- Name = "Misc-MailNotifications-Edit",
- Description = "Benachrichtigungen editieren",
- GroupName = "Misc-MailNotifications",
- IsMenuMember = false,
- Plugin = "System"
- },
- new Function
- {
- Name = "Misc-Logs",
- Description = "Logs",
- ImageUrl = "~/Content/Images/function-Misc-Logs-32.png",
- GroupName = "Misc",
- RouteName = "GreenTree.Nachtragsmanagement.Web.Misc.Logs",
- IsMenuMember = true,
- Plugin = "System",
- BaseWidth = 900,
- MinWidth = 700,
- BaseHeight = 550,
- MinHeight = 450,
- AllowMaximize = true,
- MaximizedOnStart = false
- },
- new Function
- {
- Name = "Misc-Logs-Delete",
- Description = "Logs löschen",
- GroupName = "Misc-Logs",
- IsMenuMember = false,
- Plugin = "System"
- },
- };
- }
- }
- }
|