Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void LoadModelsData()
        {
            List <ModelLibraOEM> models = new List <ModelLibraOEM>();
            var test = new ModelLibraOEM
            {
                Name = "",
            };

            models.Add(test);
            var data = Ultils.ReadAllLines(path, Encoding.ASCII);

            foreach (var item in data)
            {
                ModelLibraOEM model = null;
                string[]      array = null;
                if (item.Contains(","))
                {
                    array = item.Split(',');
                    model = new ModelLibraOEM
                    {
                        Name   = array[0],
                        Code   = array[1],
                        REV    = array[2],
                        ASSYNo = array[3],
                    };
                }
                models.Add(model);
            }
            cboModels.DataSource    = models;
            cboModels.DisplayMember = "Name";
            cboModels.ValueMember   = "Name";
        }
Ejemplo n.º 2
0
        private void cboModels_SelectedIndexChanged(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            string selectModel = null;

            if (cboModels.SelectedIndex > 0)
            {
                selectModel = cboModels.SelectedValue.ToString();

                var      data  = Ultils.ReadAllLines(path, Encoding.ASCII).SingleOrDefault(c => c.Contains(selectModel));
                string[] array = data.Split(',');
                _model = new ModelLibraOEM()
                {
                    Name   = array[0],
                    Code   = array[1],
                    REV    = array[2],
                    ASSYNo = array[3],
                };
                txtASSYNo.Text = _model.ASSYNo;
                string year     = cboYear.Text;
                string month    = cboMonth.Text;
                string pathFile = $@"{pathLog}\{selectModel}\{ year + month}.csv";
                if (!File.Exists(pathFile))
                {
                    if (selectModel.Substring(5, 1) == "8")
                    {
                        this.txtSerialBegin.Text = "90001";
                    }
                    else
                    {
                        this.txtSerialBegin.Text = "00001";
                    }
                }
                else
                {
                    string   strContent = Ultils.ReadLastLine(pathFile, Encoding.ASCII, "\n");
                    string[] value      = strContent.Split(',');
                    txtSerialBegin.Text = value[3];
                }
                txtQuantity.Focus();
            }
        }