public frmGroupAdd(int _categoryid) { InitializeComponent(); categoryid = _categoryid; listmap = CatalogeService.GetProductByCategoryID(categoryid).ToList(); listall = CatalogeService.GetAllListProductByCategory(categoryid).ToList(); }
void ucGroupList_btnRemove_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this group ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnRemoveGroup = (Button)sender; CategoryModel tag = (CategoryModel)(btnRemoveGroup.Tag); if (tag.CategoryID > 0) { var result = CatalogeService.RemoveCategory(tag.CategoryID, 0); var messenge = ""; if (result == 1) { addGroupList("Group List", 2, this.CurrentPage); pnDetail.Controls.Clear(); messenge = "Remove group successful."; } else { messenge = "Remove group fail."; } frmMessager frm = new frmMessager("Messenger", messenge); frmOpacity.ShowDialog(this, frm); } } }
void ucMenuList_btnRemove_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this menu ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnRemove = (Button)sender; CatalogueModel tag = (CatalogueModel)(btnRemove.Tag); if (tag.CatalogueID > 0) { var result = CatalogeService.RemoveCatalogue(tag.CatalogueID, 0); if (result == 1) { addMenuList("Menu List", 1); pnDetail.Controls.Clear(); frmMessager frm = new frmMessager("Messenger", "Delete menu successful."); frmOpacity.ShowDialog(this, frm); } else { frmMessager frm = new frmMessager("Messenger", "Delete menu fail."); frmOpacity.ShowDialog(this, frm); } } } }
private void txtSearch_TextChanged(object sender, EventArgs e) { try { var listAllSearch = new List <ProductionModel>(); listall = new List <ProductionModel>(); listAllSearch = CatalogeService.GetSearchAllListProductByCategory(categoryid, txtSearch.Text).ToList(); flpAllitems.AutoScroll = true; List <string> str = new List <string>(); for (var i = 0; i < listmap.Count(); i++) { str.Add(listmap[i].ProductNameDesc); } foreach (var item in listAllSearch) { if (!str.Contains(item.ProductNameDesc)) { listall.Add(item); } } LoadAllItem(); } catch (Exception ex) { SystemLog.LogPOS.WriteLog("frmGroupAdd:::::::::::::::::::txtSearch_TextChanged:::::::::::::::::" + ex.Message); } }
private void btnOk_Click(object sender, EventArgs e) { this.UpdatePosition(); var result = CatalogeService.SaveDataMapProductToCategory(listmap, categoryid, 0); if (result == 1) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBox.Show("Save data product fail.", "Messenger"); } }
private void LoadCategory() { flpGroup.Controls.Clear(); var lst = CatalogeService.GetListCategory(); foreach (CategoryModel item in lst) { UCCategoryPrint ucCategory = new UCCategoryPrint(); ucCategory.lblNameCategory.Text = item.CategoryNameSort; ucCategory.Tag = item; ucCategory.Click += ucCategory_Click; ucCategory.Width = flpGroup.Width; flpGroup.Controls.Add(ucCategory); } }
static void Main(string[] args) { UserService service = new UserService(); CatalogeService catalogeService = new CatalogeService(); int continueInput = 0; do { Console.WriteLine("Press 1 to Get Profile"); Console.WriteLine("Press 2 to Get ProfileUsers"); Console.WriteLine("Press 3 to Get Cataloges"); int input = Convert.ToInt16(Console.ReadLine()); switch (input) { case 1: { Console.WriteLine("Getting Profile"); Console.WriteLine("__________________________________________________"); string profile = service.GetProfile(); Console.WriteLine(profile); break; } case 2: { Console.WriteLine("Getting User Profile"); Console.WriteLine("__________________________________________________"); string users = service.GetProfileUsers(); Console.WriteLine(users); break; } case 3: { Console.WriteLine("Getting User cataloge"); Console.WriteLine("__________________________________________________"); string users = catalogeService.GetCataloge(); Console.WriteLine(users); break; } } Console.WriteLine("Press 1 to continue"); continueInput = Convert.ToInt16(Console.ReadLine()); }while (continueInput == 1); }
void ucGroupList_btnSave_Click(object sender, EventArgs e) { Button btnSaveGroup = (Button)sender; CategoryModel tag = (CategoryModel)(btnSaveGroup.Tag); var ucGroupItem = (UCGroupList)pnDetail.Controls[0]; if (tag == null) { tag = new CategoryModel(); } tag.CategoryName = ucGroupItem.txtGroupNameDesc.Text; tag.CategoryNameSort = ucGroupItem.txtGroupNameSort.Text ?? ""; tag.Color = ucGroupItem.cbGroupColor.Text ?? ""; tag.ProductColor = ucGroupItem.cbProductColor.Text ?? ""; if (tag.CategoryName != "") { var result = CatalogeService.SaveDataCategory(tag); var message = ""; if (result == 1) { addGroupList("Group List", 2, this.CurrentPage); message = "Save data group successful."; } else { if (result == -1) { message = "Menu name already exist. Please change group name."; } else { message = "Save data group fail"; } } frmMessager frm = new frmMessager("Messenger", message); frmOpacity.ShowDialog(this, frm); } else { frmMessager frm = new frmMessager("Messenger", "Group name isn't empty."); frmOpacity.ShowDialog(this, frm); } }
void ucMenuList_btnSave_Click(object sender, EventArgs e) { Button catalogue = (Button)sender; CatalogueModel tag = (CatalogueModel)(catalogue.Tag); var ucMenu = (UCMenu)pnDetail.Controls[0]; if (tag == null) { tag = new CatalogueModel(); } tag.CatalogueName = ucMenu.txtMenuName.Text; tag.Color = ucMenu.cbColor.Text ?? ""; if (tag.CatalogueName != "") { var result = CatalogeService.SavaDataCatalogue(tag); var message = ""; if (result == 1) { addMenuList("Menu List", 1); message = "Save data menu successful"; } else { if (result == -1) { message = "Menu name already exists. Please change menu name"; } else { message = "Save data menu fail"; } } frmMessager frm = new frmMessager("Messager", message); frmOpacity.ShowDialog(this, frm); } else { frmMessager frm = new frmMessager("Messager", "Menu name isn't empty."); frmOpacity.ShowDialog(this, frm); } }
private void addGroupList(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; if (this.TotalPage == 0) { this.TotalPage = CatalogeService.GetTotalCategory(); } var dataCategory = CatalogeService.GetListCategory(CurrentPage); if (i == 2) { 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 item in dataCategory) { UCGroupListItem ucGroupListItem = new UCGroupListItem(); ucGroupListItem.lblGroupListItemName.Text = item.CategoryName; ucGroupListItem.Tag = item; ucGroupListItem.Width = flpMenuList.Width; ucGroupListItem.Click += ucGroupListItem_Click; flpMenuList.Controls.Add(ucGroupListItem); index++; } } else { flpMenuList.Controls.Clear(); pnDetail.Controls.Clear(); } }
private void addMenuList(string lblName, int i) { if (btnAdd.Visible == false) { btnAdd.Visible = true; } txtSearch.Visible = false; txtSearch.Tag = i; btnAdd.Tag = i; btBack.Tag = i; btNext.Tag = i; ResizeToOthder(); int index = 1; //string[] str = { "FOOD", "BEVEGARE", "ENTREE", "DESSERT" }; if (i == 1) { var dataCatalogue = CatalogeService.GetCatalogueList().ToList(); 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 item in dataCatalogue) { UCMenuList ucMenuList = new UCMenuList(); ucMenuList.lblMenuListName.Text = item.CatalogueName; ucMenuList.Tag = item; ucMenuList.Width = flpMenuList.Width; ucMenuList.Click += ucMenuList_Click; flpMenuList.Controls.Add(ucMenuList); index++; } } else { flpMenuList.Controls.Clear(); pnDetail.Controls.Clear(); } }
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; } }