private void changeButton_Click(object sender, EventArgs e) { try { DataGridViewRow row = dataGridViewAnalys.SelectedRows[0]; switch (groupComboBox.Text) { case "Общие показатели": GeneralLevelOfQuality generalLevelOfQuality = new GeneralLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); controller.changeButtonClick(generalLevelOfQuality, true); break; case "Вредные примеси": HarmfulLevelOfQuality harmfulLevelOfQuality = new HarmfulLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); controller.changeButtonClick(harmfulLevelOfQuality, true); break; case "Сорные примеси": WeedLevelOfQuality weedLevelOfQuality = new WeedLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); controller.changeButtonClick(weedLevelOfQuality, true); break; case "Зерновые примеси": GrainLevelOfQuality grainLevelOfQuality = new GrainLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); controller.changeButtonClick(grainLevelOfQuality, true); break; } selectAnalys(changeComboBox(groupComboBox.Text)); } catch (System.ArgumentOutOfRangeException) { MessageBox.Show("Выберите запись!", "Изменение", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void defineClassButton_Click(object sender, EventArgs e) { try { switch (groupComboBox.Text) { case "Общие показатели": GeneralLevelOfQuality generalLevelOfQuality = new GeneralLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); classLabel.Text = controller.defineClassClick(generalLevelOfQuality, Convert.ToString(dataGridViewRaw.CurrentRow.Cells[2].Value), typeLabel.Text, subtypeLabel.Text, dataGridViewAnalys); break; case "Вредные примеси": HarmfulLevelOfQuality harmfulLevelOfQuality = new HarmfulLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); classLabel.Text = controller.defineClassClick(harmfulLevelOfQuality, Convert.ToString(dataGridViewRaw.CurrentRow.Cells[2].Value), typeLabel.Text, subtypeLabel.Text, dataGridViewAnalys); break; case "Сорные примеси": WeedLevelOfQuality weedLevelOfQuality = new WeedLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); classLabel.Text = controller.defineClassClick(weedLevelOfQuality, Convert.ToString(dataGridViewRaw.CurrentRow.Cells[2].Value), typeLabel.Text, subtypeLabel.Text, dataGridViewAnalys); break; case "Зерновые примеси": GrainLevelOfQuality grainLevelOfQuality = new GrainLevelOfQuality(Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[0].Value), Convert.ToString(dataGridViewAnalys.CurrentRow.Cells[2].Value)); classLabel.Text = controller.defineClassClick(grainLevelOfQuality, Convert.ToString(dataGridViewRaw.CurrentRow.Cells[2].Value), typeLabel.Text, subtypeLabel.Text, dataGridViewAnalys); break; } } catch (NullReferenceException) { MessageBox.Show("Введите значение хотя бы одного показателя!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public AddAnalysQualityRawForm(GrainLevelOfQuality newGrainLevelOfQuality, string[] impurities) { InitializeComponent(); controller = new AddAnalysQualityRawController(); impurityComboBox.Items.AddRange(impurities); impurityComboBox.Text = impurityComboBox.Items[0].ToString(); grainLevelOfQuality = newGrainLevelOfQuality; }
public AddAnalysQualityRawForm(GrainLevelOfQuality newGrainLevelOfQuality, bool change) { InitializeComponent(); controller = new AddAnalysQualityRawController(); this.Text = "Изменение зернового показателя качества"; impurityComboBox.Items.Add(newGrainLevelOfQuality.LevelQuality); impurityComboBox.Text = newGrainLevelOfQuality.LevelQuality; impurityComboBox.Enabled = false; valueTextBox.Text = newGrainLevelOfQuality.Value; forChange = change; grainLevelOfQuality = newGrainLevelOfQuality; }
public bool addClick(GrainLevelOfQuality grainLevelOfQuality) { if (!DAO.getInstance().addValuesImpurities(GrainLevelOfQuality.NameTable, TypeGrainLevelOfQuality.NameAttr, GrainLevelOfQuality.ValueAttr, grainLevelOfQuality.IdRaw, grainLevelOfQuality.LevelQuality, grainLevelOfQuality.Value)) { MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { return(true); } }