Ejemplo n.º 1
0
        async void  ExecuteLoadTrucksCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            try
            {
                Trucks.Clear();
                var trucks = await TruckStore.GetTrucksAsync(true);

                Trucks.ReplaceRange(trucks);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessagingCenter.Send(new MessagingCenterAlert
                {
                    Title   = "Error",
                    Message = "Unable to load Trucks.",
                    Cancel  = "OK"
                }, "message");
            }
            IsBusy = false;
        }
Ejemplo n.º 2
0
    public void setTruck(int truckID, int truckLicense, string manufacturer, string model, string kmToDate, string hand, float purchaseCost, string purchaseYear, int truckTypeID, string urea, string onRoadDate, string insuranceExpiredDate, string func)
    {
        DateTime dOnRoad;

        if (onRoadDate.Contains("."))
        {
            dOnRoad = DateTime.Parse(onRoadDate);
        }
        else
        {
            dOnRoad = DateTime.ParseExact(onRoadDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
        }

        DateTime dInsurance;

        if (insuranceExpiredDate.Contains("."))
        {
            dInsurance = DateTime.Parse(insuranceExpiredDate);
        }
        else
        {
            dInsurance = DateTime.ParseExact(insuranceExpiredDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
        }

        Trucks t = new Trucks(truckID, truckLicense, manufacturer, model, kmToDate, hand, purchaseCost, purchaseYear, new TruckTypes(truckTypeID, ""), urea, dOnRoad, dInsurance);

        t.setTruck(func);
    }
Ejemplo n.º 3
0
    public Trucks getTruck()
    {
        #region DB functions
        string query = "select * from Trucks t inner join TruckTypes tp on t.TruckTypeID = tp.TruckTypeID where TruckID =" + TruckID + "";

        Trucks    t  = new Trucks();
        DbService db = new DbService();
        DataSet   ds = db.GetDataSetByQuery(query);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            t.TruckID              = (int)dr["TruckID"];
            t.TruckLicense         = (int)dr["TruckLicense"];
            t.Manufacturer         = dr["Manufacturer"].ToString();
            t.Model                = dr["Model"].ToString();
            t.Active               = dr["Active"].ToString();
            t.OnRoadDate           = (DateTime)dr["OnRoadDate"];
            t.InsuranceExpiredDate = (DateTime)dr["InsuranceExpiredDate"];
            t.KMToDate             = dr["KMToDate"].ToString();
            t.Hand         = dr["Hand"].ToString();
            t.PurchaseCost = float.Parse(dr["PurchaseCost"].ToString());
            t.PurchaseYear = dr["PurchaseYear"].ToString();
            t.TruckType    = new TruckTypes((int)dr["TruckTypeID"], dr["TruckType"].ToString());
            t.Urea         = dr["Urea"].ToString();
        }
        #endregion

        return(t);
    }
Ejemplo n.º 4
0
        public ChangeCarForm(Clients client, ListBox carListBox = null, ListBox truckListBox = null, Cars car = null, Trucks truck = null)
        {
            InitializeComponent();
            Client = client;

            if (car != null)
            {
                Car        = car;
                CarListBox = carListBox;
            }
            else
            {
                Truck        = truck;
                TruckListBox = truckListBox;
            }

            if (Car != null)
            {
                Vechile = Car;
            }
            else
            {
                Vechile = Truck;
            }

            manufactureDateTimePicker.MaxDate = DateTime.Today;

            carModelTextBox.Text            = Vechile.Model;
            vinTextBox.Text                 = Vechile.VIN;
            engineVolume.Text               = Vechile.EngineVolume.ToString();
            manufactureDateTimePicker.Value = Vechile.ManufactureYear;
        }
Ejemplo n.º 5
0
        public void AddTruckAndFillWithDetails(eTypeOfVeichle i_TypeOfVeichile, string i_LicenceID, string i_VehicleModel, float i_EngineCurrentEnergy, List <Tire> i_Tires, bool i_IsDangarus, float i_TruckCapacity)
        {
            switch (i_TypeOfVeichile)
            {
            case eTypeOfVeichle.Truck:
                if (Vehicles == null)
                {
                    Vehicles = new List <Vehicle>();
                }

                if (Trucks == null)
                {
                    Trucks = new List <Truck>();
                }

                Truck truck = VeichileFactory.CreateTruck(i_TypeOfVeichile);
                truck.LicenceID            = i_LicenceID;
                truck.Model                = i_VehicleModel;
                truck.Engine.CurrentEnergy = i_EngineCurrentEnergy;
                truck.Tires                = i_Tires;
                truck.IsHazardous          = i_IsDangarus;
                truck.TruckCapacity        = i_TruckCapacity;
                Trucks.Add(truck);
                Vehicles.Add(truck);
                break;
            }
        }
Ejemplo n.º 6
0
        private void AddingNewTruck(string name, string model, string vin, string engineVol, DateTime manYear)
        {
            double engineVolume = 0;

            if (engineVol != "")
            {
                engineVolume = ParseToDouble(engineVol);
            }
            if (model != "" && vin != "" && engineVolume != 0)
            {
                Truck.Name            = TruckName(name);
                Truck.Model           = model;
                Truck.VIN             = vin;
                Truck.EngineVolume    = engineVolume;
                Truck.ManufactureYear = manYear;
                Truck.DefectsDescription.Add(defectTextBox.Text);

                Trucks.Add(Truck);
                TrucksListBox.DataSource = null;
                TrucksListBox.DataSource = Trucks;
                this.Close();
            }
            else
            {
                MessageBox.Show("Заполните обязательные поля!");
            }
        }
Ejemplo n.º 7
0
    public void deactivateTruck(int truckID, string active)
    {
        Trucks t = new Trucks();

        t.TruckID = truckID;
        t.deactivateTruck(active);
    }
Ejemplo n.º 8
0
 /// <summary>
 /// Очистка данных.
 /// </summary>
 public void Clear()
 {
     Trucks.Clear();
     Semitrailers.Clear();
     Drivers.Clear();
     Staff.Clear();
     Routes.Clear();
 }
Ejemplo n.º 9
0
        public ActionResult DeleteConfirmed(int id)
        {
            Trucks trucks = db.trucks.Find(id);

            db.trucks.Remove(trucks);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 10
0
    public string getTrucks(bool active)
    {
        JavaScriptSerializer j   = new JavaScriptSerializer();
        Trucks        t          = new Trucks();
        List <Trucks> trucksList = t.getTrucksList(active);

        return(j.Serialize(trucksList));
    }
Ejemplo n.º 11
0
 public void ShrinkTruks() =>
 Trucks = Trucks
          .OrderByDescending(t => t.Locals.Any())
          .ThenBy(t => t.Id)
          .Select((t, i) => new Truck(t.Locals)
 {
     Id = i
 })
          .ToList();
Ejemplo n.º 12
0
 public ActionResult Edit([Bind(Include = "TrucksKey,RegistrationNo,TruckStatus,TruckPrice")] Trucks trucks)
 {
     if (ModelState.IsValid)
     {
         db.Entry(trucks).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(trucks));
 }
Ejemplo n.º 13
0
    public string getTruck(int truckID)
    {
        JavaScriptSerializer j = new JavaScriptSerializer();
        Trucks t = new Trucks();

        t.TruckID = truckID;
        Trucks truck = t.getTruck();

        return(j.Serialize(truck));
    }
Ejemplo n.º 14
0
    public string getAvailableTrucks(string chosenDate)
    {
        DateTime selecetdDate = DateTime.ParseExact(chosenDate, "dd/MM/yyyy", null);

        JavaScriptSerializer j   = new JavaScriptSerializer();
        Trucks        t          = new Trucks();
        List <Trucks> trucksList = t.getAvailableTrucksList(selecetdDate);

        return(j.Serialize(trucksList));
    }
Ejemplo n.º 15
0
        /// <summary>
        /// Creates the specified trucks against the specified Fleet.
        /// </summary>
        /// <param name="fleetId">The Fleet IdC</param>
        /// <param name="trucks">The trucks to create</param>
        /// <param name="isCmac">Indicates that the fleetId is a CMAC</param>
        /// <returns>The created devices</returns>
        public Trucks CreateFleetTrucks(string fleetId, Trucks trucks, bool isCmac)
        {
            if (trucks == null || trucks.Count == 0)
            {
                throw new ArgumentException("Trucks collection was null or empty");
            }
            var resource   = string.Format("Fleets/{0}/Trucks", fleetId);
            var callParams = string.Format("iscmac={0}", isCmac);

            return(Trucks.FromString(CallWithRetry(resource, "POST", false, trucks, callParams), _interfaceFormat));
        }
Ejemplo n.º 16
0
 //without active
 public TruckHandlings(int truckHandlingID, string truckHandlingDescription, string handlingProvider, string url, float cost, DateTime date, TruckHandlingTypes truckHandlingType, Trucks truck)
 {
     TruckHandlingID          = truckHandlingID;
     TruckHandlingDescription = truckHandlingDescription;
     HandlingProvider         = handlingProvider;
     Url  = url;
     Cost = cost;
     Date = date;
     TruckHandlingType = truckHandlingType;
     Truck             = truck;
 }
Ejemplo n.º 17
0
        public void InsertTest()
        {
            var truck = new Trucks
            {
                Chassis     = "ABC123",
                MaximumLoad = 3000,
                ModelId     = 1
            };

            _controller.New(truck);
            Assert.Pass();
        }
Ejemplo n.º 18
0
        private void Validation(Trucks truck)
        {
            if (string.IsNullOrEmpty(truck.Chassis))
            {
                ModelState.AddModelError("Chassis", "Please provide a valid chassis");
            }

            if (truck.MaximumLoad <= 0)
            {
                ModelState.AddModelError("MaximumLoad", "Please provide a valid weight");
            }
        }
Ejemplo n.º 19
0
 //without active
 public TruckHandlings(int truckHandlingID, string truckHandlingDescription, string handlingProvider, float cost, DateTime date, TruckHandlingTypes truckHandlingType, Trucks truck, int imgID)
 {
     TruckHandlingID          = truckHandlingID;
     TruckHandlingDescription = truckHandlingDescription;
     HandlingProvider         = handlingProvider;
     Active            = active;
     Cost              = cost;
     Date              = date;
     TruckHandlingType = truckHandlingType;
     Truck             = truck;
     ImgID             = imgID;
 }
Ejemplo n.º 20
0
 public async Task<Trucks> GetPostedTruckDetailsById(int TruckID)
 {
     Trucks PostedTruck = null;
     try
     {
         PostedTruck = await _TruckDA.GetPostedTruckDetailsById(TruckID);
     }
     catch (Exception ex)
     {
         //logging.ExceptionLog(ex.Message.ToString(), SystemInfo.IP(), MethodInfo.GetCurrentMethod().ToString(), SystemInfo.Url());
     }
     return PostedTruck;
 }
Ejemplo n.º 21
0
 void AddTruck(TruckData td)
 {
     if (!Trucks.Contains(td))
     {
         Trucks.Add(td);
     }
     else
     {
         var tcnt = truckData.Where(m => m.ManifestId == td.ManifestId).FirstOrDefault();
         Trucks.Remove(tcnt);
         Trucks.Add(td);
     }
 }
Ejemplo n.º 22
0
        public IActionResult Edit(Trucks truck)
        {
            Validation(truck);

            if (ModelState.IsValid)
            {
                _context.Entry(truck).State = EntityState.Modified;
                _context.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(truck));
        }
Ejemplo n.º 23
0
        public IActionResult New(Trucks truck)
        {
            Validation(truck);

            if (ModelState.IsValid)
            {
                _context.Trucks.Add(truck);
                _context.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(truck));
        }
Ejemplo n.º 24
0
        // GET: Trucks/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Trucks trucks = db.trucks.Find(id);

            if (trucks == null)
            {
                return(HttpNotFound());
            }
            return(View(trucks));
        }
Ejemplo n.º 25
0
        // GET: Trucks/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Trucks trucks = db.Trucks.Find(id);

            if (trucks == null)
            {
                return(HttpNotFound());
            }
            PopulateCustomersDropDownList(trucks.CustomerID);

            return(View(trucks));
        }
