public AddNormOfRawForm(GrainLevelOfQualityNorm newGrainLevelOfQualityNorm, string[] impurities, string newType, string newSubtype) { InitializeComponent(); controller = new AddNormOfRawController(); impComboBox.Items.AddRange(impurities); impComboBox.Text = impComboBox.Items[0].ToString(); grainLevelOfQualityNorm = newGrainLevelOfQualityNorm; type = newType; subtype = newSubtype; }
public void addButtonClick(GrainLevelOfQualityNorm grainLevelOfQualityNorm, LinkedList <string> impurities, string type, string subtype) { string[] imp = DAO.getInstance().getImpurity(TypeGrainLevelOfQuality.NameTable, GrainLevelOfQualityNorm.TypeOfLevelQualityAttr, impurities); if (imp.Length > 0) { new AddNormOfRawForm(grainLevelOfQualityNorm, imp, type, subtype).ShowDialog(); } else { MessageBox.Show("У всех показателей качества определена норма!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public AddNormOfRawForm(GrainLevelOfQualityNorm newGrainLevelOfQualityNorm, bool change) { InitializeComponent(); controller = new AddNormOfRawController(); this.Text = "Изменение зернового показателя качества"; impComboBox.Items.Add(newGrainLevelOfQualityNorm.TypeImp); impComboBox.Text = newGrainLevelOfQualityNorm.TypeImp; impComboBox.Enabled = false; textBoxNorm.Text = newGrainLevelOfQualityNorm.Norm; forChange = change; grainLevelOfQualityNorm = newGrainLevelOfQualityNorm; }
public bool addClick(GrainLevelOfQualityNorm grainLevelOfQualityNorm, string type, string subtype) { if (!DAO.getInstance().addNorm(GrainLevelOfQualityNorm.NameTable, GrainLevelOfQualityNorm.TypeOfLevelQualityAttr, grainLevelOfQualityNorm.TypeImp, GrainLevelOfQualityNorm.NormAttr, grainLevelOfQualityNorm.Raw, grainLevelOfQualityNorm.Norm, Convert.ToString(grainLevelOfQualityNorm.ClassRaw), type, subtype)) { MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { return(true); } }
public bool changeClick(GrainLevelOfQualityNorm grainLevelOfQualityNorm) { if (!DAO.getInstance().changeNorm(GrainLevelOfQualityNorm.NameTable, GrainLevelOfQualityNorm.IdAttr, grainLevelOfQualityNorm.Norm, grainLevelOfQualityNorm.Id, GrainLevelOfQualityNorm.NormAttr)) { MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } else { return(true); } }
private void changeButton_Click(object sender, EventArgs e) { string[] change = changeComboBox(groupComboBox.Text); try { DataGridViewRow row = dataGridViewNorms.SelectedRows[0]; switch (groupComboBox.Text) { case "Общие показатели": GeneralLevelOfQualityNorm generalLevelOfQualityNorm = new GeneralLevelOfQualityNorm(Convert.ToString(dataGridViewNorms.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[2].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[0].Value), Convert.ToBoolean(dataGridViewNorms.CurrentRow.Cells[3].Value)); controller.changeButtonClick(generalLevelOfQualityNorm, true); /* controller.changeButtonClick(Convert.ToString(dataGridViewNorms.CurrentRow.Cells[0].Value), * Convert.ToString(dataGridViewNorms.CurrentRow.Cells[1].Value), change[0], * rawComboBox.Text, change[2], change[1], comboBoxClass.Text);*/ break; case "Вредные примеси": HarmfulLevelOfQualityNorm harmfulLevelOfQualityNorm = new HarmfulLevelOfQualityNorm(Convert.ToString(dataGridViewNorms.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[2].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[0].Value)); controller.changeButtonClick(harmfulLevelOfQualityNorm, true); break; case "Сорные примеси": WeedLevelOfQualityNorm weedLevelOfQualityNorm = new WeedLevelOfQualityNorm(Convert.ToString(dataGridViewNorms.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[2].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[0].Value)); controller.changeButtonClick(weedLevelOfQualityNorm, true); break; case "Зерновые примеси": GrainLevelOfQualityNorm grainLevelOfQualityNorm = new GrainLevelOfQualityNorm(Convert.ToString(dataGridViewNorms.CurrentRow.Cells[1].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[2].Value), Convert.ToString(dataGridViewNorms.CurrentRow.Cells[0].Value)); controller.changeButtonClick(grainLevelOfQualityNorm, true); break; } select(change); } catch (System.ArgumentOutOfRangeException) { MessageBox.Show("Выберите запись!", "Изменение", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void changeButtonClick(GrainLevelOfQualityNorm grainLevelOfQualityNorm, bool forChange) { new AddNormOfRawForm(grainLevelOfQualityNorm, forChange).ShowDialog(); }
public void deleteButtonClick(GrainLevelOfQualityNorm grainLevelOfQualityNorm) { DAO.getInstance().deleteNorm(GrainLevelOfQualityNorm.NameTable, GrainLevelOfQualityNorm.IdAttr, grainLevelOfQualityNorm.Id); }