public ActionResult AutocompleteFor(Autocmplete model)
        {
            AutocompleteProperties auto = new AutocompleteProperties();

            auto.DataSource  = CarsList.GetCarList();
            auto.FilterType  = FilterOperatorType.Contains;
            ViewData["auto"] = auto;
            return(View(model));
        }
Example #2
0
 public Car(string makeModel, int price, int miles, string infoAboutCar)
 {
     MakeModel = makeModel;
     Price     = price;
     Miles     = miles;
     Info      = infoAboutCar;
     CarsList.Add(this);
     Id = CarsList.Count;
 }
Example #3
0
 public void AddCar(Car car) //Add car to parking
 {
     if (car != null && this.FreeSpace() > 0)
     {
         car.Payed           += AddIncome;
         car.TransactionMade += AddTransaction;
         PayTimer.Elapsed    += car.Pay;
         CarsList.Add(car);
     }
 }
Example #4
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(Instance.gameObject);
     }
 }
Example #5
0
        protected void SaveReferencesIds()
        {
            foreach (Order order in OrdersList)
            {
                order.CarId      = CarsList.First(c => order.Car == c).CarId;
                order.CustomerId = CustomersList.First(c => order.Customer == c).CustomerId;
            }

            foreach (Car car in CarsList)
            {
                car.CustomerId = CustomersList.First(c => car.Customer == c).CustomerId;
            }
        }
 public void AddCar(Car car)
 {
     if (car == null)
     {
         throw new ArgumentNullException(String.Format("Input '{0}' argumet was null!", nameof(car)));
     }
     if (!CarsList.Any(c => c.Id == car.Id))
     {
         CarsList.Add(car);
     }
     else
     {
         throw new ArgumentException(String.Format("The parking already contains a car with '{0}' description! Choose another one and try again!", car.Id));
     }
 }
        protected void butEdit_onClick123(object sender, EventArgs e)
        {
            //AdminHelper adminHelper = new AdminHelper();
            int id = int.Parse(((Button)sender).CommandName);

            //int id = int.Parse(hfCarID.Value);
            DAL.Car    car        = CarsList.Where(xx => xx.CarID == id).FirstOrDefault();
            JobWrapper jobWrapper = new JobWrapper();

            jobWrapper.JobDetailsObject.JobCompanyName = car.CompanyName;
            jobWrapper.JobDetailsObject.JobCarType     = car.CarName;
            jobWrapper.JobDetailsObject.JobBasePrise   = car.TotalPrice;
            jobWrapper.JobDetailsObject.CarID          = car.CarID;
            jobWrapper.JobDetailsObject.CompanyID      = car.CompanyID;
            Response.Redirect("~/Pages/CompleteReservation.aspx");
        }
Example #8
0
 public void RemoveCar(Car car) //Remove car from parking
 {
     if (car != null)
     {
         if (!car.IsDebtor())
         {
             PayTimer.Elapsed    -= car.Pay;
             car.Payed           -= AddIncome;
             car.TransactionMade -= AddTransaction;
             CarsList.Remove(car);
         }
         else
         {
             throw new ArithmeticException("This car is debtor, refill the balance to get car");
         }
     }
 }
 private void changeParkingState(object obj)
 {
     lock (transactionsList)
     {
         CarsList.ForEach(car =>
         {
             double requiredMoney;
             if (Settings.PriceSet.TryGetValue(car.CarType, out requiredMoney))
             {
                 double spentMoney = car.Balance >= requiredMoney ? requiredMoney : (car.Balance > 0 ? (requiredMoney - car.Balance) * Settings.Fine : requiredMoney * Settings.Fine);
                 car.Balance      -= spentMoney;
                 this.EarnedMoney += spentMoney;
                 Transaction tr    = new Transaction(car.Id, spentMoney);
                 transactionsList.Add(tr);
             }
         });
     }
 }
Example #10
0
        private void LoadReferences()
        {
            try
            {
                foreach (Order order in OrdersList)
                {
                    order.Customer = CustomersList.First(c => c.CustomerId == order.CustomerId);
                    order.Car      = CarsList.First(c => c.CarId == order.CarId);
                }

                foreach (Car car in CarsList)
                {
                    car.Customer = CustomersList.First(c => c.CustomerId == car.CustomerId);
                }
            }
            catch (InvalidOperationException e)
            {
                throw new FileCorruptedException("Скорее всего файл поврежден.", e);
            }
        }
        public void RemoveCar(Car car)
        {
            if (car == null)
            {
                throw new ArgumentNullException(String.Format("Input '{0}' argument was null!", nameof(car)));
            }

            if (CarsList.Any(c => c.Id == car.Id))
            {
                if (car.Balance > 0)
                {
                    CarsList.Remove(car);
                }
                else
                {
                    throw new InvalidOperationException("This car's balance is less than 0. Please, top up an account and try again!");
                }
            }
            else
            {
                throw new ArgumentException("There no such car on the parking!");
            }
        }
Example #12
0
 // GET: /AutocompleteDefault/
 public ActionResult Default()
 {
     ViewBag.datasource = CarsList.GetCarList();
     return(View());
 }
 public static void RemoveCar(int id)
 {
     CarsList.Remove(CarsList[id - 1]);
 }
Example #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.selectCar.DataSource = CarsList.GetCarList();
 }
Example #15
0
 public void AddCar(Car car)
 {
     CarsList.Add(car);
 }
Example #16
0
 public IEnumerable <Car> GetCars()
 {
     return(CarsList.AsEnumerable());
 }
 public static void ClearAll()
 {
     CarsList.Clear();
 }