示例#1
0
        public List <Trainee> AllPassedByVehicle(TypeCar vehicle)//return all the trainees the passed test on a bus
        {
            var lst  = getTestsList().FindAll(x => x.TestTypeCar == vehicle);
            var lst1 = new List <int>();

            foreach (var item in lst)
            {
                if (item.Mark == Success.passed)
                {
                    lst1.Add(item.TraineeId);
                }
            }
            List <Trainee> VehicleTrainees = new List <Trainee>();
            Trainee        t;

            foreach (var item in lst1)
            {
                if (getTraineeList().Exists(x => x.ID == item))
                {
                    t = getTraineeList().Find(x => x.ID == item);
                    VehicleTrainees.Add(t);
                }
            }
            return(VehicleTrainees);
        }
示例#2
0
 public Trainee(DateTime my_LastTest, int my_id, string my_firstName, string my_lastName
                , Gender my_traineeGender, int my_phone, string my_street, string my_buildingNum, string my_city,
                DateTime my_traineeBirth, TypeCar my_traineeTypeCar, Gearbox my_traineeGearbox,
                School my_nameOFSchool, string my_nameOfTeacher, int my_numOfLessons, int my_numOfTests, string my_Password)
 {
     myPassword     = my_Password;
     id             = my_id;
     firstName      = my_firstName;
     lastName       = my_lastName;
     traineeGender  = my_traineeGender;
     phone          = my_phone;
     street         = my_street;
     buildingNum    = my_buildingNum;
     city           = my_city;
     traineeBirth   = my_traineeBirth;
     traineeTypeCar = my_traineeTypeCar;
     traineeGearbox = my_traineeGearbox;
     nameOFSchool   = my_nameOFSchool;
     nameOfTeacher  = my_nameOfTeacher;
     numOfLessons   = my_numOfLessons;
     numOfTests     = my_numOfTests;
     if (NumOfTests >= 1)
     {
         dateLastTest = my_LastTest;
     }
 }
示例#3
0
        bool Priority;   //זכות קדימה


        public Test(int my_idOftester, int my_idOfTrainee, bool my_signaling, int NumOfTest, string my_note,
                    bool my_parking, DateTime my_date, string my_street, string my_buildingNum, string my_city, Success my_mark,
                    bool my_mirror, bool my_priority, int my_timeOfTest, TypeCar my_testerTypeCar, Gearbox my_gearbox, Success my_passed, bool my_reverse)


        {
            NumOfTest     = ++BE.Configuration.TestNum;
            testerId      = my_idOftester;
            traineeId     = my_idOfTrainee;
            date          = my_date;
            TimeOfTest    = my_timeOfTest;
            street        = my_street;
            buildingNum   = my_buildingNum;
            city          = my_city;
            testetTypeCar = my_testerTypeCar;
            gearbox       = my_gearbox;
            mark          = my_mark;
            priority      = my_priority;
            mirror        = my_mirror;
            reverse       = my_reverse;
            parking       = my_parking;
            signaling     = my_signaling;
            note          = my_note;
            passed        = my_passed;
        }
示例#4
0
 public Car(ProducerNames producer, TypeCar type, double days, double price)
 {
     this.Producer           = producer;
     this.Type               = type;
     this.DaysToWaitDelivery = days;
     this.Price              = price;
 }
示例#5
0
        public async Task <ActionResult <TypeCar> > PostTypeCar(TypeCar typeCar)
        {
            _context.TypeCar.Add(typeCar);
            await _context.SaveChangesAsync();

            return(typeCar);
        }
示例#6
0
        public JsonResult Delete(int id)
        {
            TypeCar type = myService.GetById(id);

            myService.Delete(type);
            myService.Commit();
            return(Json("success", JsonRequestBehavior.AllowGet));
        }
示例#7
0
        public static MvcHtmlString EnumDisplayName(this HtmlHelper hpmlHelper, TypeCar typeCar)
        {
            var nameTypeCar = typeCar.GetType().GetMember(typeCar.ToString()).First().GetCustomAttributes <DisplayAttribute>();

            //var nameTypeCar = Enum.GetName(typeof (TypeCar), typeCar);

            return(new MvcHtmlString(nameTypeCar.First().Name));
        }
