Ejemplo n.º 1
0
        private void Product_Load(object sender, EventArgs e)
        {
            design_Dgv();

            masterCom = new Master_Company();
            List <Company_GetCompany_Result> result = masterCom.Get_Company(string.Empty);

            foreach (Company_GetCompany_Result re in result)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = re.companyName;
                item.Value = re.companyID;

                cbCompany.Items.Add(item);
            }

            MasterStore = new Master_StoreManagement();
            List <Store_GetListbank_Result> result2 = MasterStore.Get_Listbank();

            foreach (Store_GetListbank_Result re2 in result2)
            {
                ComboboxItem item = new ComboboxItem();
                item.Text  = re2.bankName;
                item.Value = re2.bankID;

                cbbType.Items.Add(item);
            }


            ViewMode();
        }
Ejemplo n.º 2
0
        private void CbbRock_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListRock.Clear();
            Master = new Master_StoreManagement();
            int id = Listbank[CbbRock.SelectedIndex].bankID;

            int[] Checkstatus = new int[130];
            Array.Clear(Checkstatus, 0, Checkstatus.Length);
            List <Store_GetListrock_Result> result = Master.Get_Listrock(id);

            foreach (Store_GetListrock_Result re in result)
            {
                ListRock.Add(new Store_GetListrock_Result()
                {
                    stockID       = re.stockID,
                    Rack          = re.Rack,
                    companyName   = re.companyName,
                    productName   = re.productName,
                    Duration      = (int)re.Duration,
                    dateIN        = (DateTime)re.dateIN,
                    dateOut       = (DateTime)re.dateOut,
                    createBy      = re.createBy,
                    statusInStock = re.statusInStock
                });

                // Check status product in rack and add image
                Checkstatus[Convert.ToInt32(re.Rack)] = 1;
                Button btn = this.Controls.Find("BTN" + re.Rack, true).First() as Button;
                if (re.statusInStock == "normal")
                {
                    btn.Image = Resources.box_store;
                }
                else
                {
                    btn.Image = Resources.box_storeAlert;
                }
            }
            LoadCbbProduct();

            // check add image null to rack empty
            for (int i = 1; i <= 12; i++)
            {
                for (int j = 1; j <= 6; j++)
                {
                    if (Checkstatus[(i * 10) + j] == 0)
                    {
                        Button btn = this.Controls.Find("BTN" + i.ToString("0#") + j.ToString("#"), true).First() as Button;
                        btn.Image = null;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        void EventSubmit()
        {
            Master = new Master_StoreManagement();
            if (ModeSubmit == "ADD")
            {
                if (CbbProduct.SelectedIndex != -1)
                {
                    Master.Add_Stock((int)CbbProduct.SelectedValue
                                     , Listbank[CbbRock.SelectedIndex].bankID
                                     , Convert.ToInt32(txtRack.Text.Substring(1, 2))
                                     , Convert.ToInt32(txtRack.Text.Substring(3))
                                     , null
                                     , DpkFrom.Value.ToString()
                                     , DpkTo.Value.ToString()
                                     , AppCrash.Login);
                    setfalse();
                    CbbRock_SelectedIndexChanged((object)CbbRock, null);
                    Button btn = this.Controls.Find("BTN" + txtRack.Text.Substring(1), true).First() as Button;
                    BtnRockClick((object)btn, null);
                    BtnRackmode(true);
                    LoadComboboxData();
                }
                else
                {
                    MessageBox.Show("กรุณาใส่ข้อมูลให้ครบถ้วน !!!", Messge.CM_Confirm);
                }
            }
            else if (ModeSubmit == "EDIT")
            {
                if (CbbProduct.SelectedIndex != -1)
                {
                    Master.Edit_Stock(_StockID
                                      , (int)CbbProduct.SelectedValue
                                      , Listbank[CbbRock.SelectedIndex].bankID
                                      , Convert.ToInt32(txtRack.Text.Substring(1, 2))
                                      , Convert.ToInt32(txtRack.Text.Substring(3))
                                      , null
                                      , DpkFrom.Value.ToString()
                                      , DpkTo.Value.ToString()
                                      , AppCrash.Login);

                    setfalse();
                    CbbRock_SelectedIndexChanged((object)CbbRock, null);
                    Button btn = this.Controls.Find("BTN" + txtRack.Text.Substring(1), true).First() as Button;
                    BtnRockClick((object)btn, null);
                    BtnRackmode(true);
                    LoadComboboxData();
                }
            }
        }
Ejemplo n.º 4
0
        void LoadComboboxData()
        {
            Dictionary <int, string> List = new Dictionary <int, string>();

            Master = new Master_StoreManagement();
            // List Rack
            List <Store_GetListbank_Result> resultListbank = Master.Get_Listbank();

            foreach (Store_GetListbank_Result re in resultListbank)
            {
                List.Add(re.bankID
                         , re.instandName.ToString());
                Listbank.Add(new Store_GetListbank_Result()
                {
                    bankID     = re.bankID
                    , bankName = re.bankName
                });
                DgvType.Rows.Add(re.instandName, re.bankName);
            }
            CbbRock.DataSource    = new BindingSource(List, null);
            CbbRock.DisplayMember = "Value";
            CbbRock.ValueMember   = "Key";
            List.Clear();

            LoadCbbProduct();

            // List Company combobox
            List <Store_GetListcompany_Result> resultListcompany = Master.Get_Listcompany();

            foreach (Store_GetListcompany_Result re in resultListcompany)
            {
                List.Add(re.companyID
                         , re.companyName);
                Listcompany.Add(new Store_GetListcompany_Result()
                {
                    companyID   = (int)re.companyID,
                    companyName = (string)re.companyName
                });
            }
            CbbCompany.DataSource    = new BindingSource(List, null);
            CbbCompany.DisplayMember = "Value";
            CbbCompany.ValueMember   = "Key";
            List.Clear();

            // List Percent
            List <Store_GetPercentrock_Result> resultListpercent = Master.Get_Percentrock();

            foreach (Store_GetPercentrock_Result re in resultListpercent)
            {
                ProgressBar Pgb       = Controls.Find("Pgb" + re.instandName, true).First() as ProgressBar;
                Label       lbPercent = Controls.Find("lbPercent" + re.instandName, true).First() as Label;
                Pgb.Value      = (int)re.Percen;
                lbPercent.Text = re.Percen.ToString() + "%";
                if (re.instandName != "Total")
                {
                    TextBox txtTotal = Controls.Find("txtTotal" + re.instandName, true).First() as TextBox;
                    TextBox txtEmpty = Controls.Find("txtEmpty" + re.instandName, true).First() as TextBox;
                    TextBox txtITT   = Controls.Find("txtITT" + re.instandName, true).First() as TextBox;
                    txtTotal.Text = re.Total.ToString();
                    txtEmpty.Text = re.Empty.ToString();
                    txtITT.Text   = re.Imminent.ToString();
                }
            }
        }