Exemplo n.º 1
0
        private void buttonAddService_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBoxServicePrice.Text) || string.IsNullOrWhiteSpace(textBoxServiceName.Text))
            {
                return;
            }

            int price;

            int.TryParse(textBoxServicePrice.Text, out price);

            Service serv = new Service
            {
                Name  = textBoxServiceName.Text,
                Price = price
            };

            data.addData(serv);
            this.Dispose();
        }
Exemplo n.º 2
0
        private void buttonAddNewCar_Click_1(object sender, EventArgs e)
        {
            listBoxClients.ValueMember = "Id";
            data.PopulateListBoxArrivedCars(listBoxArrivedCars);

            if (string.IsNullOrWhiteSpace(textBoxCarEngine.Text) || string.IsNullOrWhiteSpace(textBoxCarMake.Text) ||
                string.IsNullOrWhiteSpace(textBoxCarModel.Text) || string.IsNullOrWhiteSpace(textBoxCarPlate.Text) ||
                string.IsNullOrWhiteSpace(textBoxCarRun.Text) || string.IsNullOrWhiteSpace(textBoxCarVIN.Text) ||
                string.IsNullOrWhiteSpace(textBoxCarYear.Text) || listBoxClients.SelectedValue == null)
            {
                return;
            }

            int run, year;

            int.TryParse(textBoxCarRun.Text, out run);
            int.TryParse(textBoxCarYear.Text, out year);

            Car car = new Car
            {
                Engine      = textBoxCarEngine.Text,
                Make        = textBoxCarMake.Text,
                Model       = textBoxCarModel.Text,
                NumberPlate = textBoxCarPlate.Text,
                Run         = run,
                VIN         = textBoxCarVIN.Text,
                Year        = year,
                Client_Id   = (int)(listBoxClients.SelectedValue),
                Arrived     = true
            };

            data.addData(car);
            data.PopulateListBoxArrivedCars(listBoxArrivedCars);
            textBoxCarEngine.Text = "";
            textBoxCarMake.Text   = "";
            textBoxCarModel.Text  = "";
            textBoxCarPlate.Text  = "";
            textBoxCarRun.Text    = "";
            textBoxCarVIN.Text    = "";
            textBoxCarYear.Text   = "";
        }