/// <summary> /// 获取Folder下的菜单分组 /// </summary> /// <param name="folderInfo">folderInfo</param> /// <returns></returns> public IList <XModelBase> GetGroupInfos(XMenuFolderInfo folderInfo) { string sql = "SELECT * FROM MenuGroup WHERE FolderId='{0}' Order By OrderIndex "; sql = string.Format(sql, folderInfo.ID); return(this.GetListBySql(sql)); }
/// <summary> /// 更新操作 /// </summary> /// <param name="modelInfo">信息</param> /// <returns></returns> public override bool Update(XModelBase modelInfo) { string sql = String.Empty; XMenuFolderInfo info = modelInfo as XMenuFolderInfo; sql = "Update " + this.TableName + " Set Title='{0}',FolderName='{1}',ImageFile='{2}',LargeImageFile='{3}',OrderIndex={4} Where ID='{5}'"; sql = string.Format(sql, info.Title, info.FolderName, info.ImageFile, info.LargeImageFile, info.OrderIndex); return(this.m_DataAccess.ExecuteNonQuery(sql) > 0); }
/// <summary> /// 添加操作 /// </summary> /// <param name="modelInfo">信息</param> /// <returns></returns> public override bool Insert(XModelBase modelInfo) { string sql = String.Empty; XMenuFolderInfo info = modelInfo as XMenuFolderInfo; sql = "Insert Into " + this.TableName + "(ID,Title,FolderName,ImageFile,LargeImageFile,OrderIndex)Values('{0}','{1}','{2}','{3}','{4}',{5})"; sql = String.Format(sql, info.ID, info.Title, info.FolderName, info.ImageFile, info.LargeImageFile, info.OrderIndex); return(this.m_DataAccess.ExecuteNonQuery(sql) > 0); }
/// <summary> /// 将数据行转换为实体 /// </summary> /// <param name="modelRow">数据行记录</param> /// <returns>实体信息</returns> protected override void DataRow2ModelBase(XModelBase modelInfo, DataRow modelRow) { XMenuFolderInfo info = modelInfo as XMenuFolderInfo; info.ID = XHelper.GetString(modelRow["RID"]); // info.Title = XHelper.GetString(modelRow["Title"]); // info.FolderName = XHelper.GetString(modelRow["FolderName"]); // info.ImageFile = XHelper.GetString(modelRow["ImageFile"]); // info.LargeImageFile = XHelper.GetString(modelRow["LargeImageFile"]); // info.OrderIndex = XHelper.GetInt(modelRow["OrderIndex"]); // }
/// <summary> /// 自定义修改校验 /// </summary> /// <param name="modelInfo"></param> /// <returns></returns> protected override string GetValidateUpdateCustom(XModelBase modelInfo) { string validateInfo = string.Empty; XMenuFolderInfo menufolder = modelInfo as XMenuFolderInfo; if (menufolder == null) { return(this.GetNotRightType()); } return(string.Empty); }
private void InitMenuTree() { this.tvRole.Nodes.Clear(); IList <XModelBase> folderInfos = this.m_MenuFolderBusiness.GetAll(); IList <XModelBase> groupInfos = this.m_MenuGroupBusienss.GetAll(); IList <XModelBase> menuInfos = this.m_MenuBusiness.GetAll(); foreach (XModelBase folderModel in folderInfos) { XMenuFolderInfo folderInfo = folderModel as XMenuFolderInfo; XTreeNode folderNode = new XTreeNode(); folderNode.Code = folderInfo.ID; folderNode.Name = folderInfo.FolderName; folderNode.Model = folderInfo; folderNode.Text = folderInfo.FolderName; IList <XMenuGroupInfo> menuGroupInfos = this.GetMenuGroups(groupInfos, folderInfo); foreach (XMenuGroupInfo groupInfo in menuGroupInfos) { XTreeNode groupNode = new XTreeNode(); groupNode.Code = groupInfo.ID; groupNode.Name = groupInfo.GroupName; groupNode.Model = groupInfo; groupNode.Text = groupInfo.GroupName; IList <XMenuInfo> menuInfs = this.GetMenuInfos(menuInfos, groupInfo); foreach (XMenuInfo menuInfo in menuInfs) { XTreeNode menuNode = new XTreeNode(); menuNode.Code = menuInfo.ID; menuNode.Name = menuInfo.MenuName; menuNode.Model = menuInfo; menuNode.Text = menuInfo.MenuName; groupNode.Nodes.Add(menuNode); } folderNode.Nodes.Add(groupNode); } this.tvRole.Nodes.Add(folderNode); } }
public XMenuFolder MenuInfo2MenuFolder(XMenuFolderInfo folderInfo) { XMenuFolder menuTable = new XMenuFolder(); menuTable.FolderName = folderInfo.FolderName; menuTable.Image = folderInfo.ImageFile; menuTable.LargeImage = folderInfo.LargeImageFile; menuTable.Title = folderInfo.Title; foreach (XMenuGroupInfo groupInfo in folderInfo.MenuGroupInfos) { foreach (XMenuInfo menuInfo in groupInfo.Menus) { DataRow menuRow = menuTable.NewRow(); XMenuInfoTool.MenuInfo2MenuRow(menuInfo, menuRow); menuTable.Rows.Add(menuRow); } } return(menuTable); }
public XMenuFolderLoadEventArgs(XMenuFolderInfo menuFolderInfo) { this.m_MenuFolderInfo = menuFolderInfo; }
/// <summary> /// 获取菜单分组 /// </summary> /// <param name="menuInfos"></param> /// <param name="folderInfo"></param> /// <returns></returns> private IList <XMenuGroupInfo> GetMenuGroups(IList <XModelBase> menuGroupInfos, XMenuFolderInfo folderInfo) { IList <XMenuGroupInfo> groupInfos = new List <XMenuGroupInfo>(); foreach (XModelBase groupModel in menuGroupInfos) { XMenuGroupInfo groupInfo = groupModel as XMenuGroupInfo; if (groupInfo.FolderId == folderInfo.ID) { groupInfos.Add(groupInfo); } } return(groupInfos); }
/// <summary> /// 获取Folder下的菜单分组 /// </summary> /// <param name="folderInfo">folderInfo</param> /// <returns></returns> public IList <XModelBase> GetGroupInfos(XMenuFolderInfo folderInfo) { return(this.m_MenuGroupProvider.GetGroupInfos(folderInfo)); }