Exemplo n.º 1
0
        private void btn_startParking_Click(object sender, EventArgs e)
        {
            if (isValidParking() == false)
            {
                return;
            }

            parking.Plate           = tbx_plate.Text.Trim();
            parking.VehicleModel    = Convert.ToInt32(cbx_models.SelectedValue);
            parking.VehicleCategory = Convert.ToInt32(cbx_categories.SelectedValue);
            parking.VehicleColor    = Convert.ToInt32(cbx_colors.SelectedValue);
            parking.StartedAt       = DateTime.Now;
            parking.Status          = "Em Aberto";

            bool completed = parking.InsertParking(parking);

            if (completed)
            {
                var category = vehicleCategory.LoadCategoryById(parking.VehicleCategory).Category;
                var color    = vehicleColor.LoadColorById(parking.VehicleColor).Color;
                var model    = vehicleModel.LoadVehicleModelById(parking.VehicleModel).Model;
                printerControl.PrintStartParking(parking, category, color, model);
                ClearStartParkingForm();

                MessageBox.Show("Operação concluída, imprimindo recibo");
            }
            else
            {
                MessageBox.Show("ERRO: Problema ao executar operação no banco de dados");
            }
        }