Ejemplo n.º 26
0
 public TrucksMonthlySummary()
 {
     Truck = new Trucks();
     Jan   = 0;
     Feb   = 0;
     Mar   = 0;
     Apr   = 0;
     May   = 0;
     Jun   = 0;
     Jul   = 0;
     Aug   = 0;
     Sep   = 0;
     Oct   = 0;
     Nov   = 0;
     Dec   = 0;
     Total = 0;
 }
Ejemplo n.º 27
0
        internal static void AddVeh(object Item, string SType)
        {
            using (var db = new DatabaseContext())
            {
                switch (SType)
                {
                case "APCs":
                    APCs tempA = new APCs();
                    foreach (PropertyInfo x in Item.GetType().GetProperties())
                    {
                        x.SetValue(tempA, x.GetValue(Item));
                    }
                    db.Vehicles.Add(tempA);
                    break;

                case "IFVs":
                    IFVs tempI = new IFVs();
                    foreach (PropertyInfo x in Item.GetType().GetProperties())
                    {
                        x.SetValue(tempI, x.GetValue(Item));
                    }
                    db.Vehicles.Add(tempI);
                    break;

                case "Tanks":
                    Tanks tempTa = new Tanks();
                    foreach (PropertyInfo x in Item.GetType().GetProperties())
                    {
                        x.SetValue(tempTa, x.GetValue(Item));
                    }
                    db.Vehicles.Add(tempTa);
                    break;

                case "Trucks":
                    Trucks tempTr = new Trucks();
                    foreach (PropertyInfo x in Item.GetType().GetProperties())
                    {
                        x.SetValue(tempTr, x.GetValue(Item));
                    }
                    db.Vehicles.Add(tempTr);
                    break;
                }
                db.SaveChanges();
            }
        }
