Ejemplo n.º 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (IsValidate())
            {
                if (edit)
                {
                    CheckStartDate();
                    CheckPaintDate();
                    PrepAndPaintModel edited = new PrepAndPaintModel()
                    {
                        Id          = editJob.Id,
                        StartDate   = startDate,
                        JobNumber   = txtJobNumber.Text,
                        Prepper     = txtPrepper.Text,
                        PaintDate   = paintDate,
                        Painter     = txtPainter.Text,
                        BodyOrDoors = cmboBodyDoors.Text,
                        Booth       = cmboBooth.Text,
                        Colour      = cmboColour.Text,
                        NewProcess  = checkNewProcess.Checked,
                        WashBay     = checkWashBay.Checked,
                        Comments    = txtComments.Text
                    };
                    PrepAndPaintDB.EditnewJob(edited);
                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    CheckStartDate();
                    CheckPaintDate();
                    PrepAndPaintModel newJob = new PrepAndPaintModel()
                    {
                        StartDate   = startDate,
                        JobNumber   = txtJobNumber.Text,
                        Prepper     = txtPrepper.Text,
                        PaintDate   = paintDate,
                        Painter     = txtPainter.Text,
                        BodyOrDoors = cmboBodyDoors.Text,
                        Booth       = cmboBooth.Text,
                        Colour      = cmboColour.Text,
                        NewProcess  = checkNewProcess.Checked,
                        WashBay     = checkWashBay.Checked,
                        Comments    = txtComments.Text
                    };

                    CheckIfExist(newJob);
                }
            }
        }