Example #1
0
        private void initComboBoxByCompany()
        {
            initing = true;
            object val = null;

            val = comboBox1.SelectedValue;
            try
            {
                if (val != null)
                {
                    comboBox2.DataSource    = ProductLineFactory.GetByCompanyCode(val.ToString());
                    comboBox2.SelectedValue = DB.ReadConfigLocal("PRODUCTLINE_CODE");
                    setComboxBoxCurrent(comboBox2);

                    val = comboBox2.SelectedValue;
                    if (val != null)
                    {
                        comboBox3.DataSource = StationFactory.GetByProductLine(val.ToString());
                    }
                    else
                    {
                        List <StationEntity> stas = StationFactory.GetAll();
                        var sta1 = from ss in stas
                                   where ss.COMPANY_CODE == LoginInfo.CompanyInfo.COMPANY_CODE
                                   select ss;
                        comboBox3.DataSource = sta1.ToList <StationEntity>();
                    }
                    comboBox6.SelectedValue = DB.ReadConfigLocal("WORKSHOP_CODE");
                    comboBox6.DataSource    = WorkShopFactory.GetAll();
                    setComboxBoxCurrent(comboBox6);

                    comboBox3.SelectedValue = DB.ReadConfigLocal("STATION_CODE");
                    setComboxBoxCurrent(comboBox3);

                    comboBox4.DataSource    = ShiftFactory.GetAll();
                    comboBox4.SelectedValue = DB.ReadConfigLocal("SHIFT_CODE");
                    setComboxBoxCurrent(comboBox4);

                    comboBox5.DataSource    = TeamFactory.GetByPlineCode(val.ToString());
                    comboBox5.SelectedValue = DB.ReadConfigLocal("TEAM_CODE");
                    setComboxBoxCurrent(comboBox5);
                }
            }
            catch
            {
            }
            initing = false;
        }
Example #2
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (initing)
            {
                return;
            }
            string plinermesid = comboBox2.SelectedValue.ToString();

            DB.WriteConfigLocal("PRODUCTLINE_CODE", plinermesid);
            List <StationEntity> stations = StationFactory.GetAll();
            var ss = from s in stations
                     where s.PLINE_CODE == plinermesid && s.COMPANY_CODE == comboBox1.SelectedValue.ToString()
                     select s;

            comboBox3.DataSource = ss.ToList <StationEntity>();
            List <TeamEntity> teams = TeamFactory.GetByPlineCode(plinermesid);

            comboBox5.DataSource = teams;
        }