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; }
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); }
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); }
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; }
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; } }
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("Заполните обязательные поля!"); } }
public void deactivateTruck(int truckID, string active) { Trucks t = new Trucks(); t.TruckID = truckID; t.deactivateTruck(active); }
/// <summary> /// Очистка данных. /// </summary> public void Clear() { Trucks.Clear(); Semitrailers.Clear(); Drivers.Clear(); Staff.Clear(); Routes.Clear(); }
public ActionResult DeleteConfirmed(int id) { Trucks trucks = db.trucks.Find(id); db.trucks.Remove(trucks); db.SaveChanges(); return(RedirectToAction("Index")); }
public string getTrucks(bool active) { JavaScriptSerializer j = new JavaScriptSerializer(); Trucks t = new Trucks(); List <Trucks> trucksList = t.getTrucksList(active); return(j.Serialize(trucksList)); }
public void ShrinkTruks() => Trucks = Trucks .OrderByDescending(t => t.Locals.Any()) .ThenBy(t => t.Id) .Select((t, i) => new Truck(t.Locals) { Id = i }) .ToList();
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)); }
public string getTruck(int truckID) { JavaScriptSerializer j = new JavaScriptSerializer(); Trucks t = new Trucks(); t.TruckID = truckID; Trucks truck = t.getTruck(); return(j.Serialize(truck)); }
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)); }
/// <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)); }
//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; }
public void InsertTest() { var truck = new Trucks { Chassis = "ABC123", MaximumLoad = 3000, ModelId = 1 }; _controller.New(truck); Assert.Pass(); }
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"); } }
//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; }
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; }
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); } }
public IActionResult Edit(Trucks truck) { Validation(truck); if (ModelState.IsValid) { _context.Entry(truck).State = EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(truck)); }
public IActionResult New(Trucks truck) { Validation(truck); if (ModelState.IsValid) { _context.Trucks.Add(truck); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(truck)); }
// 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)); }
// 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)); }
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; }
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(); } }
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); }); }
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; }
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)); }
/// <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); }