public void Remove(AirlineCompany t)
        {
            SqlConnection con = new SqlConnection(AppConfig.CONNECTION_STRING);

            using (con)
            {
                SqlCommand cmd = new SqlCommand($"DELETE_AirlineCompanie", con);
                cmd.Parameters.Add(new SqlParameter("@id", t.Id));
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();
                con.Close();
            }
        }
Exemple #2
0
 public void ChangeMyPassword(LoginToken <AirlineCompany> token, string oldPassword, string newPassword)
 {
     if (token.User != null)
     {
         AirlineCompany company = _airlineDAO.GetAirlineByUsername(token.User.UserName);
         if (company.Password.ToString() == oldPassword)
         {
             company.Password = newPassword;
             _airlineDAO.Update(company);
         }
         else
         {
             throw new WrongPasswordException("Wrong Password");
         }
     }
 }
        public void Add(AirlineCompany t)
        {
            SqlConnection con = new SqlConnection(AppConfig.CONNECTION_STRING);

            using (con)
            {
                SqlCommand cmd = new SqlCommand("ADD_COMPANY", con);
                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));
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();
                con.Close();
            }
        }
Exemple #4
0
        public bool TryAirlineLogin(string userName, string password, out LoginToken <AirlineCompany> token)
        {
            AirlineCompany company = _airlineDAO.GetAirlineByUsername(userName);

            if (company != null)
            {
                if (company.UserName == userName)
                {
                    if (company.Password == password)
                    {
                        token      = new LoginToken <AirlineCompany>();
                        token.User = company;
                        return(true);
                    }
                    else
                    {
                        throw new WrongPasswordException("Wrong Password");
                    }
                }
            }
            token = null;
            return(false);
        }
Exemple #5
0
        public override bool Equals(object obj)
        {
            AirlineCompany other = obj as AirlineCompany;

            return(this == other);
        }