//overloaded constructor. in this case the admin add a services public AdminServiceEdit(string Email, string PassHash, string CarPlate) { InitializeComponent(); this.Email = Email; this.PassHash = PassHash; this.ServicedCar = new Service.Car(); this.newService = true; TotalUpDown.Value = 0; KilometersUpDown.Value = 0; DeleteButton.Visible = false; try { CarManagerClient carManager = new CarManagerClient(); Car.Car FetchedCar = carManager.GetCarByPlate(CarPlate, this.Email, this.PassHash); ServicedCar.PlateNumber = FetchedCar.PlateNumber; ServicedCar.Make = FetchedCar.Make; ServicedCar.Model = FetchedCar.Model; ServicedCar.Year = FetchedCar.Year; ServicedCar.Kilometers = FetchedCar.Kilometers; ServicedCar.BurnedLiters = FetchedCar.BurnedLiters; this.serviceManager = new ServiceManagerClient(); } catch (Exception exc) { MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco.", MessageBoxButtons.OK); } }
//constructor public AdminServiceEdit(string Email, string PassHash, Service.Service service) { InitializeComponent(); this.Email = Email; this.PassHash = PassHash; this.service = service; this.ServicedCar = service.ServicedCar; this.newService = false; TotalUpDown.Value = Convert.ToDecimal(service.TotalSpent); KilometersUpDown.Value = service.Kilometers; try { this.serviceManager = new ServiceManagerClient(); }catch (Exception exc) { MessageBox.Show("Errore nella connessione al server.", "Proprio non riesco.", MessageBoxButtons.OK); } }