public long CreateNewAirline(LoginToken <Administrator> token, AirlineCompany airline) { long newId = 0; if (UserIsValid(token)) { newId = _airlineDAO.Add(airline); } return(newId); }
public void Remove(AirlineCompany t) { using (SqlConnection connection = new SqlConnection(FlightCenterConfig.CONNECTION_STRING)) { SqlCommand cmd = new SqlCommand("REMOVE_AIRLINE_COMPANY", connection); cmd.Parameters.Add(new SqlParameter("@ID", t.AirlineName)); connection.Open(); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader reader = cmd.ExecuteReader(System.Data.CommandBehavior.Default); cmd.Connection.Close(); } }
public void Update(AirlineCompany t) { using (SqlConnection connection = new SqlConnection(FlightCenterConfig.CONNECTION_STRING)) { SqlCommand cmd = new SqlCommand("UPDATE_AIRLINE_COMPANY", connection); cmd.Parameters.Add(new SqlParameter("@ID", t.ID)); cmd.Parameters.Add(new SqlParameter("@AIRLINE_NAME", t.AirlineName)); cmd.Parameters.Add(new SqlParameter("@USER_NAME", t.UserName)); cmd.Parameters.Add(new SqlParameter("@PASSWOED", t.Password)); cmd.Parameters.Add(new SqlParameter("@COUNTRY_CODE", t.CountryCode)); connection.Open(); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader reader = cmd.ExecuteReader(System.Data.CommandBehavior.Default); cmd.Connection.Close(); } }
public bool TryAirlineLogin(string username, string password, out LoginToken <AirlineCompany> token) { _airlineDAO = new AirlineDAOMSSQL(); AirlineCompany company = _airlineDAO.GetAirLineByUserName(username); if (company != null) { if (company.Password == password) { token = new LoginToken <AirlineCompany>() { User = company }; return(true); } } else { try { if (company == null) { token = null; return(false); } } catch (WrongPasswordException) { token = new LoginToken <AirlineCompany>() { User = company }; return(false); throw new WrongPasswordException("Your Password is not correct, Try again"); } } token = null; return(false); }
public long Add(AirlineCompany t) { long newId = 0; using (SqlConnection connection = new SqlConnection(FlightCenterConfig.CONNECTION_STRING)) { using (SqlCommand cmd = new SqlCommand("ADD_NEW_AIRLINECOMPANY", connection)) { connection.Open(); cmd.Parameters.Add(new SqlParameter("@AIRLINE_NAME", t.AirlineName)); cmd.Parameters.Add(new SqlParameter("@USER_NAME", t.UserName)); cmd.Parameters.Add(new SqlParameter("@PASSWORD", t.Password)); cmd.Parameters.Add(new SqlParameter("@COUNTRY_CODE", t.CountryCode)); cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default); } } return(newId); }
public IList <Flight> GetFlightsByAirlineCompany(AirlineCompany airline) { throw new NotImplementedException(); }
public override bool Equals(object obj) { AirlineCompany otherairlineCompany = obj as AirlineCompany; return(this.ID == otherairlineCompany.ID); }