Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsValid())
            {
                rentACarEntities.Inspections.Add(new Inspection()
                {
                    CarId          = (int)cbCar.SelectedValue,
                    Cat            = cbCat.Checked,
                    CustomerId     = (int)cbCar.SelectedValue,
                    Date           = DateTime.Now,
                    EmployeeId     = (int)cbEmployee.SelectedValue,
                    FuelQuantityId = (int)cbFuelQuantity.SelectedValue,
                    ResponseRubber = cbResponseRubber.Checked,
                    RubberStatus1  = (int)cbRubberStatus1.SelectedValue,
                    RubberStatus2  = (int)cbRubberStatus2.SelectedValue,
                    RubberStatus3  = (int)cbRubberStatus3.SelectedValue,
                    RubberStatus4  = (int)cbRubberStatus4.SelectedValue,
                    GlassBreak     = cbGlassBreak.Checked,
                    Scratches      = cbScratches.Checked,
                    Status         = true
                });

                rentACarEntities.SaveChanges();

                MessageBox.Show("La inspección fue creada correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                frmInspection frmInspection = new frmInspection();
                frmInspection.Show();
                Close();
            }
        }
Exemplo n.º 2
0
        private void inspecciónToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmInspection frmInspection = new frmInspection();

            frmInspection.Show();
            Hide();
        }
Exemplo n.º 3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsValid())
     {
         Inspection inspection = rentACarEntities.Inspections.Where(i => i.Id == Inspection.Id).FirstOrDefault();
         inspection.CarId          = (int)cbCar.SelectedValue;
         inspection.Cat            = cbCat.Checked;
         inspection.CustomerId     = (int)cbCustomer.SelectedValue;
         inspection.EmployeeId     = (int)cbEmployee.SelectedValue;
         inspection.FuelQuantityId = (int)cbFuelQuantity.SelectedValue;
         inspection.GlassBreak     = cbGlassBreak.Checked;
         inspection.ResponseRubber = cbResponseRubber.Checked;
         inspection.RubberStatus1  = (int)cbRubberStatus1.SelectedValue;
         inspection.RubberStatus2  = (int)cbRubberStatus2.SelectedValue;
         inspection.RubberStatus3  = (int)cbRubberStatus3.SelectedValue;
         inspection.RubberStatus4  = (int)cbRubberStatus4.SelectedValue;
         inspection.Scratches      = cbScratches.Checked;
         rentACarEntities.Entry(inspection).State = System.Data.Entity.EntityState.Modified;
         rentACarEntities.SaveChanges();
         MessageBox.Show("La inspección fue editada correctamente.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
         frmInspection frmInspection = new frmInspection();
         frmInspection.Show();
         Hide();
     }
 }