Exemplo n.º 1
0
 void ListFill()
 {
     if (TPAType == 0)
     {
         comboBoxType.DataSource       = Data.Types0;
         comboBoxWeight.DataSource     = Data.Weights0;
         comboBoxColor.DataSource      = Data.Colors0;
         comboBoxCount.DataSource      = Data.Quantitys0;
         comboBoxMaterial.DataSource   = Data.Materials0;
         comboBoxAntistatic.DataSource = Data.Antistatics0;
         comboBoxColorant.DataSource   = Data.Colorants0;
         comboBoxOther.DataSource      = Data.Others;
     }
     if (TPAType == 1)
     {
         comboBoxType.DataSource = Data.Types1;
         //comboBoxWeight.DataSource = Data.Weights1;
         comboBoxWeight.DataSource     = StaticDir.KolpakWeights(comboBoxTPA.Text);
         comboBoxColor.DataSource      = Data.Colors1;
         comboBoxCount.DataSource      = Data.Quantitys1;
         comboBoxMaterial.DataSource   = Data.Materials1;
         comboBoxAntistatic.DataSource = Data.Antistatics1;
         comboBoxColorant.DataSource   = Data.Colorants1;
     }
     if (TPAType == 2)
     {
         comboBoxWeight.DataSource = Data.Weights2;
         comboBoxColor.DataSource  = Data.Colors2;
     }
     comboBoxColorant.SelectedItem   = null;
     comboBoxAntistatic.SelectedItem = "";
     comboBoxMaterial.SelectedItem   = null;
     comboBoxType.SelectedItem       = null;
     comboBoxWeight.SelectedItem     = null;
     comboBoxColor.SelectedItem      = null;
     comboBoxCount.SelectedItem      = null;
     comboBoxOther.SelectedItem      = null;
 }
