private void saveButton_Click(object sender, EventArgs e) { string norm = textBoxNorm.Text.Replace(",", "."); if (forChange) { generalLevelOfQualityNorm.Norm = norm; if (radioButtonMin.Checked) { generalLevelOfQualityNorm.Isminimum = true; } else if (radioButtonMax.Checked) { generalLevelOfQualityNorm.Isminimum = false; } if (controller.changeClick(generalLevelOfQualityNorm)) { this.Close(); } } else { if (radioButtonMin.Checked) { generalLevelOfQualityNorm.Isminimum = true; } else if (radioButtonMax.Checked) { generalLevelOfQualityNorm.Isminimum = false; } generalLevelOfQualityNorm.Norm = norm; generalLevelOfQualityNorm.TypeImp = impComboBox.Text; if (controller.addClick(generalLevelOfQualityNorm, type, subtype)) { this.Close(); } } }
private void saveButton_Click(object sender, EventArgs e) { if (forChange) { string norm = textBoxNorm.Text.Trim().Replace(",", "."); switch (this.Text) { case "Изменение вредного показателя качества": harmfulLevelOfQualityNorm.Norm = norm; if (controller.changeClick(harmfulLevelOfQualityNorm)) { this.Close(); } break; case "Изменение сорного показателя качества": weedLevelOfQualityNorm.Norm = norm; if (controller.changeClick(weedLevelOfQualityNorm)) { this.Close(); } break; case "Изменение зернового показателя качества": grainLevelOfQualityNorm.Norm = norm; if (controller.changeClick(grainLevelOfQualityNorm)) { this.Close(); } break; } } else { if (harmfulLevelOfQualityNorm != null) { harmfulLevelOfQualityNorm.Norm = textBoxNorm.Text; harmfulLevelOfQualityNorm.TypeImp = impComboBox.Text; if (controller.addClick(harmfulLevelOfQualityNorm, type, subtype)) { this.Close(); } } else if (weedLevelOfQualityNorm != null) { weedLevelOfQualityNorm.Norm = textBoxNorm.Text; weedLevelOfQualityNorm.TypeImp = impComboBox.Text; if (controller.addClick(weedLevelOfQualityNorm, type, subtype)) { this.Close(); } } else if (grainLevelOfQualityNorm != null) { grainLevelOfQualityNorm.Norm = textBoxNorm.Text; grainLevelOfQualityNorm.TypeImp = impComboBox.Text; if (controller.addClick(grainLevelOfQualityNorm, type, subtype)) { this.Close(); } } } }