public SitePage GetDefaultPage(int SiteId) { SitePageDAC _sitePageComponent = new SitePageDAC(); IDataReader reader = _sitePageComponent.GetAllSitePage("IsMainPage = 1 and SiteId = " + SiteId).CreateDataReader(); SitePage _sitePage = null; while (reader.Read()) { _sitePage = new SitePage(); if (reader["SitePageId"] != DBNull.Value) { _sitePage.SitePageId = Convert.ToInt32(reader["SitePageId"]); } if (reader["SectionId"] != DBNull.Value) { _sitePage.SectionId = Convert.ToInt32(reader["SectionId"]); } if (reader["PageStatusId"] != DBNull.Value) { _sitePage.PageStatusId = Convert.ToInt32(reader["PageStatusId"]); } if (reader["SecurityAccessTypeId"] != DBNull.Value) { _sitePage.SecurityAccessTypeId = Convert.ToInt32(reader["SecurityAccessTypeId"]); } if (reader["CreatorId"] != DBNull.Value) { _sitePage.CreatorId = Convert.ToInt32(reader["CreatorId"]); } if (reader["UniquePageName"] != DBNull.Value) { _sitePage.UniquePageName = Convert.ToString(reader["UniquePageName"]); } if (reader["IsMainPage"] != DBNull.Value) { _sitePage.IsMainPage = Convert.ToBoolean(reader["IsMainPage"]); } if (reader["RowGuid"] != DBNull.Value) { _sitePage.RowGuid = new Guid(reader["RowGuid"].ToString()); } if (reader["RevisionDate"] != DBNull.Value) { _sitePage.RevisionDate = Convert.ToDateTime(reader["RevisionDate"]); } if (reader["ModifiedDate"] != DBNull.Value) { _sitePage.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); } if (reader["SiteId"] != DBNull.Value) { _sitePage.SiteId = Convert.ToInt32(reader["SiteId"]); } _sitePage.NewRecord = false; } reader.Close(); return(_sitePage); }
public List <SitePage> GetAllBySiteId(string SiteId) { SitePageDAC _sitePageComponent = new SitePageDAC(); string whereCondition = ""; if (!string.IsNullOrEmpty(SiteId) && SiteId != "0") { whereCondition = "SiteId = " + SiteId; } IDataReader reader = _sitePageComponent.GetAllSitePage(whereCondition).CreateDataReader(); List <SitePage> _sitePageList = new List <SitePage>(); while (reader.Read()) { if (_sitePageList == null) { _sitePageList = new List <SitePage>(); } SitePage _sitePage = new SitePage(); if (reader["SitePageId"] != DBNull.Value) { _sitePage.SitePageId = Convert.ToInt32(reader["SitePageId"]); } if (reader["SectionId"] != DBNull.Value) { _sitePage.SectionId = Convert.ToInt32(reader["SectionId"]); } if (reader["PageStatusId"] != DBNull.Value) { _sitePage.PageStatusId = Convert.ToInt32(reader["PageStatusId"]); } if (reader["SecurityAccessTypeId"] != DBNull.Value) { _sitePage.SecurityAccessTypeId = Convert.ToInt32(reader["SecurityAccessTypeId"]); } if (reader["CreatorId"] != DBNull.Value) { _sitePage.CreatorId = Convert.ToInt32(reader["CreatorId"]); } if (reader["UniquePageName"] != DBNull.Value) { _sitePage.UniquePageName = Convert.ToString(reader["UniquePageName"]); } if (reader["IsMainPage"] != DBNull.Value) { _sitePage.IsMainPage = Convert.ToBoolean(reader["IsMainPage"]); } if (reader["RowGuid"] != DBNull.Value) { _sitePage.RowGuid = new Guid(reader["RowGuid"].ToString()); } if (reader["RevisionDate"] != DBNull.Value) { _sitePage.RevisionDate = Convert.ToDateTime(reader["RevisionDate"]); } if (reader["ModifiedDate"] != DBNull.Value) { _sitePage.ModifiedDate = Convert.ToDateTime(reader["ModifiedDate"]); } if (reader["SiteId"] != DBNull.Value) { _sitePage.SiteId = Convert.ToInt32(reader["SiteId"]); } _sitePage.NewRecord = false; _sitePageList.Add(_sitePage); } reader.Close(); return(_sitePageList); }