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; }
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; } } }
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); }