Esempio n. 1
0
 // This method removes the customer with the provided customer ID from the CRM if they
 // are not currently renting a vehicle. It returns true if the removal was successful,
 // otherwise it returns false.
 public bool RemoveCustomer(int ID, Fleet fleet)
 {
     if (!(fleet.IsRenting(ID)))
     {
         CsvOperations.DeleteRecord("customers.csv", ID.ToString(), CrmFile, 0);
         return(true);
     }
     return(false);
 }
 // Removes the customer from the CRM if they are not currently renting a vehicle
 public bool RemoveCustomer(int customerID, Fleet fleet)
 {
     if (fleet.IsRenting(customerID) == false)
     {
         customers.Remove(GetCustomer(customerID));
         return(true);
     }
     else
     {
         return(false);
     }
 }
 // Removes the customer from the CRM if they are not currently renting a vehicle
 public bool RemoveCustomer(Customer customer, Fleet fleet)
 {
     if (fleet.IsRenting(customer.CustomerID) == false)
     {
         customers.Remove(customer);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Esempio n. 4
0
 public bool RemoveCustomer(int customerID, Fleet fleet)
 {
     if (fleet.IsRenting(customerID))
     {
         return(false);
     }
     else
     {
         var mykey = CustomersandCustID.FirstOrDefault(x => x.Value == customerID).Key;
         _customers.Remove(mykey);
         Customer._customerIDList.Remove(customerID);
         CustomersandCustID.Remove(mykey);
         return(true);
     }
 }
Esempio n. 5
0
        public bool RemoveCustomer(Customer customer, Fleet fleet)
        {
            //if customer is renting a car in a fleet, do not remove. else, remove customer
            var myvalue = CustomersandCustID.FirstOrDefault(x => x.Key == customer).Value;

            if (fleet.IsRenting(myvalue))
            {
                return(false);
            }
            else
            {
                _customers.Remove(customer);
                Customer._customerIDList.Remove(myvalue);
                CustomersandCustID.Remove(customer);
                return(true);
            }
        }
Esempio n. 6
0
        //This method removes the customer from the CRM if they are not currently renting a
        //vehicle.It returns true if the removal was successful, otherwise it returns false. Remove based on customer ID.

        public bool RemoveCustomer(int customerID, Fleet fleet)
        {
            if (fleet.IsRenting(customerID))
            {
                return(false);
            }
            else
            {
                foreach (var item in customersCollection.ToList())
                {
                    if (item.CustomerID == customerID)
                    {
                        customersCollection.Remove(item);
                    }
                }
                return(true);
            }
        }
Esempio n. 7
0
        public bool RemoveCustomer(Customer customer, Fleet fleet)
        {
            bool exists = false;

            if (!fleet.IsRenting(customer.ID))
            {
                foreach (Customer cust in customers)
                {
                    if (customer.ID == cust.ID)
                    {
                        exists = true;
                    }
                }
                if (exists)
                {
                    customers.Remove(customer);
                    saveToFile();
                    return(true);
                }
            }
            return(false);
        }