示例#1
0
        public bool UpdateFlight(LoginToken <AirlineCompany> token, Flight flight, out bool isFound)
        {
            bool isFoundInternal = true;
            bool isUpdated       = false;

            if (CheckToken(token))
            {
                List <long> allFlightsIDs = _flightDAO.GetAll().Select(x => x.ID).ToList();
                if (!allFlightsIDs.Contains(flight.ID))
                {
                    isFoundInternal = false;
                }

                if (isFoundInternal)
                {
                    _flightDAO.Update(flight);
                    Flight flightForChecking = _flightDAO.Get(flight.ID);
                    isUpdated = Statics.BulletprofComparsion(flight, flightForChecking);
                }
            }
            else
            {
                throw new UserDoesntExistsException <AirlineCompany>(token.ActualUser);
            }

            isFound = isFoundInternal;
            return(isUpdated);
        }
示例#2
0
        public bool UpdateBlackUser(FailedLoginAttempt blackUser)
        {
            _failedLoginAttemptsDAO.Update(blackUser);

            FailedLoginAttempt blackUserForChecking = _failedLoginAttemptsDAO.Get(blackUser.ID);
            bool isUpdated = Statics.BulletprofComparsion(blackUserForChecking, blackUser);

            return(isUpdated);
        }
示例#3
0
        public bool MofidyAirlineDetails(LoginToken <AirlineCompany> token, AirlineCompany airline)
        {
            bool isUpdated = false;

            if (CheckToken(token))
            {
                _airlineDAO.Update(airline);
                AirlineCompany airlineForChecking = _airlineDAO.Get(airline.ID);
                isUpdated = Statics.BulletprofComparsion(airlineForChecking, airline);
            }
            else
            {
                throw new UserDoesntExistsException <AirlineCompany>(token.ActualUser);
            }
            return(isUpdated);
        }
示例#4
0
        public bool CreateFlight(LoginToken <AirlineCompany> token, Flight flight)
        {
            bool isAddded = false;

            if (CheckToken(token))
            {
                long   flightId          = _flightDAO.Add(flight);
                Flight flightForChecking = _flightDAO.Get(flightId);
                isAddded = Statics.BulletprofComparsion(flight, flightForChecking);
                if (!isAddded)
                {
                    _flightDAO.Remove(flightForChecking);
                }
            }
            else
            {
                throw new UserDoesntExistsException <AirlineCompany>(token.ActualUser);
            }

            return(isAddded);
        }
        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);
        }