//-------------------------------------------------------------------------- public List <Hotel> init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <Hotel> l_Hotel = new List <Hotel>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { Hotel m_Hotel = new Hotel(); m_Hotel.Hotel_ID = smartReader.GetInt32("Hotel_ID"); m_Hotel.Hotel_Name = smartReader.GetString("Hotel_Name"); m_Hotel.Hotel_Location = smartReader.GetInt32("Hotel_Location"); m_Hotel.Hotel_Address = smartReader.GetString("Hotel_Address"); m_Hotel.Hotel_Content = smartReader.GetString("Hotel_Content"); m_Hotel.HotelImage = smartReader.GetString("HotelImage"); m_Hotel.Hotel_StarRate = smartReader.GetFloat("Hotel_StarRate"); m_Hotel.Hotel_ListImage = smartReader.GetString("Hotel_ListImage"); m_Hotel.Product_ID = smartReader.GetInt32("Product_ID"); m_Hotel.UserCreate = smartReader.GetInt32("UserCreate"); m_Hotel.Hotel_CreateDate = smartReader.GetDateTime("Hotel_CreateDate"); m_Hotel.Hotel_RulesRefund = smartReader.GetString("Hotel_RulesRefund"); m_Hotel.Hotel_Facilities_ID = smartReader.GetString("Hotel_Facilities_ID"); m_Hotel.Tag_ID = smartReader.GetString("Tag_ID"); l_Hotel.Add(m_Hotel); } smartReader.disposeReader(reader); return(l_Hotel); } catch (SqlException err) { throw err; } finally { db.closeConnection(con); } }
//-------------------------------------------------------------------------- public List <User> init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <User> l_User = new List <User>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { User m_User = new User(); m_User.User_ID = smartReader.GetInt32("User_ID"); m_User.User_Name = smartReader.GetString("User_Name"); m_User.User_transactionName = smartReader.GetString("User_transactionName"); m_User.Birthday = smartReader.GetDateTime("Birthday"); m_User.User_Image = smartReader.GetString("User_Image"); m_User.User_Address = smartReader.GetString("User_Address"); m_User.User_Email = smartReader.GetString("User_Email"); m_User.User_Phone = smartReader.GetString("User_Phone"); m_User.User_Pass = smartReader.GetString("User_Pass"); m_User.User_Active = smartReader.GetBoolean("User_Active"); m_User.User_Role = smartReader.GetInt32("User_Role"); m_User.User_InternalStaff = smartReader.GetBoolean("User_InternalStaff"); m_User.Agents_ID = smartReader.GetInt32("Agents_ID"); l_User.Add(m_User); } smartReader.disposeReader(reader); return(l_User); } catch (SqlException err) { throw err; } finally { db.closeConnection(con); } }
//-------------------------------------------------------------------------- public List <Post> init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <Post> l_Post = new List <Post>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { Post m_Post = new Post(); m_Post.Post_id = smartReader.GetInt32("Post_id"); m_Post.Post_Title = smartReader.GetString("Post_Tile"); m_Post.Post_Type = smartReader.GetInt32("Post_Type"); m_Post.Post_Description = smartReader.GetString("Post_Description"); m_Post.Post_Content = smartReader.GetString("Post_Content"); m_Post.Post_Images = smartReader.GetString("Post_Images"); m_Post.Post_CategoryID = smartReader.GetString("Post_CategoryID"); m_Post.Post_Slug = smartReader.GetString("Post_Slug"); m_Post.Post_tag = smartReader.GetString("Post_tag"); m_Post.Post_UserID = smartReader.GetInt32("Post_UserID"); m_Post.Post_Location = smartReader.GetInt32("Post_Location"); m_Post.Post_CreateDate = smartReader.GetDateTime("Post_CreateDate"); l_Post.Add(m_Post); } smartReader.disposeReader(reader); return(l_Post); } catch (SqlException err) { throw err; } finally { db.closeConnection(con); } }
//-------------------------------------------------------------------------- public List <TourDetailPrice> init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <TourDetailPrice> l_TourDetailPrice = new List <TourDetailPrice>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { TourDetailPrice m_TourDetailPrice = new TourDetailPrice(); m_TourDetailPrice.TourDetailPrice_ID = smartReader.GetInt32("TourDetailPrice_ID"); m_TourDetailPrice.TourDetailPrice_ArrivalDate = smartReader.GetDateTime("TourDetailPrice_ArrivalDate"); m_TourDetailPrice.TourDetailPrice_DepartureDate = smartReader.GetDateTime("TourDetailPrice_DepartureDate"); m_TourDetailPrice.TourDetailPrice_Price1 = smartReader.GetInt64("TourDetailPrice_Price1"); m_TourDetailPrice.TourDetailPrice_NumberPrice1 = smartReader.GetInt32("TourDetailPrice_NumberPrice1"); m_TourDetailPrice.TourDetailPrice_Price2 = smartReader.GetInt64("TourDetailPrice_Price2"); m_TourDetailPrice.TourDetailPrice_NumberPrice2 = smartReader.GetInt32("TourDetailPrice_NumberPrice2"); m_TourDetailPrice.TourDetailPrice_Price3 = smartReader.GetInt64("TourDetailPrice_Price3"); m_TourDetailPrice.TourDetailPrice_NumberPrice3 = smartReader.GetInt32("TourDetailPrice_NumberPrice3"); l_TourDetailPrice.Add(m_TourDetailPrice); } smartReader.disposeReader(reader); return(l_TourDetailPrice); } catch (SqlException err) { throw err; } finally { db.closeConnection(con); } }
public List <SetupMailSMTP> init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <SetupMailSMTP> l_ContactPersons = new List <SetupMailSMTP>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { SetupMailSMTP m_ContactPersons = new SetupMailSMTP(); m_ContactPersons.SetupMailSMTP_ID = smartReader.GetInt32("SetupMailSMTP_ID"); m_ContactPersons.SetupMailSMTP_Email = smartReader.GetString("SetupMailSMTP_Email"); m_ContactPersons.SetupMailSMTP_Password = smartReader.GetString("SetupMailSMTP_Password"); m_ContactPersons.SetupMailSMTP_Host = smartReader.GetString("SetupMailSMTP_Host"); m_ContactPersons.SetupMailSMTP_Port = smartReader.GetString("SetupMailSMTP_Port"); m_ContactPersons.SetupMailSMTP_SSL = smartReader.GetBoolean("SetupMailSMTP_SSL"); m_ContactPersons.SetupMailSMTP_Header = smartReader.GetString("SetupMailSMTP_Header"); m_ContactPersons.SetupMailSMTP_Footer = smartReader.GetString("SetupMailSMTP_Footer"); m_ContactPersons.Agents_ID = smartReader.GetInt32("Agents_ID"); l_ContactPersons.Add(m_ContactPersons); } smartReader.disposeReader(reader); return(l_ContactPersons); } catch (SqlException err) { throw err; } finally { db.closeConnection(con); } }