//-------------------------------------------------------------------------- public List <Tour> init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <Tour> l_Tour = new List <Tour>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { Tour m_Tour = new Tour(); m_Tour.Tour_ID = smartReader.GetInt32("Tour_ID"); m_Tour.Tour_Name = smartReader.GetString("Tour_Name"); m_Tour.Tour_Location = smartReader.GetInt32("Tour_Location"); m_Tour.Tour_Topic = smartReader.GetString("Tour_Topic"); m_Tour.Tour_OrganizationalUnit = smartReader.GetString("Tour_OrganizationalUnit"); m_Tour.Tour_DepartureDate = smartReader.GetDateTime("Tour_DepartureDate"); m_Tour.Tour_TimeZone = smartReader.GetInt32("Tour_TimeZone"); m_Tour.Tour_Price = smartReader.GetInt32("Tour_Price"); m_Tour.Tour_PriceSale = smartReader.GetInt32("Tour_PriceSale"); m_Tour.Tour_Qty = smartReader.GetInt32("Tour_Qty"); m_Tour.Tour_Score = smartReader.GetFloat("Tour_Score"); m_Tour.Tour_Description = smartReader.GetString("Tour_Description"); m_Tour.Tour_Content = smartReader.GetString("Tour_Content"); m_Tour.Tour_Itinerary = smartReader.GetString("Tour_Itinerary"); m_Tour.Tour_Schedule = smartReader.GetString("Tour_Schedule"); m_Tour.Tour_Rules = smartReader.GetString("Tour_Rules"); m_Tour.Tour_ListImage = smartReader.GetString("Tour_ListImage"); m_Tour.Tour_Image = smartReader.GetString("Tour_Image"); m_Tour.Product_ID = smartReader.GetInt32("Product_ID"); m_Tour.Tour_Fixed = smartReader.GetBoolean("Tour_Fixed"); m_Tour.UserCreate = smartReader.GetInt32("UserCreate"); m_Tour.CreateDate = smartReader.GetDateTime("CreateDate"); m_Tour.Tour_Active = smartReader.GetBoolean("Tour_Active"); m_Tour.Tour_StarRate = smartReader.GetFloat("Tour_StarRate"); m_Tour.Hotel_ID = smartReader.GetInt32("Hotel_ID"); l_Tour.Add(m_Tour); } smartReader.disposeReader(reader); return(l_Tour); } 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 <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); } }