Exemplo n.º 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); }
        }
Exemplo n.º 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); }
        }
Exemplo n.º 3
0
 public AddAnalysQualityRawForm(GrainLevelOfQuality newGrainLevelOfQuality, string[] impurities)
 {
     InitializeComponent();
     controller = new AddAnalysQualityRawController();
     impurityComboBox.Items.AddRange(impurities);
     impurityComboBox.Text = impurityComboBox.Items[0].ToString();
     grainLevelOfQuality   = newGrainLevelOfQuality;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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);
     }
 }