Exemple #1
0
 public ActionResult LoadModifier(int ID)
 {
     try {
         var listModifier = ModifireService.GetModifireByProduct(ID, 1);
         return(Json(listModifier, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         SystemLog.LogPOS.WriteLog("MenuController::::::::::::::::::::LoadModifier::::::::::::::::::" + ex.Message);
         return(null);
     }
 }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        private void ucModifier_btnRemove_Click(object sender, EventArgs e)
        {
            frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this modifier ?");

            frmcon.ShowDialog();
            if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                Button        modifier     = (Button)sender;
                ModifireModel dataModifier = (ModifireModel)(modifier.Tag);
                var           result       = ModifireService.Delete(dataModifier);
                if (result == 1)
                {
                    addModifier("Modifier List", 4, this.CurrentPage);
                    pnDetail.Controls.Clear();
                    frmMessager frm = new frmMessager("Messenger", "Delete modifire success.");
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", "Delete modifire fail.");
                    frmOpacity.ShowDialog(this, frm);
                }
            }
        }
Exemple #4
0
        private void ucModifier_btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Button        modifier      = (Button)sender;
                ModifireModel dataModifier  = (ModifireModel)(modifier.Tag);
                string        message_error = "";
                var           ucModifier    = (UCModifier)pnDetail.Controls[0];
                var           modifierName  = ucModifier.txtModifierName.Text;
                var           modifierColor = ucModifier.cbColor.Text;
                var           modifierPrice = Convert.ToDouble(ucModifier.txtModifierPrice.Text) * 1000;

                if (dataModifier == null)
                {
                    dataModifier = new ModifireModel();
                }

                if (modifierName == "")
                {
                    message_error += "Modifire name isn't empty.";
                }
                if (modifierColor == "")
                {
                    message_error += "Modifire Color isn't empty";
                }
                if (modifierPrice.ToString() == "")
                {
                    message_error += "Modifre price isn't empty";
                }
                if (message_error == "")
                {
                    dataModifier.ModifireName = modifierName;
                    dataModifier.Color        = modifierColor;
                    dataModifier.CurrentPrice = (modifierPrice);
                    var result  = ModifireService.Created(dataModifier);
                    var message = "";
                    if (result == 1)
                    {
                        addModifier("Modifier List", 4, this.CurrentPage);
                        pnDetail.Controls.Clear();
                        message = "Save modifier Successful";
                    }
                    else
                    {
                        if (result == -1)
                        {
                            message = "Modifier name already exist. Please change modifire name.";
                        }
                        else
                        {
                            message = "Save modifier fail";
                        }
                    }
                    frmMessager frm = new frmMessager("Messenger", message);
                    frmOpacity.ShowDialog(this, frm);
                }
                else
                {
                    frmMessager frm = new frmMessager("Messenger", message_error);
                    frmOpacity.ShowDialog(this, frm);
                }
            }
            catch (Exception ex)
            {
                SystemLog.LogPOS.WriteLog("frmMenuSetting::::::::::::::::::::::ucModifier_btnSave_Click::::::::::::::::" + ex.Message);
            }
        }
Exemple #5
0
        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;
            }
        }