public void Update(WebMenuInfo menuInfo) { IDataParameter[] parms = null; var SQL_UPDATE = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); ExecuteNonQuery(SQL_UPDATE, parms); }
public string GetFunctionOrChannelOrContentSelectScript(WebMenuInfo menuInfo) { if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Function)) { if (menuInfo.FunctionId > 0) { var functionName = KeywordManager.GetFunctionName(EKeywordTypeUtils.GetEnumType(menuInfo.KeywordType), menuInfo.FunctionId); return($@"selectKeyword(""{menuInfo.KeywordType},{menuInfo.FunctionId},{functionName}"")"); } } else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Site)) { if (menuInfo.ContentId > 0) { var tableStyle = NodeManager.GetTableStyle(PublishmentSystemInfo, menuInfo.ChannelId); var tableName = NodeManager.GetTableName(PublishmentSystemInfo, menuInfo.ChannelId); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, menuInfo.ContentId); var pageUrl = PageUtilityWX.GetContentUrl(PublishmentSystemInfo, contentInfo); return ($@"contentSelect(""{contentInfo.Title}"", ""{menuInfo.ChannelId}"", ""{menuInfo.ContentId}"", ""{pageUrl}"")"); } else if (menuInfo.ChannelId > 0) { var nodeNames = NodeManager.GetNodeNameNavigation(PublishmentSystemId, menuInfo.ChannelId); var pageUrl = PageUtilityWX.GetChannelUrl(PublishmentSystemInfo, NodeManager.GetNodeInfo(PublishmentSystemId, menuInfo.ChannelId)); return($"selectChannel('{nodeNames}', '{menuInfo.ChannelId}', '{pageUrl}');"); } } return(string.Empty); }
public int Insert(WebMenuInfo menuInfo) { var menuID = 0; menuInfo.Taxis = GetMaxTaxis(menuInfo.ParentID) + 1; IDataParameter[] parms = null; var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { ExecuteNonQuery(trans, SQL_INSERT, parms); menuID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(menuID); }
public void Update(WebMenuInfo menuInfo) { IDataParameter[] parms = null; var sqlUpdate = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); ExecuteNonQuery(sqlUpdate, parms); }
public int Insert(WebMenuInfo menuInfo) { var menuId = 0; menuInfo.Taxis = GetMaxTaxis(menuInfo.ParentId) + 1; IDataParameter[] parms = null; var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TableName, out parms); using (var conn = GetConnection()) { conn.Open(); using (var trans = conn.BeginTransaction()) { try { menuId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms); trans.Commit(); } catch { trans.Rollback(); throw; } } } return(menuId); }
public WebMenuInfo GetMenuInfo(int menuID) { WebMenuInfo menuInfo = null; string SQL_WHERE = $"WHERE ID = {menuID}"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { if (rdr.Read()) { menuInfo = new WebMenuInfo(rdr); } rdr.Close(); } return(menuInfo); }
public WebMenuInfo GetMenuInfo(int menuId) { WebMenuInfo menuInfo = null; string sqlWhere = $"WHERE ID = {menuId}"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { if (rdr.Read()) { menuInfo = new WebMenuInfo(rdr); } rdr.Close(); } return(menuInfo); }
public List <WebMenuInfo> GetWebMenuInfoList(int publishmentSystemID) { var menuInfoList = new List <WebMenuInfo>(); string SQL_WHERE = $"WHERE {WebMenuAttribute.PublishmentSystemID} = {publishmentSystemID} AND ParentID = 0"; var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null); using (var rdr = ExecuteReader(SQL_SELECT)) { while (rdr.Read()) { var menuInfo = new WebMenuInfo(rdr); menuInfoList.Add(menuInfo); } rdr.Close(); } return(menuInfoList); }
public List <WebMenuInfo> GetWebMenuInfoList(int publishmentSystemId) { var menuInfoList = new List <WebMenuInfo>(); string sqlWhere = $"WHERE {WebMenuAttribute.PublishmentSystemId} = {publishmentSystemId} AND ParentID = 0"; var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null); using (var rdr = ExecuteReader(sqlSelect)) { while (rdr.Read()) { var menuInfo = new WebMenuInfo(rdr); menuInfoList.Add(menuInfo); } rdr.Close(); } return(menuInfoList); }
public void Sync(int publishmentSystemID) { DeleteAll(publishmentSystemID); var menuInfoList = DataProviderWX.MenuDAO.GetMenuInfoList(publishmentSystemID, 0); foreach (var menuInfo in menuInfoList) { var navigationType = ENavigationType.Url; if (menuInfo.MenuType == EMenuType.Site) { navigationType = ENavigationType.Site; } else if (menuInfo.MenuType == EMenuType.Keyword) { navigationType = ENavigationType.Function; } var keywordType = EKeywordType.Text; var functionID = 0; if (menuInfo.MenuType == EMenuType.Keyword && !string.IsNullOrEmpty(menuInfo.Keyword)) { var keywordID = DataProviderWX.KeywordMatchDAO.GetKeywordIDByMPController(publishmentSystemID, menuInfo.Keyword); if (keywordID > 0) { var keywordInfo = DataProviderWX.KeywordDAO.GetKeywordInfo(keywordID); functionID = KeywordManager.GetFunctionID(keywordInfo); } } var webMenuInfo = new WebMenuInfo { PublishmentSystemID = publishmentSystemID, MenuName = menuInfo.MenuName, NavigationType = ENavigationTypeUtils.GetValue(navigationType), Url = menuInfo.Url, ChannelID = menuInfo.ChannelID, ContentID = menuInfo.ContentID, KeywordType = EKeywordTypeUtils.GetValue(keywordType), FunctionID = functionID, ParentID = 0 }; var menuID = Insert(webMenuInfo); var subMenuInfoList = DataProviderWX.MenuDAO.GetMenuInfoList(publishmentSystemID, menuInfo.MenuID); if (subMenuInfoList != null && subMenuInfoList.Count > 0) { foreach (var subMenuInfo in subMenuInfoList) { navigationType = ENavigationType.Url; if (subMenuInfo.MenuType == EMenuType.Site) { navigationType = ENavigationType.Site; } else if (subMenuInfo.MenuType == EMenuType.Keyword) { navigationType = ENavigationType.Function; } keywordType = EKeywordType.Text; functionID = 0; if (subMenuInfo.MenuType == EMenuType.Keyword && !string.IsNullOrEmpty(subMenuInfo.Keyword)) { var keywordID = DataProviderWX.KeywordMatchDAO.GetKeywordIDByMPController(publishmentSystemID, subMenuInfo.Keyword); if (keywordID > 0) { var keywordInfo = DataProviderWX.KeywordDAO.GetKeywordInfo(keywordID); functionID = KeywordManager.GetFunctionID(keywordInfo); } } var subWebMenuInfo = new WebMenuInfo { PublishmentSystemID = publishmentSystemID, MenuName = subMenuInfo.MenuName, NavigationType = ENavigationTypeUtils.GetValue(navigationType), Url = subMenuInfo.Url, ChannelID = subMenuInfo.ChannelID, ContentID = subMenuInfo.ContentID, KeywordType = EKeywordTypeUtils.GetValue(keywordType), FunctionID = functionID, ParentID = menuID }; Insert(subWebMenuInfo); } } } }
public override void Submit_OnClick(object sender, EventArgs e) { if (Page.IsPostBack && Page.IsValid) { try { var menuInfo = new WebMenuInfo(); if (_menuId > 0) { menuInfo = DataProviderWx.WebMenuDao.GetMenuInfo(_menuId); } menuInfo.MenuName = TbMenuName.Text; menuInfo.ParentId = _parentId; menuInfo.PublishmentSystemId = PublishmentSystemId; menuInfo.NavigationType = DdlNavigationType.SelectedValue; if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Url)) { menuInfo.Url = TbUrl.Text; } else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.Function)) { var keywordType = Request.Form["keywordType"]; var functionId = TranslateUtils.ToInt(Request.Form["functionID"]); if (!string.IsNullOrEmpty(keywordType) && functionId > 0) { menuInfo.KeywordType = keywordType; menuInfo.FunctionId = functionId; } else { FailMessage("菜单保存失败,必须选择微功能页面,请点击下方按钮进行选择"); return; } } else if (ENavigationTypeUtils.Equals(menuInfo.NavigationType, ENavigationType.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 (_menuId > 0) { DataProviderWx.WebMenuDao.Update(menuInfo); SuccessMessage("底部导航菜单修改成功!"); } else { _menuId = DataProviderWx.WebMenuDao.Insert(menuInfo); SuccessMessage("底部导航菜单新增成功!"); } var redirectUrl = PageWebMenu.GetRedirectUrl(PublishmentSystemId, _parentId, _menuId); LtlPageTitle.Text += $@"<script>parent.redirect('{redirectUrl}');</script>"; } catch (Exception ex) { FailMessage(ex, "底部导航菜单配置失败!"); } } }