public IActionResult SaveSystemWorkTask([Bind("ID,IsNew,ParentItemID,Name,Description,SortCode,ControllerName,ControllerMethod,ControllerMethodParameter,BusinessEntityName,IsUsedInMenuString")] SystemWorkTaskVM boVM)
 {
     if (ModelState.IsValid)
     {
         var systemWorkSectionID = Guid.Parse(boVM.ParentItemID);
         var systemSection       = _WorkSectionRepository.GetSingle(systemWorkSectionID);
         var bo = _WorkSectionRepository.GetSingle(systemWorkSectionID, x => x.SystemWorkTasks).SystemWorkTasks.Where(x => x.ID == boVM.ID).FirstOrDefault();
         if (bo == null)
         {
             bo = new SystemWorkTask();
             boVM.MapToBo(bo);
             systemSection.SystemWorkTasks.Add(bo);
             _WorkSectionRepository.EditAndSave(systemSection);
         }
         else
         {
             boVM.MapToBo(bo);
             _WorkSectionRepository.EntitiesContext.SystemWorkTasks.Update(bo);
             _WorkSectionRepository.EntitiesContext.SaveChanges();
         }
         var saveStatus = new EditAndSaveStatus()
         {
             SaveOk = true, StatusMessage = "../../SystemConfig/Index"
         };
         return(Json(saveStatus));
     }
     else
     {
         return(PartialView("../../Views/ApplicationManagement/SystemConfig/_CreateOrEditForSystemWorkTask", boVM));
     }
 }
Beispiel #2
0
 public void MapToBo(SystemWorkTask bo)
 {
     bo.Name                        = Name;
     bo.Description                 = Description;
     bo.SortCode                    = SortCode;
     bo.ControllerName              = ControllerName;
     bo.ControllerMethod            = ControllerMethod;
     bo.ControllerMethodParameter   = ControllerMethodParameter;
     bo.BusinessEntityName          = BusinessEntityName;
     bo.IsForMeOnly                 = IsForMeOnly;
     bo.IsForMyDepartmentOnly       = IsForMyDepartmentOnly;
     bo.IsForDefaultSystemRoleGroup = IsForDefaultSystemRoleGroup;
     bo.IsUsedInMenu                = IsUsedInMenu;
     bo.HasShortCutLinkItem         = HasShortCutLinkItem;
     bo.HasTileLinkItem             = HasTileLinkItem;
     bo.IconName                    = IconName;
 }
Beispiel #3
0
        private static void _SetWorkPlace()
        {
            var wp01 = new SystemWorkPlace()
            {
                Name = "系统管理", Description = "", SortCode = "wp01", IconString = "mif-cog"
            };

            var ws01 = new SystemWorkSection()
            {
                Name = "角色用户", Description = "", SortCode = "wp01ws01"
            };
            var ws02 = new SystemWorkSection()
            {
                Name = "导航菜单", Description = "", SortCode = "wp01ws02"
            };

            var wt0101 = new SystemWorkTask()
            {
                Name = "系统角色管理", Description = "", SortCode = "wp01ws01wt001", IconName = "mif-tools", BusinessEntityName = "ApplicationRole", ControllerName = "ApplicationRole", ControllerMethod = "", ControllerMethodParameter = ""
            };
            var wt0102 = new SystemWorkTask()
            {
                Name = "系统用户管理", Description = "", SortCode = "wp01ws01wt002", IconName = "mif-user-3", BusinessEntityName = "ApplicationUser", ControllerName = "ApplicationUser", ControllerMethod = "", ControllerMethodParameter = ""
            };

            ws01.SystemWorkTasks = new List <SystemWorkTask>();
            ws01.SystemWorkTasks.Add(wt0101);
            ws01.SystemWorkTasks.Add(wt0102);

            var wt0201 = new SystemWorkTask()
            {
                Name = "通用菜单配置管理", Description = "", SortCode = "wp01ws01wt001", IconName = "mif-tools", BusinessEntityName = "SystemConfig", ControllerName = "SystemConfig", ControllerMethod = "", ControllerMethodParameter = ""
            };

            ws02.SystemWorkTasks = new List <SystemWorkTask>();
            ws02.SystemWorkTasks.Add(wt0201);

            wp01.SystemWorkSections = new List <SystemWorkSection>();
            wp01.SystemWorkSections.Add(ws01);
            wp01.SystemWorkSections.Add(ws02);
            _Context.SystemWorkPlaces.Add(wp01);

            _Context.SaveChanges();
        }
