Beispiel #1
0
 public AddNormOfRawForm(HarmfulLevelOfQualityNorm newharmfulLevelOfQualityNorm, string[] impurities, string newType, string newSubtype)
 {
     InitializeComponent();
     controller = new AddNormOfRawController();
     impComboBox.Items.AddRange(impurities);
     impComboBox.Text          = impComboBox.Items[0].ToString();
     harmfulLevelOfQualityNorm = newharmfulLevelOfQualityNorm;
     type    = newType;
     subtype = newSubtype;
 }
 public void addButtonClick(HarmfulLevelOfQualityNorm hurmfulLevelOfQualityNorm, LinkedList <string> impurities, string type, string subtype)
 {
     string[] imp = DAO.getInstance().getImpurity(TypeHarmfulLevelOfQuality.NameTable, HarmfulLevelOfQualityNorm.TypeOfLevelQualityAttr, impurities);
     if (imp.Length > 0)
     {
         new AddNormOfRawForm(hurmfulLevelOfQualityNorm, imp, type, subtype).ShowDialog();
     }
     else
     {
         MessageBox.Show("У всех показателей качества определена норма!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #3
0
 public AddNormOfRawForm(HarmfulLevelOfQualityNorm newharmfulLevelOfQualityNorm, bool change)
 {
     InitializeComponent();
     controller = new AddNormOfRawController();
     this.Text  = "Изменение вредного показателя качества";
     impComboBox.Items.Add(newharmfulLevelOfQualityNorm.TypeImp);
     impComboBox.Text          = newharmfulLevelOfQualityNorm.TypeImp;
     impComboBox.Enabled       = false;
     textBoxNorm.Text          = newharmfulLevelOfQualityNorm.Norm;
     forChange                 = change;
     harmfulLevelOfQualityNorm = newharmfulLevelOfQualityNorm;
 }
 public bool addClick(HarmfulLevelOfQualityNorm harmfulLevelOfQualityNorm, string type, string subtype)
 {
     if (!DAO.getInstance().addNorm(HarmfulLevelOfQualityNorm.NameTable, HarmfulLevelOfQualityNorm.TypeOfLevelQualityAttr,
                                    harmfulLevelOfQualityNorm.TypeImp, HarmfulLevelOfQualityNorm.NormAttr, harmfulLevelOfQualityNorm.Raw,
                                    harmfulLevelOfQualityNorm.Norm, Convert.ToString(harmfulLevelOfQualityNorm.ClassRaw), type, subtype))
     {
         MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else
     {
         return(true);
     }
 }
 public bool changeClick(HarmfulLevelOfQualityNorm harmfulLevelOfQualityNorm)
 {
     if (!DAO.getInstance().changeNorm(HarmfulLevelOfQualityNorm.NameTable,
                                       HarmfulLevelOfQualityNorm.IdAttr, harmfulLevelOfQualityNorm.Norm,
                                       harmfulLevelOfQualityNorm.Id, HarmfulLevelOfQualityNorm.NormAttr))
     {
         MessageBox.Show("Данная запись уже существует!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     else
     {
         return(true);
     }
 }
Beispiel #6
0
        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(HarmfulLevelOfQualityNorm hurmfulLevelOfQualityNorm, bool forChange)
 {
     new AddNormOfRawForm(hurmfulLevelOfQualityNorm, forChange).ShowDialog();
 }
 public void deleteButtonClick(HarmfulLevelOfQualityNorm hurmfulLevelOfQualityNorm)
 {
     DAO.getInstance().deleteNorm(HarmfulLevelOfQualityNorm.NameTable, HarmfulLevelOfQualityNorm.IdAttr,
                                  hurmfulLevelOfQualityNorm.Id);
 }