private void FrmNewReservation_Load(object sender, EventArgs e) { using (var CarService = new CarServiceSoapClient()) { var cars = CarService.GetCars(frmMain.Company.CompanyID); dgwCarList.DataSource = cars; CarService.Close(); } }
private void TpDateLast_ValueChanged(object sender, EventArgs e) { using (var CarService = new CarServiceSoapClient()) { var cars = CarService.GetAvailableCarByCompanyID(tpDateFirst.Value, tpDateLast.Value, CompanyID); dgwCarList.DataSource = cars; CarService.Close(); } }
private void FrmUpdateCar_Load(object sender, EventArgs e) { using (var CarService = new CarServiceSoapClient()) { var cars = CarService.GetCars(frmMain.Company.CompanyID);//login olan şirketin id si dgwCars.DataSource = cars; CarService.Close(); } }
private void frmDeleteCar_Load(object sender, EventArgs e) { using (var carClient = new CarServiceSoapClient()) { var cars = carClient.GetCars(frmMain.Company.CompanyID); dgwCarList.DataSource = cars; carClient.Close(); } }
private void btnDeleteCar_Click(object sender, EventArgs e) { using (var carClient = new CarServiceSoapClient()) { int x = int.Parse(dgwCarList.SelectedRows[0].Cells[0].Value.ToString()); carClient.DeleteCar(x); MessageBox.Show("Car Deleted"); } }
private void BtnDoReservations_Click(object sender, EventArgs e) { RentDetailsRequestDto NewRent = new RentDetailsRequestDto { Pricing = decimal.Parse(txtAmount.Text), CarID = int.Parse(txtCarId.Text), CustomerID = int.Parse(txtCustomerId.Text), RentStartDate = tpDateFirst.Value, RentEndDate = tpDateLast.Value, StartingKilometer = int.Parse(txtFirsrKM.Text) }; using (var companyService = new CompanyServiceSoapClient()) { double NetAge = 0; int minAge = 1; using (var CarService = new CarServiceSoapClient()) { using (var CustomerService = new CustomerServiceSoapClient()) { foreach (var item in CustomerService.GetAllCustomer()) { if (int.Parse(txtCustomerId.Text) == item.CustomerId) { TimeSpan CustomerAge = System.DateTime.Now - item.CustomerBirthdate; NetAge = Math.Ceiling(CustomerAge.TotalDays / 365); minAge = CarService.GetCar(int.Parse(txtCarId.Text)).MinCustomerAge; } } } } if (minAge <= NetAge) { companyService.CreateRent(NewRent); } else { MessageBox.Show("Yaşınız Bu Aracı Kiralamaya Uygun Değil"); } companyService.Close(); } }
private void BtnUpdateCar_Click(object sender, EventArgs e) { using (var CarService = new CarServiceSoapClient()) { CarRequestDto UpdatedCar = new CarRequestDto { CarBrand = txtBrand.Text, CarKM = int.Parse(txtCarKm.Text), AirBagCount = byte.Parse(txtAirbagCount.Text), CarModel = txtModel.Text, CarPhotoURL = txtPhotoUrl.Text, CarPriceForRent = decimal.Parse(txtRentPrice.Text), CarSeatCount = byte.Parse(txtSeatCount.Text), MinCustomerAge = byte.Parse(txtMinCustomerAge.Text), MinDrivingLicenseAge = byte.Parse(txtMinLicenceAge.Text), MaxKmPerDay = int.Parse(txtMaxKm.Text), CarTrunkVolume = short.Parse(txtTrunkVolume.Text) }; CarService.UpdateCar(UpdatedCar, int.Parse(txtCarId.Text)); CarService.Close(); } }