Esempio n. 1
0
 public SystemWorkSectionVM(SystemWorkSection bo)
 {
     Id            = bo.Id;
     Name          = bo.Name;
     Description   = bo.Description;
     BussinessCode = bo.BussinessCode;
 }
Esempio n. 2
0
 public SystemWorkSectionVM(SystemWorkSection bo)
 {
     Id          = bo.Id;
     Name        = bo.Name;
     Description = bo.Description;
     SortCode    = bo.SortCode;
 }
Esempio n. 3
0
        public IActionResult CreateOrEditForSystemWorkSection(Guid id, Guid systemWorkPlaceID)
        {
            var isNew = false;
            var bo    = _BoRepository.GetSingle(systemWorkPlaceID, x => x.SystemWorkSections).SystemWorkSections.Where(x => x.ID == id).FirstOrDefault();

            if (bo == null)
            {
                bo             = new SystemWorkSection();
                bo.Name        = "";
                bo.Description = "";
                bo.SortCode    = "";
                isNew          = true;
            }
            var workPlace = _BoRepository.GetSingle(systemWorkPlaceID);
            var boVM      = new SystemWorkSectionVM(bo);

            boVM.ParentItemID = workPlace.ID.ToString();
            boVM.ParentItem   = new Common.ViewModelComponents.PlainFacadeItem()
            {
                DisplayName = workPlace.Name, Name = workPlace.Name, ID = workPlace.ID.ToString()
            };

            boVM.IsNew = isNew;
            return(PartialView("../../Views/ApplicationManagement/SystemConfig/_CreateOrEditForSystemWorkSection", boVM));
        }
Esempio n. 4
0
        public IActionResult SaveSystemWorkSection([Bind("ID,IsNew,ParentItemID,Name,Description,SortCode")] SystemWorkSectionVM boVM)
        {
            if (ModelState.IsValid)
            {
                var systemWorkPlaceID = Guid.Parse(boVM.ParentItemID);
                var workPlace         = _BoRepository.GetSingle(systemWorkPlaceID);

                var bo = _BoRepository.GetSingle(systemWorkPlaceID, x => x.SystemWorkSections).SystemWorkSections.Where(x => x.ID == boVM.ID).FirstOrDefault();
                if (bo == null)
                {
                    bo = new SystemWorkSection();
                    boVM.MapToBo(bo);
                    workPlace.SystemWorkSections.Add(bo);
                    _BoRepository.EditAndSave(workPlace);
                }
                else
                {
                    boVM.MapToBo(bo);
                    _BoRepository.EntitiesContext.SystemWorkSections.Update(bo);
                    _BoRepository.EntitiesContext.SaveChanges();
                }
                var saveStatus = new EditAndSaveStatus()
                {
                    SaveOk = true, StatusMessage = "../../SystemConfig/Index"
                };
                return(Json(saveStatus));
            }
            else
            {
                return(PartialView("../../Views/ApplicationManagement/SystemConfig/_CreateOrEditForSystemWorkSection", boVM));
            }
        }
Esempio n. 5
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();
        }
Esempio n. 6
0
        /// <summary>
        /// 根据 SystemWorkSection 和相应的归属 Id 对象,更新左侧菜单条目
        /// </summary>
        /// <param name="bo">SystemWorkSection 对象</param>
        /// <param name="pId">归属主菜单的Id</param>
        public static void UpdateSubMenuItems(SystemWorkSection 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      = "",
                    SortCode = bo.SortCode,
                    ParentId = pId
                };
                _SubMenuItems.Add(miniMenuItem);
            }
            else
            {
                sMenuItem.Name     = bo.Name;
                sMenuItem.URL      = "";
                sMenuItem.SortCode = bo.SortCode;
                sMenuItem.ParentId = pId;
            }
        }
Esempio n. 7
0
 public void MapToBo(SystemWorkSection bo)
 {
     bo.Name          = Name;
     bo.Description   = Description;
     bo.BussinessCode = BussinessCode;
 }
Esempio n. 8
0
 public void MapToBo(SystemWorkSection bo)
 {
     bo.Name        = Name;
     bo.Description = Description;
     bo.SortCode    = SortCode;
 }