public object GetValue(string attributeName) { foreach (var name in AllAttributes) { if (StringUtils.EqualsIgnoreCase(name, attributeName)) { var nameVlaue = GetType().GetProperty(name).GetValue(this, null); if (attributeName == "MenuType") { return(EMenuTypeUtils.GetEnumType(nameVlaue.ToString())); } return(nameVlaue); } } return(null); }
public void DdlMenuType_OnSelectedIndexChanged(object sender, EventArgs e) { var isHideAll = false; if (_parentId == 0 && _menuId > 0) { var childrenCount = DataProviderWx.MenuDao.GetCount(_menuId); if (childrenCount > 0) { isHideAll = true; } } if (isHideAll) { PhMenuType.Visible = PhUrl.Visible = PhKeyword.Visible = PhSite.Visible = false; } else { var menuType = EMenuTypeUtils.GetEnumType(DdlMenuType.SelectedValue); PhUrl.Visible = PhKeyword.Visible = PhSite.Visible = false; if (menuType == EMenuType.Url) { PhUrl.Visible = true; } else if (menuType == EMenuType.Keyword) { PhKeyword.Visible = true; } else if (menuType == EMenuType.Site) { PhSite.Visible = true; } } }
public void ddlMenuType_OnSelectedIndexChanged(object sender, EventArgs e) { var isHideAll = false; if (parentID == 0 && menuID > 0) { var childrenCount = DataProviderWX.MenuDAO.GetCount(menuID); if (childrenCount > 0) { isHideAll = true; } } if (isHideAll) { phMenuType.Visible = phUrl.Visible = phKeyword.Visible = phSite.Visible = false; } else { var menuType = EMenuTypeUtils.GetEnumType(ddlMenuType.SelectedValue); phUrl.Visible = phKeyword.Visible = phSite.Visible = false; if (menuType == EMenuType.Url) { phUrl.Visible = true; } else if (menuType == EMenuType.Keyword) { phKeyword.Visible = true; } else if (menuType == EMenuType.Site) { phSite.Visible = true; } } }
public List <MenuInfo> GetMenuInfoList(int publishmentSystemID) { var list = new List <MenuInfo>(); var parms = new IDataParameter[] { GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, publishmentSystemID), GetParameter(PARM_PARENT_ID, EDataType.Integer, 0) }; using (var rdr = ExecuteReader(SQL_SELECT_ALLBY, parms)) { while (rdr.Read()) { var menuInfo = new MenuInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetValue(2).ToString(), EMenuTypeUtils.GetEnumType(rdr.GetValue(3).ToString()), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetInt32(6), rdr.GetInt32(7), rdr.GetInt32(8), rdr.GetInt32(9)); list.Add(menuInfo); } rdr.Close(); } return(list); }
public MenuInfo GetMenuInfo(int menuID) { MenuInfo menuInfo = null; var parms = new IDataParameter[] { GetParameter(PARM_MENU_ID, EDataType.Integer, menuID) }; using (var rdr = ExecuteReader(SQL_SELECT, parms)) { if (rdr.Read()) { menuInfo = new MenuInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetValue(2).ToString(), EMenuTypeUtils.GetEnumType(rdr.GetValue(3).ToString()), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetInt32(6), rdr.GetInt32(7), rdr.GetInt32(8), rdr.GetInt32(9)); } rdr.Close(); } return(menuInfo); }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { try { var menuInfo = new MenuInfo(); if (_menuId > 0) { menuInfo = DataProviderWx.MenuDao.GetMenuInfo(_menuId); } menuInfo.MenuName = TbMenuName.Text; menuInfo.ParentId = _parentId; menuInfo.PublishmentSystemId = PublishmentSystemId; menuInfo.MenuType = EMenuTypeUtils.GetEnumType(DdlMenuType.SelectedValue); if (PhMenuType.Visible) { if (menuInfo.MenuType == EMenuType.Keyword) { if (!DataProviderWx.KeywordMatchDao.IsExists(PublishmentSystemId, TbKeyword.Text)) { FailMessage("菜单保存失败,所填关键词不存在,请先在关键词回复中添加"); return; } } else if (menuInfo.MenuType == EMenuType.Site) { var idsCollection = Request.Form["idsCollection"]; if (!string.IsNullOrEmpty(idsCollection)) { menuInfo.ChannelId = TranslateUtils.ToInt(idsCollection.Split('_')[0]); menuInfo.ContentId = TranslateUtils.ToInt(idsCollection.Split('_')[1]); } if (menuInfo.ChannelId == 0 && menuInfo.ContentId == 0) { FailMessage("菜单保存失败,必须选择微网站页面,请点击下方按钮进行选择"); return; } } } if (_parentId > 0) { if (StringUtils.GetByteCount(TbMenuName.Text) > 26) { FailMessage("菜单保存失败,子菜单菜名称不能超过26个字节(13个汉字)"); return; } } else { if (StringUtils.GetByteCount(TbMenuName.Text) > 16) { FailMessage("菜单保存失败,子菜单菜名称不能超过16个字节(8个汉字)"); return; } } if (menuInfo.MenuType == EMenuType.Url) { if (StringUtils.GetByteCount(TbUrl.Text) > 256) { FailMessage("菜单保存失败,菜单网址不能超过256个字节"); return; } } if (menuInfo.MenuType == EMenuType.Url) { menuInfo.Url = TbUrl.Text; } else if (menuInfo.MenuType == EMenuType.Keyword) { menuInfo.Keyword = TbKeyword.Text; } else if (menuInfo.MenuType == EMenuType.Site) { var idsCollection = Request.Form["idsCollection"]; if (!string.IsNullOrEmpty(idsCollection)) { menuInfo.ChannelId = TranslateUtils.ToInt(idsCollection.Split('_')[0]); menuInfo.ContentId = TranslateUtils.ToInt(idsCollection.Split('_')[1]); } } if (_menuId > 0) { DataProviderWx.MenuDao.Update(menuInfo); Body.AddSiteLog(PublishmentSystemId, "修改自定义菜单"); SuccessMessage("自定义菜单修改成功!"); } else { _menuId = DataProviderWx.MenuDao.Insert(menuInfo); Body.AddSiteLog(PublishmentSystemId, "新增自定义菜单"); SuccessMessage("自定义菜单新增成功!"); } var redirectUrl = PageMenu.GetRedirectUrl(PublishmentSystemId, _parentId, _menuId); LtlPageTitle.Text += $@"<script>parent.redirect('{redirectUrl}');</script>"; } catch (Exception ex) { FailMessage(ex, "自定义菜单配置失败!"); } } }
public List <MenuInfo> GetMenuInfoList(int publishmentSystemId) { var list = new List <MenuInfo>(); var parms = new IDataParameter[] { GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId), GetParameter(ParmParentId, EDataType.Integer, 0) }; using (var rdr = ExecuteReader(SqlSelectAllby, parms)) { while (rdr.Read()) { var menuInfo = new MenuInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetValue(2).ToString(), EMenuTypeUtils.GetEnumType(rdr.GetValue(3).ToString()), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), rdr.GetInt32(6), rdr.GetInt32(7), rdr.GetInt32(8), rdr.GetInt32(9)); list.Add(menuInfo); } rdr.Close(); } return(list); }