public Administrator Get(long id) { Administrator admin = null; StringBuilder sb = new StringBuilder(); sb.Append($"SELECT * FROM Administrators WHERE ID = {id}"); string SQL = sb.ToString(); DataSet DS = DL.GetSqlQueryDS(SQL, "Administrators"); DataTable dt = DS.Tables[0]; foreach (DataRow dr in dt.Rows) { admin = new Administrator(); admin.ID = (long)dr["ID"]; admin.FIRST_NAME = (string)dr["FIRST_NAME"]; admin.LAST_NAME = (string)dr["LAST_NAME"]; admin.USER_NAME = (string)dr["USER_NAME"]; admin.PASSWORD = (string)dr["PASSWORD"]; } if (admin != null) { return(admin); } return(null); }
public Customer Get(long id) { Customer c = null; StringBuilder sb = new StringBuilder(); sb.Append($"SELECT * FROM customers WHERE ID = {id}"); string SQL = sb.ToString(); DataSet DS = DL.GetSqlQueryDS(SQL, "Customers"); DataTable dt = DS.Tables[0]; foreach (DataRow dr in dt.Rows) { c = new Customer(); c.ID = (long)dr["ID"]; c.USER_NAME = (string)dr["USER_NAME"]; c.PASSWORD = (string)dr["PASSWORD"]; c.FIRST_NAME = (string)dr["FIRST_NAME"]; c.LAST_NAME = (string)dr["LAST_NAME"]; c.ADDRESS = (string)dr["ADDRESS"]; c.PHONE_NO = (string)dr["PHONE_NO"]; c.CREDIT_CARD_NUMBER = (string)dr["CREDIT_CARD_NUMBER"]; } if (c != null) { return(c); } else { return(null); } }
public AirlineCompany Get(long id) { AirlineCompany a = null; StringBuilder sb = new StringBuilder(); sb.Append($"SELECT * FROM AirlineCompanies WHERE ID = {id}"); string SQL = sb.ToString(); DataSet DS = DL.GetSqlQueryDS(SQL, "AirlineCompanies"); DataTable dt = DS.Tables[0]; foreach (DataRow dr in dt.Rows) { a = new AirlineCompany(); a.ID = (long)dr["ID"]; a.AIRLINE_NAME = (string)dr["AIRLINE_NAME"]; a.USER_NAME = (string)dr["USER_NAME"]; a.PASSWORD = (string)dr["PASSWORD"]; a.COUNTRY_CODE = (long)dr["COUNTRY_CODE"]; } if (a != null) { return(a); } return(null); }
public Country Get(long id) { Country country = null; StringBuilder sb = new StringBuilder(); sb.Append($"SELECT * FROM Countries WHERE ID = {id}"); string SQL = sb.ToString(); DataSet DS = DL.GetSqlQueryDS(SQL, "Countries"); DataTable dt = DS.Tables[0]; foreach (DataRow dr in dt.Rows) { country = new Country(); country.ID = Convert.ToInt64(dr["ID"]); country.COUNTRY_NAME = (string)dr["COUNTRY_NAME"]; } if (country != null) { return(country); } return(null); }
public Ticket Get(long id) { Ticket t = null; StringBuilder sb = new StringBuilder(); sb.Append($"SELECT * FROM Tickets WHERE ID = {id}"); string SQL = sb.ToString(); DataSet DS = DL.GetSqlQueryDS(SQL, "Tickets"); DataTable dt = DS.Tables[0]; foreach (DataRow dr in dt.Rows) { t = new Ticket(); t.ID = (long)dr["ID"]; t.FLIGHT_ID = (long)dr["FLIGHT_ID"]; t.CUSTOMER_ID = (long)dr["CUSTOMER_ID"]; } if (t != null) { return(t); } return(null); }
public Flight Get(long flightId) { Flight flight = null; StringBuilder sb = new StringBuilder(); sb.Append($"SELECT * FROM Flights WHERE ID = {flightId}"); string SQL = sb.ToString(); DataSet DS = DL.GetSqlQueryDS(SQL, "Flights"); DataTable dt = DS.Tables[0]; foreach (DataRow dr in dt.Rows) { flight = new Flight(); flight.ID = Convert.ToInt64(dr["ID"]); flight.AIRLINECOMPANY_ID = (long)dr["AIRLINECOMPANY_ID"]; flight.ORIGIN_COUNTRY_CODE = (long)dr["ORIGIN_COUNTRY_CODE"]; flight.DESTINATION_COUNTRY_CODE = (long)dr["DESTINATION_COUNTRY_CODE"]; flight.DEPARTURE_TIME = Convert.ToDateTime(dr["DEPARTURE_TIME"].ToString()); flight.LANDING_TIME = Convert.ToDateTime(dr["LANDING_TIME"].ToString()); flight.REMANING_TICKETS = (int)dr["REMANING_TICKETS"]; flight.TOTAL_TICKETS = Convert.ToInt32(dr["TOTAL_TICKETS"]); } if (flight != null) { return(flight); } return(null); }