Ejemplo n.º 28
0
        private void GuiUpdate(string obj)                   //MEthode wird asugeführt wenn der clienthandler was empfängt
        {
            obj = "W-15b@Wien@Ladung1@10@4@Ladung2@30@1000"; //kann selbst gestaltet wrden
            String[] unformated = obj.Split('@');

            var loads = new ObservableCollection <LoadVm>();

            for (int i = 2; i < unformated.Length; i = i + 3)
            {
                loads.Add(new LoadVm(unformated[i], int.Parse(unformated[i + 1]), int.Parse(unformated[i + 2]))); //loads auslesen mit schleife weil mehrer loads pro truck
            }
            TruckVm newTruck = new TruckVm(unformated[0], unformated[1], loads);                                  //neuen truck fühlen mit den elementen aus obj

            App.Current.Dispatcher.Invoke(() =>                                                                   // lanbda expressions - braucht ma weil mehrer threads die in die gui "eingreifen" - "syncht die threads und seralsierts"
            {
                Trucks.Add(newTruck);
            });
        }
Ejemplo n.º 29
0
 public Drivers(int driverID, string driverNumber, string firstName, string lastName, string phone, string email, string accountID, string appPassword, DateTime dateOfBirth, DateTime driverLicenseExpiredDate, DateTime driverCertificationExpiredDate, City cityLiving, DriverLicenseTypes licenseType, DriverLicenseTypes certificationType, Trucks driverTruck)
 {
     DriverID                       = driverID;
     DriverNumber                   = driverNumber;
     FirstName                      = firstName;
     LastName                       = lastName;
     Phone                          = phone;
     Email                          = email;
     AccountID                      = accountID;
     AppPassword                    = appPassword;
     CityLiving                     = cityLiving;
     LicenseType                    = licenseType;
     CertificationType              = certificationType;
     DriverTruck                    = driverTruck;
     DateOfBirth                    = dateOfBirth;
     DriverLicenseExpiredDate       = driverLicenseExpiredDate;
     DriverCertificationExpiredDate = driverCertificationExpiredDate;
 }
Ejemplo n.º 30
0
        public ActionResult Create([Bind(Include = "TrucksKey,RegistrationNo,TruckStatus,TruckPrice")] Trucks trucks)
        {
            if (ModelState.IsValid)
            {
                if (trucks.TruckRegChecker() == true)
                {
                    ViewBag.message = "The Truck has already Exist!!!";
                    return(View(trucks));
                }
                else
                {
                    db.trucks.Add(trucks);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            return(View(trucks));
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Creates the specified trucks against the specified Fleet.
 /// </summary>
 /// <param name="fleetId">The Fleet IdC</param>
 /// <param name="trucks">The trucks to create</param>
 /// <param name="isCmac">Indicates that the fleetId is a CMAC</param>
 /// <returns>The created devices</returns>
 public Trucks CreateFleetTrucks(string fleetId, Trucks trucks, bool isCmac)
 {
     if (trucks == null || trucks.Count == 0)
         throw new ArgumentException("Trucks collection was null or empty");
     var resource = string.Format("Fleets/{0}/Trucks", fleetId);
     var callParams = string.Format("iscmac={0}", isCmac);
     return Trucks.FromString(CallWithRetry(resource, "POST", false, trucks, callParams), _interfaceFormat);
 }