示例#8
0
        public ActionResult Delete(int id)
        {
            TypeCar typeCar = db.TypeCars.Find(id);

            db.TypeCars.Remove(typeCar);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#9
0
文件: Car.cs 项目: dem100288/WS2019
 public Car(TypeCar type)
 {
     Type       = type;
     fuel       = Type.FuelOfBuying;
     StatusInfo = new CarStatusInfo(this);
     //Position = Simulation.FindStationById(1).Point.Coordinate;
     Position             = Simulation.Stations.First().Point.Coordinate;
     Tools.OnChangeScale += Tools_OnChangeScale;
 }
示例#10
0
 public ActionResult Edit(TypeCar typeCar)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typeCar).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }
示例#11
0
 public Car(TypeCar typeCar, int seats, Engine engine, Transmission transmission,
            GPSNavigator gpsNavigator)
 {
     TypeCar      = typeCar;
     Seats        = seats;
     Engine       = engine;
     Transmission = transmission;
     GPSNavigator = gpsNavigator;
     Fuel         = 0;
 }
示例#12
0
        public ActionResult Create(TypeCar typeCar)
        {
            if (ModelState.IsValid)
            {
                db.TypeCars.Add(typeCar);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View());
        }
示例#13
0
 public ActionResult Create(TypeCar car, HttpPostedFileBase upload)
 {
     if (ModelState.IsValid)
     {
         car.Picture = MyHelper.UploadFile(upload, 3);
         myService.Add(car);
         myService.Commit();
         return(RedirectToAction("Index"));
     }
     return(View(car));
 }
示例#14
0
 public Car Load(VEHICULE data)
 {
     Id              = data.ID;
     TypeCar         = TypeCar.GetEnum <TypeCar>(data.ID_TYPE_VEHICULE);
     Color           = data.COULEUR;
     Immatriculation = data.PLAQUE_IMMATRICULATION;
     Marque          = data.MARQUE;
     Commentaire     = data.COMMENTAIRE;
     NbMaxPassager   = (int)data.NBRE_MAX_PASSAGER;
     return(this);
 }
示例#15
0
        public async Task <ActionResult <TypeCar> > PutTypeCar(long id, TypeCar typeCar)
        {
            if (id != typeCar.TypeCarId)
            {
                return(null);
            }
            _context.Entry(typeCar).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(typeCar);
        }
示例#16
0
        public async Task <IActionResult> AddTypeCar([Bind("NumberOfType,NameOfType")] TypeCar typecar)
        {
            if (ModelState.IsValid)
            {
                _context.Add(typecar);

                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(TypeCarList)));
            }
            return(View(typecar));
        }
        public ICar ProduceCar(TypeCar type)
        {
            switch (type)
            {
            case TypeCar.Truck:
                return(new RacingCar());

            case TypeCar.Racing:
                return(new RacingCar());

            default: return(new UnknownCar());
            }
        }
示例#18
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            TypeCar typeCar = db.TypeCars.Find(id);

            if (typeCar == null)
            {
                return(HttpNotFound());
            }
            return(View(typeCar));
        }
示例#19
0
        static Car FactoryCar(TypeCar typeCar)
        {
            switch (typeCar)
            {
            case TypeCar.ingles:
                return(new CarRightFactory().SetControl().SetMark("BMW").SetName("M4").Create());

                break;

            case TypeCar.latino:
                return(new CarLeftFactory().SetControl().SetMark("Ford").SetName("focus").Create());

                break;
            }
            return(default(Car));
        }
示例#20
0
        private void AddTypeCar()
        {
            TypeCar t1 = new TypeCar {
                Id = new Guid("61928868-1729-4a8c-918e-77462fa81cdb"), Name = "Легковой автомобиль", UrlForm = "GetCarViewModel"
            };
            TypeCar t2 = new TypeCar {
                Id = new Guid("c04b7a59-2ea5-456c-adcb-e21572170e74"), Name = "Автобус", UrlForm = "GetBusViewModel"
            };
            TypeCar t3 = new TypeCar {
                Id = new Guid("2e5cffb9-7dc3-43d7-b0ac-ffa52f8cd38f"), Name = "Грузовик", UrlForm = "GetTruckViewModel"
            };

            _db.TypeCars.AddRange(new List <TypeCar>()
            {
                t1, t2, t3
            });
        }
        public IActionResult Update(string id, [FromBody] TypeCar TypeCar)
        {
            var claims = User.Claims.Select(claim => new { claim.Type, claim.Value }).ToDictionary(t => t.Type, t => t.Value);

            if (claims.ContainsKey("name"))
            {
                if (claims["name"].Equals("ADMIN") || claims["name"].Equals("MANAGER"))
                {
                    return(Ok(_repository.Update(id, TypeCar)));
                }
            }
            else
            {
                return(Forbid());
            }
            return(Forbid());
        }
