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 btnOk_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want add permission ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { var messenger = ""; var result = UserService.SaveMapPermission(listmap, department, userid); if (result == 1) { messenger = "Save permission successful."; this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { messenger = "Save permission fail. Please save again."; } frmConfirm frm = new frmConfirm("Messenger", messenger); frm.btnOk.Hide(); frm.btnCancel.Text = "OK"; frm.ShowDialog(); } }
void btnDeleteDepartment_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want delete Role ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnDelete = (Button)sender; DepartmentModel data = (DepartmentModel)(btnDelete.Tag); if (data.DepartmentID > 0) { var result = UserService.RemoveDepartment(data.DepartmentID, userid); var messenger = "Delete role fail."; if (result == 1) { addDepartmentList("User Role", 1); pDetail.Controls.Clear(); messenger = "Delete role successful."; } frmMessager frm = new frmMessager("Messenger", messenger); frmOpacity.ShowDialog(this, frm); } } }
void btnDeleteUser_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want delete user ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnDelete = (Button)sender; StaffModel data = (StaffModel)(btnDelete.Tag); if (data.StaffID > 0) { var result = UserService.RemoveStaff(data.StaffID, userid); var messenger = "Delete user fail."; if (result == 1) { addUserList("User List", 2); pDetail.Controls.Clear(); messenger = "Delete user successful."; } frmMessager frm = new frmMessager("Messenger", messenger); frmOpacity.ShowDialog(this, frm); } } }
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); } } }
private void btnDelete_Click(object sender, EventArgs e) { frmConfirm frmm = new frmConfirm("Delete Printer?", "Do you want delete?"); frmm.ShowDialog(); if (frmm.DialogResult == System.Windows.Forms.DialogResult.OK) { int result = PrintService.DeletePrinter(PrinterMain); if (result == 1) { this.DialogResult = System.Windows.Forms.DialogResult.OK; } } }
private void btnDelete_Click(object sender, EventArgs e) { frmConfirm frmDelete = new frmConfirm("Account", "Do you want delete Account?"); frmDelete.ShowDialog(); if (frmDelete.DialogResult == System.Windows.Forms.DialogResult.OK) { itemS.Status = 0; int result = CustomerService.DeleteCustomer(itemS); if (result == 1) { LoadCustomer(); } } }
private void ucItemList_btnRemove_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Warning", "Do you want remove this item ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button product = (Button)sender; ProductionModel dataProduct = (ProductionModel)(product.Tag); var result = ProductService.Delete(dataProduct); if (result == 1) { addItemList("Item List", 3, this.CurrentPage); pnDetail.Controls.Clear(); frmMessager frm = new frmMessager("Messenger", "Delete product success"); frmOpacity.ShowDialog(this, frm); } } }
void btnSaveDepartment_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want save info role ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnSave = (Button)sender; DepartmentModel data = (DepartmentModel)(btnSave.Tag); var viewData = (UCDepartmentListDetail)pDetail.Controls[0]; if (data == null) { data = new DepartmentModel(); } data.DepartmentName = viewData.txtRoleName.Text ?? ""; if (data.DepartmentName != "") { data.UpdateBy = userid; var result = UserService.SaveDataDeparment(data); var messenger = "Save data role fail."; if (result == 1) { addDepartmentList("User Role", 1); messenger = "Save data Role successful."; } if (result == -1) { messenger = "Role name is exist. Please change role name."; } frmMessager frm = new frmMessager("Messenger", messenger); frmOpacity.ShowDialog(this, frm); } else { frmMessager frm = new frmMessager("Messenger", "Role name is't empty.Please input data."); frmOpacity.ShowDialog(this, frm); } } }
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); } } }
private void btnSave_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want edit info price of product ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btn = (Button)sender; PriceListModel dataPriceList = (PriceListModel)(btn.Tag); var txtPrice = txtProductPrice.Text; var txtName = txtProductName.Text; var comboColor = cbColor.Text; string message_error = ""; if (txtPrice == "") { message_error = "Price is not empty"; } if (txtName == "") { message_error = "Name is not empty"; } if (message_error == "") { dataPriceList.CurrentPrice = Convert.ToDouble(txtPrice) * 1000; dataPriceList.NameDesc = txtName; if (comboColor == "") { dataPriceList.Color = dataPriceList.Color; } else { dataPriceList.Color = comboColor; } var result = 0; if (dataPriceList.Type == "MODIFIRE") { ModifireModel modifire = new ModifireModel(); modifire.ModifireID = dataPriceList.ID; modifire.CurrentPrice = dataPriceList.CurrentPrice; modifire.ModifireName = dataPriceList.NameDesc; modifire.Color = dataPriceList.Color; result = ModifireService.Created(modifire); } else { ProductionModel product = new ProductionModel(); product.ProductID = dataPriceList.ID; product.CurrentPrice = dataPriceList.CurrentPrice; product.ProductNameDesc = dataPriceList.NameDesc; product.ProductNameSort = dataPriceList.NameSort; product.Color = dataPriceList.Color; result = ProductService.Created(product); } if (result == 1) { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { frmMessager frmMessager = new frmMessager("Edit Product Price", "Error"); frmOpacity.ShowDialog(this, frmMessager); this.Close(); } } else { frmMessager frmMessager = new frmMessager("Edit Product Price", message_error); frmOpacity.ShowDialog(this, frmMessager); } } }
void btnSaveUser_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want save info user ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnSave = (Button)sender; StaffModel data = (StaffModel)(btnSave.Tag); var viewData = (UCUserListDetail)pDetail.Controls[0]; if (data == null) { data = new StaffModel(); } data.Fname = viewData.txtFname.Text ?? ""; data.Lname = viewData.txtLname.Text ?? ""; data.UserName = viewData.txtUserName.Text ?? ""; data.Password = viewData.txtPinCode.Text ?? ""; var cbDepartment = (KeyValueModel)viewData.cbRole.SelectedItem; if (cbDepartment != null) { data.DepartmentID = cbDepartment.Key; } var messenger = ""; if (data.Fname == "") { messenger = messenger + "First Name isn't empty. "; } if (data.Lname == "") { messenger = messenger + "Last Name isn't empty. "; } if (data.UserName == "") { messenger = messenger + "User Name isn't empty. "; } if (data.Password == "") { messenger = messenger + "Pin Code isn't empty. "; } if (data.DepartmentID == 0) { messenger = messenger + "Please select role. "; } if (messenger == "") { data.UpdateBy = userid; var result = UserService.SaveDataStaff(data); messenger = "Save data role fail."; if (result == 1) { addUserList("User List", 2); messenger = "Save data info user successful."; } if (result == -1) { messenger = "User name is exist. Please change user name."; } frmMessager frm = new frmMessager("Messenger", messenger); frmOpacity.ShowDialog(this, frm); } else { frmMessager frm = new frmMessager("Messenger", messenger + "Please input data."); frmOpacity.ShowDialog(this, frm); } } }
void btnSaveUser_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want save info user ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btnSave = (Button)sender; StaffModel data = (StaffModel)(btnSave.Tag); var viewData = (UCUserListDetail)pDetail.Controls[0]; if (data == null) { data = new StaffModel(); } data.Fname = viewData.txtFname.Text ?? ""; data.Lname = viewData.txtLname.Text ?? ""; data.UserName = viewData.txtUserName.Text ?? ""; data.Password = viewData.txtPinCode.Text ?? ""; var cbDepartment = (KeyValueModel)viewData.cbRole.SelectedItem; if (cbDepartment != null) { data.DepartmentID = cbDepartment.Key; } var messenger = ""; if (data.Fname == "") messenger = messenger + "First Name isn't empty. "; if (data.Lname == "") messenger = messenger + "Last Name isn't empty. "; if (data.UserName == "") messenger = messenger + "User Name isn't empty. "; if (data.Password == "") messenger = messenger + "Pin Code isn't empty. "; if (data.DepartmentID == 0) messenger = messenger + "Please select role. "; if (messenger == "") { data.UpdateBy = userid; var result = UserService.SaveDataStaff(data); messenger = "Save data role fail."; if (result == 1) { addUserList("User List", 2); messenger = "Save data info user successful."; } if (result == -1) { messenger = "User name is exist. Please change user name."; } frmMessager frm = new frmMessager("Messenger", messenger); frmOpacity.ShowDialog(this, frm); } else { frmMessager frm = new frmMessager("Messenger", messenger + "Please input data."); frmOpacity.ShowDialog(this, frm); } } }
private void btnCancelOrder_Click(object sender, EventArgs e) { try { if (OrderMain.ListOrderDetail.Count > 0) { frmConfirm frm = new frmConfirm("Order", "Are You sure CANCEL ORDER???"); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { int result = OrderService.CancelOrder(OrderMain); if (result == 1) { CallBackStatusOrderCancel(); this.Close(); } } } } catch (Exception ex) { LogPOS.WriteLog("frmOrder:::::::::::::::::btnCancelOrder_Click:::::::::::::::::::" + ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { frmConfirm frmcon = new frmConfirm("Messenger", "Do you want edit info price of product ?"); frmcon.ShowDialog(); if (frmcon.DialogResult == System.Windows.Forms.DialogResult.OK) { Button btn = (Button)sender; PriceListModel dataPriceList = (PriceListModel)(btn.Tag); var txtPrice = txtProductPrice.Text; var txtName = txtProductName.Text; var comboColor = cbColor.Text; string message_error = ""; if (txtPrice == "") { message_error = "Price is not empty"; } if (txtName == "") { message_error = "Name is not empty"; } if (message_error == "") { dataPriceList.CurrentPrice = Convert.ToDouble(txtPrice)*1000; dataPriceList.NameDesc = txtName; if(comboColor == ""){ dataPriceList.Color = dataPriceList.Color; } else { dataPriceList.Color = comboColor; } var result = 0; if (dataPriceList.Type == "MODIFIRE") { ModifireModel modifire = new ModifireModel(); modifire.ModifireID = dataPriceList.ID; modifire.CurrentPrice = dataPriceList.CurrentPrice; modifire.ModifireName = dataPriceList.NameDesc; modifire.Color = dataPriceList.Color; result = ModifireService.Created(modifire); } else { ProductionModel product = new ProductionModel(); product.ProductID = dataPriceList.ID; product.CurrentPrice = dataPriceList.CurrentPrice; product.ProductNameDesc = dataPriceList.NameDesc; product.ProductNameSort = dataPriceList.NameSort; product.Color = dataPriceList.Color; result = ProductService.Created(product); } if (result == 1) { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { frmMessager frmMessager = new frmMessager("Edit Product Price", "Error"); frmOpacity.ShowDialog(this, frmMessager); this.Hide(); } } else { frmMessager frmMessager = new frmMessager("Edit Product Price", message_error); frmOpacity.ShowDialog(this, frmMessager); } } }