public void ActionPageGetControl(PageGetControlModel model) { try { if (model.ModuleID > 0) { SysPageEntity _CurrentPage = null; SysModuleEntity _CurrentModule = SysModuleService.Instance.GetByID(model.ModuleID); if (model.PageID > 0) { _CurrentPage = SysPageService.Instance.GetByID(model.PageID); } if (_CurrentModule != null) { HL.Core.Global.Class _CurrentObject = new HL.Core.Global.Class(_CurrentModule.AssemblyName, _CurrentModule.TypeName); string filePath = (System.IO.File.Exists(CPViewPage.Server.MapPath("~/Views/Design/" + _CurrentModule.Code + ".ascx")) ? "~/Views/Design/" + _CurrentModule.Code + ".ascx" : "~/" + HL.Core.Web.Setting.Sys_CPDir + "/Design/EditModule.ascx"); string sHtml = Utils.GetHtmlControl(CPViewPage, filePath, "CurrentObject", _CurrentObject, "CurrentPage", _CurrentPage, "CurrentModule", _CurrentModule, "LangID", model.LangID); if (_CurrentObject.ExistsField("MenuID")) { System.Reflection.FieldInfo _FieldInfo = _CurrentObject.GetFieldInfo("MenuID"); object[] attributes = _FieldInfo.GetCustomAttributes(typeof(HL.Core.MVC.PropertyInfo), true); if (attributes != null && attributes.GetLength(0) > 0) { HL.Core.MVC.PropertyInfo propertyInfo = (HL.Core.MVC.PropertyInfo)attributes[0]; List <HL.Lib.Global.ListItem.Item> listMenu = HL.Lib.Global.ListItem.List.GetListByText(propertyInfo.Value.ToString()); string menuType = HL.Lib.Global.ListItem.List.FindByName(listMenu, "Type").Value; listMenu = HL.Lib.Global.ListItem.List.GetList(WebMenuService.Instance, model.LangID, menuType); listMenu.Insert(0, new HL.Lib.Global.ListItem.Item(string.Empty, string.Empty)); for (int j = 1; listMenu != null && j < listMenu.Count; j++) { ajaxModel.Params += "<option " + (_CurrentPage != null && _CurrentPage.MenuID.ToString() == listMenu[j].Value ? "selected" : "") + " value='" + listMenu[j].Value + "'> " + listMenu[j].Name + "</option>"; } } } ajaxModel.Html = sHtml.Replace("{CPPath}", CPViewPage.CPPath); } } } catch (Exception ex) { HL.Lib.Global.Error.Write(ex); } EndResponse(); }
/// <summary> /// 根据ID获取菜单详情 /// </summary> /// <param name="keyword"></param> /// <returns></returns> public ModuleOutputDto GetForm(string keyword) { SysModuleEntity userEntityList = _sysModuleRepository.Get(keyword); ModuleDto userDtoList = AutoMapper.Mapper.Map <ModuleDto>(userEntityList); ModuleOutputDto outputDto = new ModuleOutputDto(); outputDto.UserDtoSingle = userDtoList; return(outputDto); }
public void ActionAdd(SysModuleModel model) { if (model.RecordID > 0) { entity = SysModuleService.Instance.GetByID(model.RecordID); // khoi tao gia tri mac dinh khi update } else { entity = new SysModuleEntity(); // khoi tao gia tri mac dinh khi insert entity.TypeName = "HL.Lib.Controllers.[Name]Controller"; entity.AssemblyName = "HLv1.0.MVC.Lib, Version=1.0.0.0, Culture=Neutral,PublicKeyToken=null"; entity.Order = GetMaxOrder(model); } ViewBag.Data = entity; ViewBag.Model = model; }
/// <summary> /// 提交菜单更改 /// </summary> /// <param name="userInputDto"></param> /// <param name="userinfo"></param> public void SubmitForm(ModuleSumbitInputDto inputDto, UserInfo userinfo) { if (!string.IsNullOrEmpty(inputDto.Id)) //更新 { SysModuleEntity entity = _sysModuleRepository.Get(inputDto.Id); entity.Name = inputDto.Name; entity.EnglishName = inputDto.EnglishName; entity.Iconic = inputDto.Iconic; entity.IsLast = inputDto.IsLast; entity.ParentId = inputDto.ParentId; entity.Remark = inputDto.Remark; entity.Sort = inputDto.Sort; entity.Url = inputDto.Url; _sysModuleRepository.Update(entity); } else { SysModuleEntity entity = AutoMapper.Mapper.Map <SysModuleEntity>(inputDto); entity.Id = Guid.NewGuid().ToString(); entity.CreatePerson = userinfo.UserName; entity.CreateTime = DateTime.Now; _sysModuleRepository.Insert(entity); } }