public bool CreateNewCustomer(LoginToken <Administrator> token, Customer customer, string customeruserName, string customerPassword, out bool isCustomerAlreadyExists) { bool isCreated = false; bool isCustomerAlreadyExistsInternal = true; if (CheckToken(token)) { if (!IsUserExists(customer)) { isCustomerAlreadyExistsInternal = false; long addedCustomerId = _customerDAO.Add(customer, customeruserName, customerPassword); Customer customerForChecking = _customerDAO.Get(addedCustomerId); isCreated = Statics.BulletprofComparsion(customer, customerForChecking); } else { throw new UserAlreadyExistsException <Customer>(customer); } } isCustomerAlreadyExists = isCustomerAlreadyExistsInternal; return(isCreated); }
public bool UpdateCustomerDetails(LoginToken <Administrator> token, Customer customer, string customeruserName, string customerPassword, out bool isCustomerExists) { bool isUpdated = false; bool isCustomerExistsInternal = false; if (CheckToken(token)) { if (IsUserExists(customer)) { isCustomerExistsInternal = true; _customerDAO.Update(customer, customeruserName, customerPassword); Customer customerForChecking = _customerDAO.Get(customer.ID); isUpdated = Statics.BulletprofComparsion(customer, customerForChecking); } else { throw new UserDoesntExistsException <Customer>(customer); } } isCustomerExists = isCustomerExistsInternal; return(isUpdated); }
public bool UpdateAirlineDetails(LoginToken <Administrator> token, AirlineCompany airline, string airlineUserName, string airlinePassword, out bool isAirlineExists) { bool isUpdated = false; bool isAirlineExistsInternal = false; if (CheckToken(token)) { if (IsUserExists(airline)) { isAirlineExistsInternal = true; _airlineDAO.Update(airline, airlineUserName, airlinePassword); AirlineCompany airlineForChecking = _airlineDAO.Get(airline.ID); isUpdated = Statics.BulletprofComparsion(airline, airlineForChecking); } else { throw new UserDoesntExistsException <AirlineCompany>(airline); } } isAirlineExists = isAirlineExistsInternal; return(isUpdated); }
public bool CreateNewAirline(LoginToken <Administrator> token, AirlineCompany airline, string airlineUserName, string airlinePassword, out bool isAirlineExists) { bool isCreated = false; bool isAirlineExistsInternal = true; if (CheckToken(token)) { if (!IsUserExists(airline)) { isAirlineExistsInternal = false; long addedAirlineId = _airlineDAO.Add(airline, airlineUserName, airlinePassword); AirlineCompany airlineForhecking = _airlineDAO.Get(addedAirlineId); isCreated = Statics.BulletprofComparsion(airline, airlineForhecking); } else { throw new UserAlreadyExistsException <AirlineCompany>(airline); } } isAirlineExists = isAirlineExistsInternal; return(isCreated); }
public bool ChangeMyPassword(LoginToken <AirlineCompany> token, string oldPassword, string newPassword, out bool isPasswordWrong) { bool isChanged = false; if (CheckToken(token)) { var utility_user = _utility_Class_UserDAO.GetUserByIdentifier(token.ActualUser); string utility_user_PASSWORD = string.Empty; if (utility_user.PASSWORD.Length > 50) { utility_user_PASSWORD = EncryptionProvider.Decryprt(utility_user.PASSWORD); } else { utility_user_PASSWORD = utility_user.PASSWORD; } if (utility_user_PASSWORD.Equals(oldPassword)) { _airlineDAO.Update(token.ActualUser, utility_user.USER_NAME, newPassword); } else { isPasswordWrong = true; //throw new WrongPasswordException(oldPassword); } var utility_userForChecking = _utility_Class_UserDAO.GetUserByIdentifier(token.ActualUser); if (utility_userForChecking.PASSWORD.Equals(newPassword)) { isChanged = true; } } isPasswordWrong = false; return(isChanged); }
public bool RemoveAirline(LoginToken <Administrator> token, AirlineCompany airline, out bool isAirlineExists) { bool isRemoved = false; bool IsExistsInternal = false; if (CheckToken(token)) { if (IsUserExists(airline)) { IsExistsInternal = true; _airlineDAO.Remove(airline); if (!IsUserExists(airline)) { isRemoved = true; } } else { throw new UserDoesntExistsException <AirlineCompany>(airline); } } isAirlineExists = IsExistsInternal; return(isRemoved); }