コード例 #1
0
ファイル: frmMenuSetting.cs プロジェクト: pcthanh/POSEZ2U
 private void addModifier(string lblName, int i, int CurrentPage)
 {
     if (btnAdd.Visible == false)
     {
         btnAdd.Visible = true;
     }
     txtSearch.Visible = true;
     txtSearch.Tag = i;
     btnAdd.Tag = i;
     btBack.Tag = i;
     btNext.Tag = i;
     ResizeToOthder();
     int index = 1;
     int RowCount = 1;
     //string[] str = { "No Sugar", "More Sugar", "More Ice", "Less Ice", "More Milk", "Them Bun", "Them Thit" };
     if (this.TotalPage == 0)
     {
         this.TotalPage = ModifireService.GetTotalModifire();
     }
     var dataModifire = ModifireService.GetModifireList(CurrentPage);
     if (i == 4)
     {
         flpMenuList.Controls.Clear();
         //txtNameMenuList.Visible = true;
         txtNameMenuList.lblMenuListName.Text = lblName;
         txtNameMenuList.BackColor = Color.FromArgb(0, 102, 204);
         txtNameMenuList.ForeColor = Color.FromArgb(255, 255, 255);
         foreach (var data in dataModifire)
         {
             RowCount++;
             UCModifierItem ucModifierItem = new UCModifierItem();
             ucModifierItem.lblModifierItemName.Text = data.ModifireName;
             ucModifierItem.Tag = data;
             ucModifierItem.Width = flpMenuList.Width;
             ucModifierItem.Click += ucModifierItem_Click;
             flpMenuList.Controls.Add(ucModifierItem);
             index++;
         }
     }
     else
     {
         flpMenuList.Controls.Clear();
         pnDetail.Controls.Clear();
     }
 }
コード例 #2
0
ファイル: frmMenuSetting.cs プロジェクト: pcthanh/POSEZ2U
        private void ucTextBoxKeyBoard1_TextChanged(object sender, EventArgs e)
        {
            TextBox addNew = (TextBox)sender;
            int tag = Convert.ToInt32(addNew.Tag);
            string textSearch = txtSearch.Text;
            switch (tag)
            {
                case 1:
                    UCMenu ucMenu = new UCMenu();
                    ucMenu.Dock = DockStyle.Fill;
                    ucMenu.btnSave.Click += ucMenuList_btnSave_Click;
                    ucMenu.btnRemove.Hide();
                    pnDetail.Controls.Add(ucMenu);
                    break;
                case 2:
                    btnAdd.Tag = tag;
                    int index_group = 1;
                    // string[] str = { "COM", "PHO", "HU TIEU", "CHAO", "Coffee", "Tea", "Smoothie" };
                    if (tag == 2)
                    {

                        var dataCategory = CatalogeService.searchProduct(textSearch, 2).ToList();
                        flpMenuList.Controls.Clear();
                        //txtNameMenuList.Visible = true;
                        txtNameMenuList.lblMenuListName.Text = "Group List";
                        txtNameMenuList.BackColor = Color.FromArgb(0, 102, 204);
                        txtNameMenuList.ForeColor = Color.FromArgb(255, 255, 255);
                        foreach (var item in dataCategory)
                        {
                            UCGroupListItem ucGroupListItem = new UCGroupListItem();
                            ucGroupListItem.lblGroupListItemName.Text = item.CategoryName;
                            ucGroupListItem.Tag = item;
                            ucGroupListItem.Click += ucGroupListItem_Click;
                            flpMenuList.Controls.Add(ucGroupListItem);
                            index_group++;
                        }
                    }
                    break;
                case 3:
                    btnAdd.Tag = tag;
                    ResizeToOthder();
                    int index_item = 1;
                    //string[] str = { "Ice coffee", "VNam Coffee", "Mocha", "Latte", "White Coffee", "Green Tea", "Apple Juice" };
                    var dataProduct = ProductService.searchProduct(textSearch,3).ToList();
                    if (tag == 3)
                    {
                        flpMenuList.Controls.Clear();
                        txtNameMenuList.lblMenuListName.Text = "ItemList";
                        txtNameMenuList.BackColor = Color.FromArgb(0, 102, 204);
                        txtNameMenuList.ForeColor = Color.FromArgb(255, 255, 255);
                        foreach (var data in dataProduct)
                        {
                            UCItem ucItem = new UCItem();
                            ucItem.lblItem.Text = data.ProductNameDesc;
                            ucItem.Tag = data;
                            ucItem.Click += ucItem_Click;
                            flpMenuList.Controls.Add(ucItem);
                            index_item++;
                        }
                    }
                    else
                    {
                        flpMenuList.Controls.Clear();
                        pnDetail.Controls.Clear();
                    }
                    break;
                case 4:
                    btnAdd.Tag = tag;
                    ResizeToOthder();
                    int index_modifier = 1;
                    //string[] str = { "No Sugar", "More Sugar", "More Ice", "Less Ice", "More Milk", "Them Bun", "Them Thit" };
                    var dataModifire = ModifireService.searchProduct(textSearch,4).ToList();
                    if (tag == 4)
                    {
                        flpMenuList.Controls.Clear();
                        //txtNameMenuList.Visible = true;
                        txtNameMenuList.lblMenuListName.Text = "Modifier List";
                        txtNameMenuList.BackColor = Color.FromArgb(0, 102, 204);
                        txtNameMenuList.ForeColor = Color.FromArgb(255, 255, 255);
                        foreach (var data in dataModifire)
                        {
                            UCModifierItem ucModifierItem = new UCModifierItem();
                            ucModifierItem.lblModifierItemName.Text = data.ModifireName;
                            ucModifierItem.Tag = data;
                            ucModifierItem.Click += ucModifierItem_Click;
                            flpMenuList.Controls.Add(ucModifierItem);
                            index_modifier++;
                        }
                    }
                    else
                    {
                        flpMenuList.Controls.Clear();
                        pnDetail.Controls.Clear();
                    }
                    break;
                case 5:
                    break;
            }
        }