Пример #1
0
        public static void AddToNewsletter(Newsletter item)
        {
            List <int> ListIDs = new List <int>();

            ListIDs.Add(103435);
            string ClientUser     = "******";
            string ClientPassword = "******";

            try
            {
                CustomerServiceSoapClient client = new CustomerServiceSoapClient();
                AuthHeader authHeader            = new AuthHeader();
                authHeader.Username = ClientUser;
                authHeader.Password = ClientPassword;
                authHeader.Token    = client.Login(authHeader);


                WebCustomer customer = new WebCustomer();
                customer.Email     = item.NewsletterEmail;
                customer.FirstName = item.NewsletterName;
                customer.Phone1    = item.NewsletterPhone;

                APIResponse response = client.ImportCustomer(authHeader, customer, ListIDs.ToArray(), new int[0]);
            }
            catch (Exception ex)
            {
                SF.LogError(ex);
            }
        }
Пример #2
0
        public AracTakibi()
        {
            InitializeComponent();

            loginService    = new LoginServiceSoapClient();
            vehicleService  = new VehicleServiceServiceSoapClient();
            CustomerService = new CustomerServiceSoapClient();
            rentService     = new RentServiceSoapClient();
        }
        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();
            }
        }
Пример #4
0
        public MusteriIstekleri()
        {
            InitializeComponent();

            loginService    = new LoginServiceSoapClient();
            vehicleService  = new VehicleServiceServiceSoapClient();
            CustomerService = new CustomerServiceSoapClient();
            rentService     = new RentServiceSoapClient();

            List <VehicleInformation> vehicles = vehicleService.GetAll().ToList();
            List <RentServiceReference.Rentalinformation> rents = rentService.GetAll().ToList();

            List <Models.RentRequestViewModel> requests = new List <Models.RentRequestViewModel>(); //musteriistekleri icin
            List <Models.RentRequestViewModel> renteds  = new List <Models.RentRequestViewModel>(); //kiralanan araclaricin

            foreach (var rent in rents)
            { //customer get eklemis
                MusteriServiceReference.Customer           cust    = CustomerService.Get(rent.CustomerID);
                VehicleServiceReference.VehicleInformation vehicle = vehicleService.Get(rent.VehicleID);

                Models.RentRequestViewModel req = new Models.RentRequestViewModel();
                req.Id           = rent.Id;
                req.CustomerName = cust.Name + " " + cust.Surname;
                req.TCNumber     = cust.TCNumber;
                req.HowManyDays  = rent.HowManyDays;
                req.VehicleName  = vehicle.Name + " " + vehicle.Model;

                if (rent.IsActive)
                {
                    renteds.Add(req);
                }
                else
                {
                    requests.Add(req);
                }
            }


            dataGridMusteri.DataSource = (object)requests;
        }