Exemplo n.º 2
0
        //Выбор ТПА из списка (сбрасываем несохранённые поля и заполняим их текущими)
        private void comboBoxTPA_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Заполнение полей из ТПА
            curLab = Data.lines[comboBoxTPA.SelectedIndex];
            //Заполнение выпадающих списков
            if (curLab.lineType == 0)
            {
                comboBoxWeight.DataSource     = Data.Weights0;
                comboBoxColor.DataSource      = Data.Colors0;
                comboBoxCount.DataSource      = Data.Quantitys0;
                comboBoxType.DataSource       = Data.Types0;
                comboBoxMaterial.DataSource   = Data.Materials0;
                comboBoxAntistatic.DataSource = Data.Antistatics0;
                comboBoxColorants.DataSource  = Data.Colorants0;
                comboBoxOther.DataSource      = Data.Others;
            }
            if (curLab.lineType == 1)
            {
                comboBoxWeight.DataSource = StaticDir.KolpakWeights(comboBoxTPA.Text);
                comboBoxColor.DataSource  = Data.Colors1;
                comboBoxCount.DataSource  = Data.Quantitys1;
                //comboBoxType.DataSource =
                comboBoxMaterial.DataSource   = Data.Materials1;
                comboBoxAntistatic.DataSource = Data.Antistatics1;
                comboBoxColorants.DataSource  = Data.Colorants1;
            }
            if (curLab.lineType == 2)
            {
                comboBoxWeight.DataSource    = Data.Weights2;
                comboBoxColor.DataSource     = Data.Colors2;
                comboBoxColorants.DataSource = Data.Colorants2;
            }

            //Очистка полей
            comboBoxLimit.DataSource        = Data.Limits;
            comboBoxWeight.SelectedItem     = null;
            comboBoxType.SelectedItem       = null;
            comboBoxMaterial.SelectedItem   = null;
            comboBoxColor.SelectedItem      = null;
            comboBoxCount.SelectedItem      = null;
            comboBoxColorants.SelectedItem  = null;
            comboBoxLimit.SelectedItem      = null;
            textBoxNumber.Text              = "";
            comboBoxAntistatic.SelectedItem = "";
            textBoxKN.Text = "";
            textBoxKP.Text = "";
            textBoxDN.Text = "";
            textBoxDP.Text = "";

            //Видимость полей
            comboBoxWeight.Enabled = true;
            comboBoxType.Enabled   = (curLab.lineType != 2);
            comboBoxWeight_SelectedIndexChanged(null, null); //Для веса для С1 и С2 особоые условия :-( сука
            comboBoxMaterial.Enabled   = (curLab.lineType != 2);
            comboBoxColor.Enabled      = true;
            comboBoxCount.Enabled      = (curLab.lineType != 2);
            textBoxNumber.Enabled      = (curLab.lineType != 2);
            comboBoxAntistatic.Enabled = (curLab.lineType != 2);
            comboBoxColorants.Enabled  = true;
            comboBoxLimit.Enabled      = (curLab.lineType == 0);
            comboBoxOther.Enabled      = (curLab.lineType != 2);
            textBoxBox.Enabled         = true;
            textBoxKN.Enabled          = (curLab.lineType == 0);
            textBoxKP.Enabled          = (curLab.lineType == 0);
            textBoxDN.Enabled          = (curLab.lineType == 0);
            textBoxDP.Enabled          = (curLab.lineType == 0);

            //Видимость подписей полей
            label3.Enabled  = true;
            label2.Enabled  = (curLab.lineType != 2);
            label6.Enabled  = (curLab.lineType != 2);
            label7.Enabled  = true;
            label4.Enabled  = (curLab.lineType != 2);
            label1.Enabled  = (curLab.lineType != 2);
            label8.Enabled  = (curLab.lineType != 2);
            label9.Enabled  = true;
            label10.Enabled = (curLab.lineType == 0);
            label11.Enabled = (curLab.lineType != 2);
            label12.Enabled = true;
            labelKN.Enabled = (curLab.lineType == 0);
            labelKP.Enabled = (curLab.lineType == 0);
            labelDN.Enabled = (curLab.lineType == 0);
            labelDP.Enabled = (curLab.lineType == 0);

            //Заполнение полей
            if (curLab.weight != "")
            {
                comboBoxWeight.SelectedItem = curLab.weight;
            }
            else
            {
                comboBoxWeight.SelectedItem = null;
            }
            if (curLab.material != "")
            {
                comboBoxMaterial.SelectedItem = curLab.material;
            }
            else
            {
                comboBoxMaterial.SelectedItem = null;
            }
            if (curLab.color != "")
            {
                comboBoxColor.SelectedItem = curLab.color;
            }
            else
            {
                comboBoxColor.SelectedItem = null;
            }
            if (curLab.count != "")
            {
                comboBoxCount.SelectedItem = curLab.count;
            }
            else
            {
                comboBoxCount.SelectedItem = null;
            }
            if (curLab.type != "")
            {
                comboBoxType.SelectedItem = curLab.type;
            }
            else
            {
                comboBoxType.SelectedItem = null;
            }
            textBoxNumber.Text = curLab.partNum;
            if (curLab.antistatic != "")
            {
                comboBoxAntistatic.SelectedItem = curLab.antistatic;
            }
            else
            {
                comboBoxAntistatic.SelectedItem = null;
            }
            if (curLab.colorant != "")
            {
                comboBoxColorants.SelectedItem = curLab.colorant;
            }
            else
            {
                comboBoxColorants.SelectedItem = null;
            }
            if (curLab.life != "")
            {
                comboBoxLimit.SelectedItem = curLab.life;
            }
            else
            {
                comboBoxLimit.SelectedItem = null;
            }
            comboBoxOther.Text = curLab.addition;
            textBoxBox.Text    = "1";
            label3.Text        = Data.WeightOrLogo(curLab);
            textBoxKN.Text     = comboBoxColorants.Text;
            //Доступность кнопок
            buttonRepeat.Enabled = (curLab.lineType == 0);
            buttonSave.Enabled   = false;
            buttonClear.Enabled  = true;
        }