public List<HomePage> GetAll() { HomePageDAC _homePageComponent = new HomePageDAC(); IDataReader reader = _homePageComponent.GetAllHomePage().CreateDataReader(); List<HomePage> _homePageList = new List<HomePage>(); while(reader.Read()) { if(_homePageList == null) _homePageList = new List<HomePage>(); HomePage _homePage = new HomePage(); if(reader["HomePageID"] != DBNull.Value) _homePage.HomePageID = Convert.ToInt32(reader["HomePageID"]); if(reader["SectionID"] != DBNull.Value) _homePage.SectionID = Convert.ToInt32(reader["SectionID"]); if(reader["ContentModuleTypeID"] != DBNull.Value) _homePage.ContentModuleTypeID = Convert.ToInt32(reader["ContentModuleTypeID"]); if(reader["PositionID"] != DBNull.Value) _homePage.PositionID = Convert.ToInt32(reader["PositionID"]); if(reader["OrderNumber"] != DBNull.Value) _homePage.OrderNumber = Convert.ToInt32(reader["OrderNumber"]); if(reader["IsFullWidth"] != DBNull.Value) _homePage.IsFullWidth = Convert.ToBoolean(reader["IsFullWidth"]); if(reader["ItemsNumber"] != DBNull.Value) _homePage.ItemsNumber = Convert.ToInt32(reader["ItemsNumber"]); if(reader["ItemsPerPage"] != DBNull.Value) _homePage.ItemsPerPage = Convert.ToInt32(reader["ItemsPerPage"]); if(reader["IsActive"] != DBNull.Value) _homePage.IsActive = Convert.ToBoolean(reader["IsActive"]); if (reader["SiteID"] != DBNull.Value) _homePage.SiteID = Convert.ToInt32(reader["SiteID"]); if (reader["LanguageID"] != DBNull.Value) _homePage.LanguageID = Convert.ToInt32(reader["LanguageID"]); if (reader["Title"] != DBNull.Value) _homePage.Title = Convert.ToString(reader["Title"]); if (reader["HomePageGroupID"] != DBNull.Value) _homePage.HomePageGroupID = Convert.ToInt32(reader["HomePageGroupID"]); _homePage.NewRecord = false; _homePageList.Add(_homePage); } reader.Close(); return _homePageList; }
public bool Insert(HomePage homepage) { int autonumber = 0; HomePageDAC homepageComponent = new HomePageDAC(); bool endedSuccessfuly = homepageComponent.InsertNewHomePage( ref autonumber, homepage.SectionID, homepage.ContentModuleTypeID, homepage.PositionID, homepage.OrderNumber, homepage.IsFullWidth, homepage.ItemsNumber, homepage.ItemsPerPage, homepage.IsActive,homepage.Title,homepage.LanguageID,homepage.HomePageGroupID); if(endedSuccessfuly) { homepage.HomePageID = autonumber; } return endedSuccessfuly; }
public bool Update(HomePage homepage ,int old_homePageID) { HomePageDAC homepageComponent = new HomePageDAC(); return homepageComponent.UpdateHomePage( homepage.SectionID, homepage.ContentModuleTypeID, homepage.PositionID, homepage.OrderNumber, homepage.IsFullWidth, homepage.ItemsNumber, homepage.ItemsPerPage, homepage.IsActive,homepage.Title,homepage.LanguageID,homepage.HomePageGroupID, old_homePageID); }
public HomePage GetByID(int _homePageID) { HomePageDAC _homePageComponent = new HomePageDAC(); IDataReader reader = _homePageComponent.GetByIDHomePage(_homePageID); HomePage _homePage = null; while(reader.Read()) { _homePage = new HomePage(); if(reader["HomePageID"] != DBNull.Value) _homePage.HomePageID = Convert.ToInt32(reader["HomePageID"]); if(reader["SectionID"] != DBNull.Value) _homePage.SectionID = Convert.ToInt32(reader["SectionID"]); if(reader["ContentModuleTypeID"] != DBNull.Value) _homePage.ContentModuleTypeID = Convert.ToInt32(reader["ContentModuleTypeID"]); if(reader["PositionID"] != DBNull.Value) _homePage.PositionID = Convert.ToInt32(reader["PositionID"]); if(reader["OrderNumber"] != DBNull.Value) _homePage.OrderNumber = Convert.ToInt32(reader["OrderNumber"]); if(reader["IsFullWidth"] != DBNull.Value) _homePage.IsFullWidth = Convert.ToBoolean(reader["IsFullWidth"]); if(reader["ItemsNumber"] != DBNull.Value) _homePage.ItemsNumber = Convert.ToInt32(reader["ItemsNumber"]); if(reader["ItemsPerPage"] != DBNull.Value) _homePage.ItemsPerPage = Convert.ToInt32(reader["ItemsPerPage"]); if(reader["IsActive"] != DBNull.Value) _homePage.IsActive = Convert.ToBoolean(reader["IsActive"]); if (reader["SiteID"] != DBNull.Value) _homePage.SiteID = Convert.ToInt32(reader["SiteID"]); if (reader["LanguageID"] != DBNull.Value) _homePage.LanguageID = Convert.ToInt32(reader["LanguageID"]); if (reader["Title"] != DBNull.Value) _homePage.Title = Convert.ToString(reader["Title"]); if (reader["HomePageGroupID"] != DBNull.Value) _homePage.HomePageGroupID = Convert.ToInt32(reader["HomePageGroupID"]); _homePage.NewRecord = false; } reader.Close(); return _homePage; }