示例#22
0
        public ActionResult Edit(TypeCar car, HttpPostedFileBase upload)
        {
            TypeCar t = myService.GetById(car.TypeID);

            if (ModelState.IsValid)
            {
                string path = Path.Combine(Server.MapPath("~/Uploads"), upload.FileName);
                upload.SaveAs(path);
                car.Picture = upload.FileName;
                t.Name      = car.Name;
                t.Picture   = car.Picture;
                t.Active    = car.Active;
                t.Cars      = car.Cars;
                myService.Update(t);
                myService.Commit();
                return(RedirectToAction("Index"));
            }
            return(View(t));
        }
        public IActionResult Create([FromBody] TypeCar TypeCar)
        {
            var claims = User.Claims.Select(claim => new { claim.Type, claim.Value }).ToDictionary(t => t.Type, t => t.Value);

            if (claims.ContainsKey("name"))
            {
                if (claims["name"].Equals("ADMIN") || claims["name"].Equals("MANAGER"))
                {
                    TypeCar.Id       = Guid.NewGuid() + "";
                    TypeCar.IsDelete = false;
                    return(Ok(_repository.Create(TypeCar)));
                }
            }
            else
            {
                return(Forbid());
            }
            return(Forbid());
        }
示例#24
0
        public Order MakeNewOrder(Person persoana, TypeCar _carType)
        {
            Car      newCar    = this.SearchCarType(_carType);
            Customer newClient = new Customer(persoana, "0324123212");

            if (SearchCustomer(newClient) == false)
            {
                newClient.IdCustomer = this.GiveCustomerId();
                customersList.Add(newClient);
            }

            Order newOrder = new Order(newClient, newCar, DateTime.Now, this.DaysToDelivery);

            newOrder.IdOrder = GiveOrderId();
            Console.WriteLine("Comanda a fost inregistrata");
            Console.WriteLine(newOrder.ToString());
            Console.WriteLine(newCar.ToString());
            this.AddOrder(newOrder);
            return(newOrder);
        }
示例#25
0
        public Car SearchCarType(TypeCar _car)
        {
            Car car = new Car();

            foreach (var item in this.carOffers)
            {
                if (item.Type == _car)
                {
                    car.IdCar              = item.IdCar;
                    car.Price              = item.Price;
                    car.Producer           = item.Producer;
                    car.DaysToWaitDelivery = item.DaysToWaitDelivery;
                    break;
                }
                else
                {
                    Console.WriteLine("Masina nu a fost gasita");
                }
            }
            return(car);
        }
示例#26
0
        //   System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"C:/Users/ioshu/Downloads/last/PLWPF/music");
        public Tester(int my_id, string my_firstName, string my_lastName, Gender my_testerGender, int my_phone, string my_street, string my_buildingNum, string my_city,
                      DateTime my_testerBirth, TypeCar my_Car1, Gearbox my_testerGearbox,
                      int my_experience, int my_maxTests, double my_maxDis)
        {
            //player.Play();

            ID            = my_id;
            FirstName     = my_firstName;
            LastName      = my_lastName;
            TesterGender  = my_testerGender;
            Phone         = my_phone;
            Street        = my_street;
            Experience    = my_experience;
            MaxTests      = my_maxTests;
            BuildingNum   = my_buildingNum;
            City          = my_city;
            TesterBirth   = my_testerBirth;
            my_Car        = my_Car1;
            TesterGearBox = my_testerGearbox;
            MaxDis        = my_maxDis;
        }
        public static ICar ProduceCar(TypeCar type)
        {
            switch (type)
            {
            case TypeCar.Truck:
                return(new RacingCar());

            //return new RacingCar(engine: ...);
            //return new RacingCar(model: ..., engine: ...);



            case TypeCar.Racing:
                return(new ConcreteMixerCar());

            //return new ConcreteMixerCar()(engine: ...);
            //return new ConcreteMixerCar()(model: ..., engine: ...);



            default: return(new UnknownCar());
            }
        }
 public void SetType(TypeCar typeCar)
 {
     TypeCar = typeCar;
 }
示例#29
0
 public string[] ToRows()
 {
     string[] row = { FullName, TypeLicense.ToString(), ModelCar, TypeCar.ToString(), CarNumber.ToString(), CarDate.ToString() };
     return(row);
 }
示例#30
0
 public async Task <ActionResult <TypeCar> > PostTypeCar(TypeCar typeCar)
 {
     return(await _repository.PostTypeCar(typeCar));
 }