Пример #1
0
        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); }
        }
Пример #2
0
        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); }
        }
Пример #3
0
 public AddAnalysQualityRawForm(HarmfulLevelOfQuality newHarmfulLevelOfQuality, string[] impurities)
 {
     InitializeComponent();
     controller = new AddAnalysQualityRawController();
     impurityComboBox.Items.AddRange(impurities);
     impurityComboBox.Text = impurityComboBox.Items[0].ToString();
     harmfulLevelOfQuality = newHarmfulLevelOfQuality;
 }
Пример #4
0
 public AddAnalysQualityRawForm(HarmfulLevelOfQuality newharmfulLevelOfQuality, bool change)
 {
     InitializeComponent();
     controller = new AddAnalysQualityRawController();
     this.Text  = "Изменение вредного показателя качества";
     impurityComboBox.Items.Add(newharmfulLevelOfQuality.LevelQuality);
     impurityComboBox.Text    = newharmfulLevelOfQuality.LevelQuality;
     impurityComboBox.Enabled = false;
     valueTextBox.Text        = newharmfulLevelOfQuality.Value;
     forChange             = change;
     harmfulLevelOfQuality = newharmfulLevelOfQuality;
 }
Пример #5
0
 public bool changeClick(HarmfulLevelOfQuality harmfulLevelOfQuality)
 {
     if (!DAO.getInstance().changeQuality(harmfulLevelOfQuality.IdRaw, HarmfulLevelOfQuality.NameTable,
                                          harmfulLevelOfQuality.LevelQuality, harmfulLevelOfQuality.Value, HarmfulLevelOfQuality.ValueAttr,
                                          TypeHarmfulLevelOfQuality.NameAttr))
     {
         MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else
     {
         return(true);
     }
 }