private void BtnReservationRequest_Click(object sender, EventArgs e)
 {
     using (var CompanyService = new CompanyServiceSoapClient())
     {
         var cars = CompanyService.GetRentalRequests(CompanyID);
         dgwCarList.DataSource = cars;
         CompanyService.Close();
     }
 }
Example #2
0
 private void FrmReservationDetails_Load(object sender, EventArgs e)
 {
     using (var CompanyService = new CompanyServiceSoapClient())
     {
         var response = CompanyService.GetRentDetails(frmMain.Company.CompanyID);
         dgwRezervtions.DataSource = response;
         CompanyService.Close();
     }
 }
Example #3
0
        public CompanyClient(string sessionId)
        {
            _companyService = new CompanyServiceSoapClient(CompanyServiceSoapClient.EndpointConfiguration.CompanyServiceSoap);
            var cookies = new CookieContainer();

            cookies.Add(_companyService.Endpoint.Address.Uri, new Cookie(SessionCookieName, sessionId)
            {
                Domain = DomainName
            });
            _companyService.Endpoint.EndpointBehaviors.Add(new CookieBehavior(cookies));
        }
        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();
            }
        }
Example #5
0
 private void GetEmployees()
 {
     companyClient = new CompanyServiceSoapClient();
     var employees = companyClient.GetEmployees();
     employees.ForEach(x => cbCompany.Items.Add(x));
 }