/*********************** Events **************************************************************************/ private void saveDeviation_Click(object sender, EventArgs e) { FormValidation formValidation = new FormValidation(); bool requestedBy = formValidation.isTextBoxNotNull(this.requestedBy, errorProvider1); bool position = formValidation.isTextBoxNotNull(this.position, errorProvider1); bool standardCondition = formValidation.isTextBoxNotNull(this.standardCondition, errorProvider1); bool detailRequestedDevV = formValidation.isTextBoxNotNull(this.detailRequestedDeviation, errorProvider1); bool deviationType = formValidation.isItemFromComoBoxSelected(this.deviationType, errorProvider1); int compareDeviationPeriod = this.validateDeviationPeriod(); bool deviationTypeDescription = true; if (this.deviationType.SelectedItem.ToString() == "Sonstiges") { if (this.deviationDescription.Text == "") { deviationTypeDescription = formValidation.isTextBoxNotNull(this.deviationDescription, errorProvider1); } } if (requestedBy && position && standardCondition && detailRequestedDevV && deviationType && compareDeviationPeriod != 0 && compareDeviationPeriod < 0) { Deviation deviation = this.getDeviationObject(); if (this.actionType == "newDeviation") { //add a new Deviation //verify if the user is one of the Group //redirect the user to se the email content EmailGUI emailGUI = new EmailGUI(deviation, this); emailGUI.Show(); } else { //update DEVIATION // before updating verify the Autorisation if (this.deviation != null) { deviationModel.updateDeviation(this.getDeviationObjectToUpdate()); MessageBox.Show(this.languageModel.getString("deviationupdated"), "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } else { MessageBox.Show(this.languageModel.getString("formInputsNotValid"), "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information); if (compareDeviationPeriod == 0) { MessageBox.Show(this.languageModel.getString("deviationPeriodNull"), "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (compareDeviationPeriod > 0) { MessageBox.Show(this.languageModel.getString("deviationNegativePeriod"), "Infos", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }