private void buttonAddNewCustomer_Click(object sender, EventArgs e)
        {
            string name        = textBoxAddName.Text;
            string firstName   = textBoxAddFirstName.Text;
            string address     = textBoxAddAddress.Text;
            string city        = textBoxAddCity.Text;
            string county      = textBoxAddCounty.Text;
            string phoneNumber = textBoxAddPhoneNumber.Text;
            string email       = textBoxAddEmail.Text;

            List <Auto> autos  = new List <Auto>();
            Client      client = new Client()
            {
                Nume       = name,
                Prenume    = firstName,
                Adresa     = address,
                Localitate = city,
                Judet      = county,
                Telefon    = phoneNumber,
                Email      = email,
                Automobile = autos
            };

            _carService.AddCustomer(client);

            labelAddCustomerDisplayInfo.Text = "Client added.";
            labelSearchDisplayInfo.Visible   = true;
        }
示例#2
0
        private void buttonAddNewCustomer_Click(object sender, EventArgs e)
        {
            string name        = textBoxAddName.Text;
            string firstName   = textBoxAddFirstName.Text;
            string address     = textBoxAddAddress.Text;
            string city        = textBoxAddCity.Text;
            string county      = textBoxAddCounty.Text;
            string phoneNumber = textBoxAddPhoneNumber.Text;
            string email       = textBoxAddEmail.Text;

            if (!FieldsCompleted(name, firstName, address, city, county, phoneNumber))
            {
                labelAddCustomerDisplayInfo.Text = @"Must complete mandatory fields.";
            }
            else
            {
                buttonAddNewCustomer.Enabled = true;
                List <Auto> cars   = new List <Auto>();
                Client      client = new Client()
                {
                    Nume       = name,
                    Prenume    = firstName,
                    Adresa     = address,
                    Localitate = city,
                    Judet      = county,
                    Telefon    = phoneNumber,
                    Email      = email,
                    Automobile = cars
                };

                _carService.AddCustomer(client);

                labelAddCustomerDisplayInfo.Text    = @"Client added.";
                labelAddCustomerDisplayInfo.Visible = true;
            }
        }
示例#3
0
 public void AddCustomer(Client client)
 {
     _api.AddCustomer(client);
 }