private void btn_Update_Click(object sender, EventArgs e) { String name_update = txt_Name.Text; //String Id = txt_Id.Text; int Id = (int)dgv_Table.GetRowCellValue(dgv_Table.FocusedRowHandle, grdcol_Id); // bool status_update = ckb_Status.Checked ? true : false; if (Id != -1) { FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Table.Instance.UpdateTable(Id, name_update)) { DeleteBinding(); SetView(); FormMessageBox form = new FormMessageBox("Cập nhật thành công!"); form.ShowDialog(); } else { FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } } else { FormMessageBox form = new FormMessageBox("Vui lòng chọn bàn ăn muốn cập nhật"); form.ShowDialog(); } }
private void btn_Update_Click(object sender, EventArgs e) { int Id = Id_Employee; string name_Update = txt_Name.Text; DateTime birthday_Update = de_Birthday.DateTime.Date; bool gender_Update = rbtn_Male.Checked ? true : false; string address_Update = txt_Address.Text; string phone_Update = txt_Phone.Text; if (name_Update != "") { FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Employee.Instance.Update_DAL(Convert.ToInt32(Id), name_Update, birthday_Update, gender_Update, address_Update, phone_Update)) { FormMessageBox form = new FormMessageBox("Cập nhật thành công!"); form.ShowDialog(); } else { FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } } else { FormMessageBox form = new FormMessageBox("Không thể tải dữ liệu của bạn! Không thể cập nhật"); form.ShowDialog(); } }
private void btn_Update_Click(object sender, EventArgs e) { String name_update = txt_Name.Text; String Id = txt_Id.Text; if (Id != "") { FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Category.Instance.Update_DAL(Convert.ToInt32(Id), name_update)) { DeleteBinding(); SetView(); FormMessageBox form = new FormMessageBox("Cập nhật thành công!"); form.ShowDialog(); } else { FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } } else { FormMessageBox form = new FormMessageBox("Vui lòng chọn loại món muốn cập nhật"); form.ShowDialog(); } }
private void btnDel_Click(object sender, EventArgs e) { List <int> list_Dell = new List <int>(); int[] selectedRows = dgv_Item.GetSelectedRows(); foreach (int rowHandle in selectedRows) { if (rowHandle >= 0) { object cellValue = dgv_Item.GetRowCellValue(rowHandle, grdcol_IdItem); list_Dell.Add((int)cellValue); } } FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { for (int i = 0; i < list_Dell.Count; ++i) { if (BUS_Bill.Instance.DelBill(list_Dell[i])) { LoadBillDetail(); FormMessageBox formMessageBox = new FormMessageBox("Xóa thành công!"); } else { FormMessageBox form = new FormMessageBox("Xóa thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } } }
private void btn_Update_Click(object sender, EventArgs e) { string username = txt_Username.Text; // Lôi không có giá, nó tự load lại giá cũ int focusedRow = 0; try { focusedRow = dgv_Account.FocusedRowHandle; } catch { } int IDAccount = (int)dgv_Account.GetRowCellValue(dgv_Account.FocusedRowHandle, grdcol_Id); FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Account.Instance.CheckExistUserName(username)) { new FormMessageBox("Tên đăng nhập đã tồn tại, vui lòng thử tên khác").ShowDialog(); } else { string name = txt_Name.Text; string phone = txt_Phone.Text; string name_Type = ""; int Id_Type = 0; if (cbb_TypeAccountDe.SelectedItem != null) { name_Type = cbb_TypeAccountDe.SelectedItem.ToString(); } foreach (CBBItem i in cbb_TypeAccountDe.Items) { if (i.Text == name_Type) { Id_Type = i.Value; break; } } if (BUS_Account.Instance.UpdateAccount(IDAccount, name, phone, username, Id_Type)) { DeleteBinding(); SetView(); FormMessageBox form = new FormMessageBox("Cập nhật thành công!"); form.ShowDialog(); LoadBinding(); dgv_Account.FocusedRowHandle = focusedRow; dgv_Account.SelectRow(focusedRow); dgv_Account.Focus(); } else { FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } } }
private void bbi_Exit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn thoát?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { this.Close(); } }
private void btnChangeMerge_Click(object sender, EventArgs e) { int IDTable1 = (int)(cbbTable1.SelectedItem as CbbItem).Key; int IDTable2 = (int)(cbbTable2.SelectedItem as CbbItem).Key; int IDBill1 = BUS_Bill.Instance.GetIDBillByIDTable(IDTable1); int IDBill2 = BUS_Bill.Instance.GetIDBillByIDTable(IDTable2); if (IDBill1 == 0) { new FormMessageBox("Bàn bạn muốn thao tác hiện đang hiện đang trống, không thể thực hiện").ShowDialog(); } else { if (IDBill2 == 0) { FormYesNoBox f = new FormYesNoBox("Bạn sẽ chuyển " + (cbbTable1.SelectedItem as CbbItem).Value.ToString() + " đến " + (cbbTable2.SelectedItem as CbbItem).Value.ToString()); f.ShowDialog(); if (f.GetValue() == 1) { if (BUS_Table.Instance.UpdateIDTableOfBillByIDTable(IDTable1, IDTable2)) { showBill((int)dtgvBill.Tag); LoadPnTable(); new FormMessageBox("Chuyển bàn thành công").ShowDialog(); } else { new FormMessageBox("Chuyển bàn không thành công").ShowDialog(); } } } else { FormYesNoBox f = new FormYesNoBox("Bạn sẽ gộp " + (cbbTable1.SelectedItem as CbbItem).Value.ToString() + " vào " + (cbbTable2.SelectedItem as CbbItem).Value.ToString()); f.ShowDialog(); if (f.GetValue() == 1) { if (BUS_Bill.Instance.UpdateIDBillOfBillInfoByIDBill(IDTable1, IDTable2)) { showBill((int)dtgvBill.Tag); LoadPnTable(); new FormMessageBox("Gộp bàn thành công").ShowDialog(); } else { new FormMessageBox("Gộp bàn không thành công").ShowDialog(); } } } } }
private void btn_Delete_Click(object sender, EventArgs e) { List <int> list_Dell = new List <int>(); int[] selectedRows = dgv_Item.GetSelectedRows(); int id = -1; try { id = (int)dgv_Item.GetRowCellValue(dgv_Item.FocusedRowHandle, grdcol_IdItem); } catch { id = -1; } if (id != -1) { foreach (int rowHandle in selectedRows) { if (rowHandle >= 0) { object cellValue = dgv_Item.GetRowCellValue(rowHandle, grdcol_IdItem); list_Dell.Add((int)cellValue); } } FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Item.Instance.Delete_DAL(list_Dell)) { FormMessageBox formMessageBox = new FormMessageBox("Xóa thành công!"); DeleteBinding(); SetView(); formMessageBox.ShowDialog(); } else { FormMessageBox formMessageBox = new FormMessageBox("Xóa thất bại! Vui lòng kiểm tra lại dữ liệu!"); formMessageBox.ShowDialog(); } } } else { FormMessageBox form = new FormMessageBox("Vui lòng chọn món muốn xóa!"); form.ShowDialog(); } }
private void btn_Update_Click(object sender, EventArgs e) { int focusedRow = dgv_Employee.FocusedRowHandle; // String Id = txt_Id.Text; string name_Update = txt_Name.Text; DateTime birthday_Update = de_Birthday.DateTime.Date; bool gender_Update = rbtn_Male.Checked ? true : false; string address_Update = txt_Address.Text; string phone_Update = txt_Phone.Text; int id = -1; try { id = (int)dgv_Employee.GetRowCellValue(dgv_Employee.FocusedRowHandle, grdcol_IdEmployee); } catch { id = -1; } if (id != -1) { FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Employee.Instance.Update_DAL(id, name_Update, birthday_Update, gender_Update, address_Update, phone_Update)) { DeleteBinding(); SetView(); LoadBinding(); dgv_Employee.FocusedRowHandle = focusedRow; dgv_Employee.SelectRow(focusedRow); dgv_Employee.Focus(); FormMessageBox form = new FormMessageBox("Cập nhật thành công!"); form.ShowDialog(); } else { FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } } else { FormMessageBox form = new FormMessageBox("Vui lòng chọn nhân viên muốn cập nhật"); form.ShowDialog(); } }
private void btnPay_Click(object sender, EventArgs e) { FormYesNoBox f = new FormYesNoBox("Bạn chắc chắn muốn thanh toán cho bàn " + BUS_Table.Instance.GetNameTableByIDTable((int)dtgvBill.Tag)); f.ShowDialog(); if (f.GetValue() == 1) { if (BUS_Bill.Instance.Pay((int)dtgvBill.Tag)) { showBill((int)dtgvBill.Tag); LoadTotalPrice((int)dtgvBill.Tag); new FormMessageBox("Thanh toán thành công").ShowDialog(); LoadPnTable(); } else { new FormMessageBox("Thanh toán không thành công").ShowDialog(); } } }
private void btn_Delete_Click(object sender, EventArgs e) { List <int> list_Dell = new List <int>(); int[] selectedRows = dgv_Table.GetSelectedRows(); if (txt_Id.Text != "") { foreach (int rowHandle in selectedRows) { if (rowHandle >= 0) { object cellValue = dgv_Table.GetRowCellValue(rowHandle, grdcol_Id); list_Dell.Add((int)cellValue); } } FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Table.Instance.Delete_DAL(list_Dell)) { FormMessageBox form = new FormMessageBox("Xóa thành công!"); form.ShowDialog(); DeleteBinding(); SetView(); } else { FormMessageBox form = new FormMessageBox("Xóa thất bại! Vui lòng kiểm tra lại!"); form.ShowDialog(); } } } else { FormMessageBox form = new FormMessageBox("Vui lòng chọn bàn ăn muốn xóa!"); form.ShowDialog(); } }
private void btn_Delete_Click(object sender, EventArgs e) { int IDAccount = (int)dgv_Account.GetRowCellValue(dgv_Account.FocusedRowHandle, grdcol_Id); FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn xóa?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (BUS_Account.Instance.DeleteAccount(IDAccount)) { FormMessageBox formMessageBox = new FormMessageBox("Xóa thành công!"); DeleteBinding(); SetView(); formMessageBox.ShowDialog(); } } else { FormMessageBox form = new FormMessageBox("Vui lòng chọn tài khoản muốn xóa!"); form.ShowDialog(); } }
private void btn_Update_Click(object sender, EventArgs e) { // Lôi không có giá, nó tự load lại giá cũ //string Id = txt_Id.Text; int focusedRow = -1; try { focusedRow = dgv_Item.FocusedRowHandle; } catch { } int id = -1; try { id = (int)dgv_Item.GetRowCellValue(dgv_Item.FocusedRowHandle, grdcol_IdItem); } catch { id = -1; } string name_Update = txt_Name.Text; string name_Category = ""; string price_Item = txt_Price.Text; int price_Update = 0; int Id_Category_Update = 0; if (cbb_CategoryDetail.SelectedItem != null) { name_Category = cbb_CategoryDetail.SelectedItem.ToString(); } if (price_Item != "") { price_Update = Convert.ToInt32(price_Item); } foreach (CBBItem i in cbb_Category.Items) { if (i.Text == name_Category) { Id_Category_Update = i.Value; break; } } if (id != -1) { FormYesNoBox formYesNoBox = new FormYesNoBox("Bạn chắc chắn muốn cập nhật?"); formYesNoBox.ShowDialog(); if (formYesNoBox.GetValue() == 1) { if (price_Update != 0) { if (BUS_Item.Instance.Update_DAL(id, name_Update, Id_Category_Update, price_Update)) { DeleteBinding(); SetView(); LoadBinding(); dgv_Item.FocusedRowHandle = focusedRow; dgv_Item.SelectRow(focusedRow); dgv_Item.Focus(); FormMessageBox form = new FormMessageBox("Cập nhật thành công!"); form.ShowDialog(); } else { FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } else { FormMessageBox form = new FormMessageBox("Cập nhật thất bại! Vui lòng kiểm tra lại dữ liệu"); form.ShowDialog(); } } } else { FormMessageBox form = new FormMessageBox("Vui lòng chọn loại món muốn cập nhật"); form.ShowDialog(); } }