Beispiel #4
0
        public SystemWorkTaskVM(SystemWorkTask bo)
        {
            ID                          = bo.ID;
            Name                        = bo.Name;
            Description                 = bo.Description;
            SortCode                    = bo.SortCode;
            ControllerName              = bo.ControllerName;
            ControllerMethod            = bo.ControllerMethod;
            ControllerMethodParameter   = bo.ControllerMethodParameter;
            BusinessEntityName          = bo.BusinessEntityName;
            IconName                    = bo.IconName;
            IsForMeOnly                 = bo.IsForMeOnly;
            IsForMyDepartmentOnly       = bo.IsForMyDepartmentOnly;
            IsForDefaultSystemRoleGroup = bo.IsForDefaultSystemRoleGroup;
            IsUsedInMenu                = bo.IsUsedInMenu;
            HasShortCutLinkItem         = bo.HasShortCutLinkItem;
            HasTileLinkItem             = bo.HasTileLinkItem;

            IsForMeOnlyString                 = bo.IsForMeOnly ? "是" : "否";
            IsForMyDepartmentOnlyString       = bo.IsForMyDepartmentOnly ? "是" : "否";
            IsForDefaultSystemRoleGroupString = bo.IsForDefaultSystemRoleGroup ? "是" : "否";
            IsUsedInMenuString                = bo.IsUsedInMenu ? "是" : "否";
            HasShortCutLinkItemString         = bo.HasShortCutLinkItem ? "是" : "否";
            HasTileLinkItemString             = bo.HasTileLinkItem ? "是" : "否";

            IsForMeOnlySelector = PlainFacadeItemFactory <SystemWorkTask> .GetByBool(bo.IsForMeOnly);

            IsForMyDepartmentOnlySelector = PlainFacadeItemFactory <SystemWorkTask> .GetByBool(bo.IsForMyDepartmentOnly);

            IsForDefaultSystemRoleGroupSelector = PlainFacadeItemFactory <SystemWorkTask> .GetByBool(bo.IsForDefaultSystemRoleGroup);

            IsUsedInMenuSelector = PlainFacadeItemFactory <SystemWorkTask> .GetByBool(bo.IsUsedInMenu);

            HasShortCutLinkItemSelector = PlainFacadeItemFactory <SystemWorkTask> .GetByBool(bo.HasShortCutLinkItem);

            HasTileLinkItemSelector = PlainFacadeItemFactory <SystemWorkTask> .GetByBool(bo.HasTileLinkItem);
        }
Beispiel #5
0
        /// <summary>
        /// 根据 SystemWorkTask 和相应的归属 Id 对象,更新左侧菜单条目
        /// </summary>
        /// <param name="bo">SystemWorkTask 对象</param>
        /// <param name="pId">归属对象Id</param>
        public static void UpdateSubMenuItems(SystemWorkTask bo, Guid pId)
        {
            var sMenuItem = _SubMenuItems.FirstOrDefault(x => x.Id == bo.Id);

            if (sMenuItem == null)
            {
                var miniMenuItem = new SimpleSubMenuItem()
                {
                    Id       = bo.Id,
                    Name     = bo.Name,
                    URL      = "../../" + bo.ControllerName,
                    SortCode = bo.SortCode,
                    ParentId = pId
                };
                _SubMenuItems.Add(miniMenuItem);
            }
            else
            {
                sMenuItem.Name     = bo.Name;
                sMenuItem.URL      = "../../" + bo.ControllerName;
                sMenuItem.SortCode = bo.SortCode;
                sMenuItem.ParentId = pId;
            }
        }
        public IActionResult CreateOrEditForSystemWorkTask(Guid id, Guid systemWorkSectionID)
        {
            var isNew = false;
            var bo    = _WorkSectionRepository.GetSingle(systemWorkSectionID, x => x.SystemWorkTasks).SystemWorkTasks.Where(x => x.ID == id).FirstOrDefault();

            if (bo == null)
            {
                bo             = new SystemWorkTask();
                bo.Name        = "";
                bo.Description = "";
                bo.SortCode    = "";
                isNew          = true;
            }
            var workSection = _WorkSectionRepository.GetSingle(systemWorkSectionID);
            var boVM        = new SystemWorkTaskVM(bo);

            boVM.ParentItemID = workSection.ID.ToString();
            boVM.ParentItem   = new Common.ViewModelComponents.PlainFacadeItem()
            {
                DisplayName = workSection.Name, Name = workSection.Name, ID = workSection.ID.ToString()
            };
            boVM.IsNew = isNew;
            return(PartialView("../../Views/ApplicationManagement/SystemConfig/_CreateOrEditSystemWorkTask", boVM));
        }