private void LoadMenuItemDetails(MenuEntityItem itemParent, NavBarGroup menuItemParent) { List<MenuEntityItem> details = new MenuEntityItemLogic().GetAllByParent(itemParent.MenuEntityItemId); foreach (MenuEntityItem item in details) { NavBarItem menuItem = new NavBarItem(); menuItem.Text = item.Name; if (!string.IsNullOrEmpty(item.PagePath) && item.PagePath != "#") menuItem.NavigateUrl = item.PagePath; menuItemParent.Items.Add(menuItem); } }
private void LoadMenuItemDetails(MenuEntityItem itemParent, DevExpress.Web.ASPxMenu.MenuItem menuItemParent) { List<MenuEntityItem> details = new MenuEntityItemLogic().GetAllByParent(itemParent.MenuEntityItemId); foreach (MenuEntityItem item in details) { DevExpress.Web.ASPxMenu.MenuItem menuItem = new DevExpress.Web.ASPxMenu.MenuItem(); menuItem.Text = item.Name; menuItem.Name = item.MenuEntityItemId.ToString(); if (!string.IsNullOrEmpty(item.PagePath) && item.PagePath != "#") menuItem.NavigateUrl = item.PagePath; menuItemParent.Items.Add(menuItem); } }
private void FillControls() { if (Request.QueryString["ID"] != null) { _Menu = new MenuEntityItemLogic().GetByID(Convert.ToInt32(Request.QueryString["ID"])); txtMenuName.Text = _Menu.Name; cbMenuType.DataBind(); if (cbMenuType.Items.FindByValue(_Menu.MenuEntityTypeId) != null) cbMenuType.SelectedIndex = cbMenuType.Items.FindByValue(_Menu.MenuEntityTypeId).Index; txtDisplayOrder.Text = _Menu.DisplayOrder.ToString(); if (_Menu.MenuEntityTypeId == (int)MenuEntityTypeEnum.ExternalLink) { divExternalLink.Visible = true; txtExternalPageURL.Text = _Menu.PagePath; cbSiteName.DataBind(); if (cbSiteName.Items.FindByValue(_Menu.ContentEntityId) != null) cbSiteName.SelectedIndex = cbSiteName.Items.FindByValue(_Menu.ContentEntityId).Index; } else if (_Menu.MenuEntityTypeId == (int)MenuEntityTypeEnum.SiteContent) { divSite.Visible = true; BusinessLogicLayer.Entities.ContentManagement.SitePage page = new SitePageLogic().GetByID(_Menu.ContentEntityId); SiteSection section = new SiteSectionLogic().GetByID(page.SectionId); cbSiteName.DataBind(); if (cbSiteName.Items.FindByValue(section.SiteId) != null) cbSiteName.SelectedIndex = cbSiteName.Items.FindByValue(section.SiteId).Index; //cbSiteName.DataBind(); cbSectionName.DataBind(); if (cbSectionName.Items.FindByValue(section.SiteSectionId) != null) cbSectionName.SelectedIndex = cbSectionName.Items.FindByValue(section.SiteSectionId).Index; cbPageName.DataBind(); if (cbPageName.Items.FindByValue(page.SitePageId) != null) cbPageName.SelectedIndex = cbPageName.Items.FindByValue(page.SitePageId).Index; } else if (_Menu.MenuEntityTypeId == (int)MenuEntityTypeEnum.ArticleSection) { divSiteSection.Visible = true; SiteSection section = new SiteSectionLogic().GetByID(_Menu.ContentEntityId); cbSiteName.DataBind(); if (cbSiteName.Items.FindByValue(section.SiteId) != null) cbSiteName.SelectedIndex = cbSiteName.Items.FindByValue(section.SiteId).Index; //cbSiteName.DataBind(); cbSectionNameArticle.DataBind(); if (cbSectionNameArticle.Items.FindByValue(section.SiteSectionId) != null) cbSectionNameArticle.SelectedIndex = cbSectionNameArticle.Items.FindByValue(section.SiteSectionId).Index; } if (Request.QueryString["ParentID"] == null) { cbLang.DataBind(); if (cbLang.Items.FindByValue(_Menu.LanguageID) != null) cbLang.SelectedIndex = cbLang.Items.FindByValue(_Menu.LanguageID).Index; cbMenuPosition.DataBind(); if (cbMenuPosition.Items.FindByValue(_Menu.MenuEntityPositionID) != null) cbMenuPosition.SelectedIndex = cbMenuPosition.Items.FindByValue(_Menu.MenuEntityPositionID).Index; } } }
private void GetFormValues() { if (Request.QueryString["ID"] != null) { _Menu = new MenuEntityItemLogic().GetByID(Convert.ToInt32(Request.QueryString["ID"])); } else { _Menu = new MenuEntityItem(); if (Request.QueryString["ParentID"] != null) _Menu.MenuEntityParentId = Convert.ToInt32(Request.QueryString["ParentID"]); } if (txtDisplayOrder.Text != "") _Menu.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text); _Menu.Name = txtMenuName.Text; _Menu.MenuEntityTypeId = Convert.ToInt32(cbMenuType.Value); if (divExternalLink.Visible) { _Menu.PagePath = txtExternalPageURL.Text; _Menu.ContentEntityId = Convert.ToInt32(cbSiteName.Value); } else if (divSite.Visible) { _Menu.ContentEntityId = Convert.ToInt32(cbPageName.Value); _Menu.PagePath = BusinessLogicLayer.Common.PagePath + _Menu.ContentEntityId; } else if (divSystemPages.Visible) { _Menu.ContentEntityId = Convert.ToInt32(cbSystemPages.Value); _Menu.PagePath = new SystemPageLogic().GetByID(_Menu.ContentEntityId).Path; } else if (divSiteSection.Visible) { _Menu.ContentEntityId = Convert.ToInt32(cbSectionNameArticle.Value); _Menu.PagePath = "~/ArticlesView.aspx?code=" + _Menu.ContentEntityId; } if (divForParent.Visible) { _Menu.LanguageID = Convert.ToInt32(cbLang.Value); _Menu.MenuEntityPositionID = Convert.ToInt32(cbMenuPosition.Value); } }
public bool Update(MenuEntityItem menuentityitem ,int old_menuEntityItemId) { MenuEntityItemDAC menuentityitemComponent = new MenuEntityItemDAC(); return menuentityitemComponent.UpdateMenuEntityItem( menuentityitem.MenuEntityParentId, menuentityitem.Name, menuentityitem.PagePath, menuentityitem.ContentEntityId, menuentityitem.DisplayAlways, menuentityitem.IsActive, menuentityitem.IconPath, menuentityitem.DisplayOrder, menuentityitem.ModifiedDate, menuentityitem.MenuEntityTypeId, menuentityitem.MenuEntityId,menuentityitem.LanguageID,menuentityitem.MenuEntityPositionID, old_menuEntityItemId); }
public bool Insert(MenuEntityItem menuentityitem) { int autonumber = 0; MenuEntityItemDAC menuentityitemComponent = new MenuEntityItemDAC(); bool endedSuccessfuly = menuentityitemComponent.InsertNewMenuEntityItem( ref autonumber, menuentityitem.MenuEntityParentId, menuentityitem.Name, menuentityitem.PagePath, menuentityitem.ContentEntityId, menuentityitem.DisplayAlways, menuentityitem.IsActive, menuentityitem.IconPath, menuentityitem.DisplayOrder, menuentityitem.ModifiedDate, menuentityitem.MenuEntityTypeId, menuentityitem.MenuEntityId,menuentityitem.LanguageID,menuentityitem.MenuEntityPositionID); if(endedSuccessfuly) { menuentityitem.MenuEntityItemId = autonumber; } return endedSuccessfuly; }
public MenuEntityItem GetByID(int _menuEntityItemId) { MenuEntityItemDAC _menuEntityItemComponent = new MenuEntityItemDAC(); IDataReader reader = _menuEntityItemComponent.GetByIDMenuEntityItem(_menuEntityItemId); MenuEntityItem _menuEntityItem = null; while(reader.Read()) { _menuEntityItem = new MenuEntityItem(); if(reader["MenuEntityItemId"] != DBNull.Value) _menuEntityItem.MenuEntityItemId = Convert.ToInt32(reader["MenuEntityItemId"]); if(reader["MenuEntityParentId"] != DBNull.Value) _menuEntityItem.MenuEntityParentId = Convert.ToInt32(reader["MenuEntityParentId"]); if(reader["Name"] != DBNull.Value) _menuEntityItem.Name = Convert.ToString(reader["Name"]); if(reader["PagePath"] != DBNull.Value) _menuEntityItem.PagePath = Convert.ToString(reader["PagePath"]); if(reader["ContentEntityId"] != DBNull.Value) _menuEntityItem.ContentEntityId = Convert.ToInt32(reader["ContentEntityId"]); if(reader["DisplayAlways"] != DBNull.Value) _menuEntityItem.DisplayAlways = Convert.ToBoolean(reader["DisplayAlways"]); if(reader["IsActive"] != DBNull.Value) _menuEntityItem.IsActive = Convert.ToBoolean(reader["IsActive"]); if(reader["IconPath"] != DBNull.Value) _menuEntityItem.IconPath = Convert.ToString(reader["IconPath"]); if(reader["DisplayOrder"] != DBNull.Value) _menuEntityItem.DisplayOrder = Convert.ToInt32(reader["DisplayOrder"]); if(reader["ModifiedDate"] != DBNull.Value) _menuEntityItem.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if(reader["MenuEntityTypeId"] != DBNull.Value) _menuEntityItem.MenuEntityTypeId = Convert.ToInt32(reader["MenuEntityTypeId"]); if(reader["MenuEntityId"] != DBNull.Value) _menuEntityItem.MenuEntityId = Convert.ToInt32(reader["MenuEntityId"]); if (reader["LanguageID"] != DBNull.Value) _menuEntityItem.LanguageID = Convert.ToInt32(reader["LanguageID"]); if (reader["MenuEntityPositionID"] != DBNull.Value) _menuEntityItem.MenuEntityPositionID = Convert.ToInt32(reader["MenuEntityPositionID"]); _menuEntityItem.NewRecord = false; } reader.Close(); return _menuEntityItem; }
public List<MenuEntityItem> GetAllParents(int MenuEntityId) { MenuEntityItemDAC _menuEntityItemComponent = new MenuEntityItemDAC(); IDataReader reader = _menuEntityItemComponent.GetAllMenuEntityItem("MenuEntityParentId is null AND MenuEntityId = " + MenuEntityId).CreateDataReader(); List<MenuEntityItem> _menuEntityItemList = new List<MenuEntityItem>(); while (reader.Read()) { if (_menuEntityItemList == null) _menuEntityItemList = new List<MenuEntityItem>(); MenuEntityItem _menuEntityItem = new MenuEntityItem(); if (reader["MenuEntityItemId"] != DBNull.Value) _menuEntityItem.MenuEntityItemId = Convert.ToInt32(reader["MenuEntityItemId"]); if (reader["MenuEntityParentId"] != DBNull.Value) _menuEntityItem.MenuEntityParentId = Convert.ToInt32(reader["MenuEntityParentId"]); if (reader["Name"] != DBNull.Value) _menuEntityItem.Name = Convert.ToString(reader["Name"]); if (reader["PagePath"] != DBNull.Value) _menuEntityItem.PagePath = Convert.ToString(reader["PagePath"]); if (reader["ContentEntityId"] != DBNull.Value) _menuEntityItem.ContentEntityId = Convert.ToInt32(reader["ContentEntityId"]); if (reader["DisplayAlways"] != DBNull.Value) _menuEntityItem.DisplayAlways = Convert.ToBoolean(reader["DisplayAlways"]); if (reader["IsActive"] != DBNull.Value) _menuEntityItem.IsActive = Convert.ToBoolean(reader["IsActive"]); if (reader["IconPath"] != DBNull.Value) _menuEntityItem.IconPath = Convert.ToString(reader["IconPath"]); if (reader["DisplayOrder"] != DBNull.Value) _menuEntityItem.DisplayOrder = Convert.ToInt32(reader["DisplayOrder"]); if (reader["ModifiedDate"] != DBNull.Value) _menuEntityItem.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if (reader["MenuEntityTypeId"] != DBNull.Value) _menuEntityItem.MenuEntityTypeId = Convert.ToInt32(reader["MenuEntityTypeId"]); if (reader["MenuEntityId"] != DBNull.Value) _menuEntityItem.MenuEntityId = Convert.ToInt32(reader["MenuEntityId"]); _menuEntityItem.NewRecord = false; _menuEntityItemList.Add(_menuEntityItem); } reader.Close(); return _menuEntityItemList; }
public MenuEntityItem GetAllParentItemSideForSiteIdByLanguageId(int SiteId,int LanguageId) { MenuEntityItemDAC _menuEntityItemComponent = new MenuEntityItemDAC(); IDataReader reader = _menuEntityItemComponent.GetAllMenuEntityItem(String.Format("MenuEntityPositionID = 2 and MenuEntityParentId is null and MenuEntityTypeId = {0} and ContentEntityId = {1} and LanguageId = {2}", Convert.ToInt32(MenuEntityTypeEnum.ExternalLink), SiteId,LanguageId)).CreateDataReader(); MenuEntityItem _menuEntityItem = new MenuEntityItem(); while (reader.Read()) { _menuEntityItem = new MenuEntityItem(); if (reader["MenuEntityItemId"] != DBNull.Value) _menuEntityItem.MenuEntityItemId = Convert.ToInt32(reader["MenuEntityItemId"]); if (reader["MenuEntityParentId"] != DBNull.Value) _menuEntityItem.MenuEntityParentId = Convert.ToInt32(reader["MenuEntityParentId"]); if (reader["Name"] != DBNull.Value) _menuEntityItem.Name = Convert.ToString(reader["Name"]); if (reader["PagePath"] != DBNull.Value) _menuEntityItem.PagePath = Convert.ToString(reader["PagePath"]); if (reader["ContentEntityId"] != DBNull.Value) _menuEntityItem.ContentEntityId = Convert.ToInt32(reader["ContentEntityId"]); if (reader["DisplayAlways"] != DBNull.Value) _menuEntityItem.DisplayAlways = Convert.ToBoolean(reader["DisplayAlways"]); if (reader["IsActive"] != DBNull.Value) _menuEntityItem.IsActive = Convert.ToBoolean(reader["IsActive"]); if (reader["IconPath"] != DBNull.Value) _menuEntityItem.IconPath = Convert.ToString(reader["IconPath"]); if (reader["DisplayOrder"] != DBNull.Value) _menuEntityItem.DisplayOrder = Convert.ToInt32(reader["DisplayOrder"]); if (reader["ModifiedDate"] != DBNull.Value) _menuEntityItem.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if (reader["MenuEntityTypeId"] != DBNull.Value) _menuEntityItem.MenuEntityTypeId = Convert.ToInt32(reader["MenuEntityTypeId"]); if (reader["MenuEntityId"] != DBNull.Value) _menuEntityItem.MenuEntityId = Convert.ToInt32(reader["MenuEntityId"]); if (reader["LanguageID"] != DBNull.Value) _menuEntityItem.LanguageID = Convert.ToInt32(reader["LanguageID"]); if (reader["MenuEntityPositionID"] != DBNull.Value) _menuEntityItem.MenuEntityPositionID = Convert.ToInt32(reader["MenuEntityPositionID"]); _menuEntityItem.NewRecord = false; } reader.Close(); return _menuEntityItem; }
public List<MenuEntityItem> GetAll() { MenuEntityItemDAC _menuEntityItemComponent = new MenuEntityItemDAC(); IDataReader reader = _menuEntityItemComponent.GetAllMenuEntityItem().CreateDataReader(); List<MenuEntityItem> _menuEntityItemList = new List<MenuEntityItem>(); while(reader.Read()) { if(_menuEntityItemList == null) _menuEntityItemList = new List<MenuEntityItem>(); MenuEntityItem _menuEntityItem = new MenuEntityItem(); if(reader["MenuEntityItemId"] != DBNull.Value) _menuEntityItem.MenuEntityItemId = Convert.ToInt32(reader["MenuEntityItemId"]); if(reader["MenuEntityParentId"] != DBNull.Value) _menuEntityItem.MenuEntityParentId = Convert.ToInt32(reader["MenuEntityParentId"]); if(reader["Name"] != DBNull.Value) _menuEntityItem.Name = Convert.ToString(reader["Name"]); if(reader["PagePath"] != DBNull.Value) _menuEntityItem.PagePath = Convert.ToString(reader["PagePath"]); if (reader["ContentEntityId"] != DBNull.Value) _menuEntityItem.ContentEntityId = Convert.ToInt32(reader["ContentEntityId"]); if(reader["DisplayAlways"] != DBNull.Value) _menuEntityItem.DisplayAlways = Convert.ToBoolean(reader["DisplayAlways"]); if(reader["IsActive"] != DBNull.Value) _menuEntityItem.IsActive = Convert.ToBoolean(reader["IsActive"]); if(reader["IconPath"] != DBNull.Value) _menuEntityItem.IconPath = Convert.ToString(reader["IconPath"]); if(reader["DisplayOrder"] != DBNull.Value) _menuEntityItem.DisplayOrder = Convert.ToInt32(reader["DisplayOrder"]); if(reader["ModifiedDate"] != DBNull.Value) _menuEntityItem.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); if (reader["MenuEntityTypeId"] != DBNull.Value) { _menuEntityItem.MenuEntityTypeId = Convert.ToInt32(reader["MenuEntityTypeId"]); if (_menuEntityItem.MenuEntityTypeId == (int)MenuEntityTypeEnum.SiteContent) { SitePage page = new SitePageLogic().GetByID(_menuEntityItem.ContentEntityId); if (page != null) { _menuEntityItem.PageName = page.PageName; _menuEntityItem.SiteName = new SiteLogic().GetByID(new SiteSectionLogic().GetByID(page.SectionId).SiteId).Name; } } else if (_menuEntityItem.MenuEntityTypeId == (int)MenuEntityTypeEnum.ExternalLink) { _menuEntityItem.SiteName = new SiteLogic().GetByID(_menuEntityItem.ContentEntityId).Name; } else if (_menuEntityItem.MenuEntityTypeId == (int)MenuEntityTypeEnum.SystemPage) { _menuEntityItem.PageName = new SystemPageLogic().GetByID(_menuEntityItem.ContentEntityId).Name; } } if(reader["MenuEntityId"] != DBNull.Value) _menuEntityItem.MenuEntityId = Convert.ToInt32(reader["MenuEntityId"]); if (reader["LanguageID"] != DBNull.Value) _menuEntityItem.LanguageID = Convert.ToInt32(reader["LanguageID"]); if (reader["MenuEntityPositionID"] != DBNull.Value) _menuEntityItem.MenuEntityPositionID = Convert.ToInt32(reader["MenuEntityPositionID"]); _menuEntityItem.NewRecord = false; _menuEntityItemList.Add(_menuEntityItem); } reader.Close(); return _menuEntityItemList; }