예제 #1
0
 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;
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 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;
 }
예제 #4
0
 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);
     }
 }
예제 #5
0
 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);
     }
 }
예제 #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); }
        }
예제 #7
0
 public void changeButtonClick(GrainLevelOfQualityNorm grainLevelOfQualityNorm, bool forChange)
 {
     new AddNormOfRawForm(grainLevelOfQualityNorm, forChange).ShowDialog();
 }
예제 #8
0
 public void deleteButtonClick(GrainLevelOfQualityNorm grainLevelOfQualityNorm)
 {
     DAO.getInstance().deleteNorm(GrainLevelOfQualityNorm.NameTable, GrainLevelOfQualityNorm.IdAttr,
                                  grainLevelOfQualityNorm.Id);
 }