/// <summary> /// Hủy Order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancel_Click(object sender, EventArgs e) { try { if (oBL.CheckSendKitchenOrder(OrderID)) { MessageBoxCommon.ShowExclamation("Order đã gửi bếp không thể hủy"); return; } int result = 1; string cancelDescription = ""; { if (MessageBoxCommon.ShowYesNoQuestion_Cancel(EnumCancelAction.Booking, out cancelDescription) == DialogResult.Yes) { DictionaryDataSet.OrderRow drObjectChange = (DictionaryDataSet.OrderRow)ShareDictionary.DsDictionary.Order.FindByOrderID(OrderID); if (drObjectChange != null) { drObjectChange.CancelReason = cancelDescription; drObjectChange.CancelEmployeeID = Session.UserLogin.EmployeeID; drObjectChange.OrderStatus = (int)EnumOrderStatus.Cancel; result = oBL.InsertUpdateObject(QuizBit.Contract.CommonFunction.GetItem <Order>(drObjectChange)); if (result > 0) { OrderStatus = EnumOrderStatus.Cancel; } } } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Yêu cầu thanh toán /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPayment_Click(object sender, EventArgs e) { try { if (!oBL.CheckSendKitchenOrder(OrderID)) { MessageBoxCommon.ShowExclamation("Order chưa được phục vụ món ăn nào nên không thể thanh toán"); return; } using (var frm = new FrmInvoice()) { frm.FormActionMode = ActionMode.AddNew; frm.OrderID = OrderID; frm.SAInvoiceID = OrderID; if (frm.ShowDialog() == DialogResult.OK) { this.OrderStatus = EnumOrderStatus.Done; this.OnClick(e); } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private bool ValidateForm() { if (string.IsNullOrEmpty(txtName.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtName.Tag)); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(txtEmail.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtEmail.Tag)); txtEmail.Focus(); return(false); } if (string.IsNullOrEmpty(txtHotline.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtHotline.Tag)); txtHotline.Focus(); return(false); } if (string.IsNullOrEmpty(txtWebsite.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtWebsite.Tag)); txtWebsite.Focus(); return(false); } if (string.IsNullOrEmpty(txtAddress.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtAddress.Tag)); txtAddress.Focus(); return(false); } return(true); }
/// <summary> /// Hủy Order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancelOrder_Click(object sender, EventArgs e) { try { if (IsSendKitchen) { MessageBoxCommon.ShowExclamation("Order đã có món gửi bếp nên không thể hủy Order."); return; } int result = 1; string cancelDescription = ""; if (MessageBoxCommon.ShowYesNoQuestion_Cancel(EnumCancelAction.Booking, out cancelDescription) == DialogResult.Yes) { DictionaryDataSet.OrderRow drObjectChange = (DictionaryDataSet.OrderRow)CurrentRow; if (drObjectChange != null) { drObjectChange.CancelReason = cancelDescription; drObjectChange.OrderStatus = (int)EnumOrderStatus.Cancel; drObjectChange.CancelEmployeeID = Session.UserLogin.EmployeeID; result = objBLDetail.InsertUpdateObject(QuizBit.Contract.CommonFunction.GetItem <Order>(drObjectChange)); if (result > 0) { OrderStatus = EnumOrderStatus.Cancel; DialogResult = DialogResult.OK; } } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Load lại danh sách bàn theo Khu vực /// </summary> private void LoadTableMapping() { if (cboArea.Value == null) { return; } Guid areaID; if (!Guid.TryParse(cboArea.Value.ToString(), out areaID)) { return; } var tableMapping = new BLArea().GetTableMappingByAreaID(areaID, dteFromTime.DateTime); if (tableMapping == null || tableMapping.Rows.Count == 0) { MessageBoxCommon.ShowExclamation("Khu vực <" + ((Desktop.Entity.DictionaryDataSet.AreaRow)((System.Data.DataRowView)bsArea.Current).Row).AreaName + "> ngày <" + dteFromTime.DateTime.ToString("dd-MM-yyyy") + "> không có bàn trống nên không thể thay đổi khu vực"); return; } else { dsBusiness.AreaTableMapping.Clear(); dsBusiness.AreaTableMapping.Merge(tableMapping); bsTableMapping.DataSource = dsBusiness; bsTableMapping.Filter = "TableStatus = 0 OR (TableStatus = 2 AND TableID = " + "'" + TableID.ToString() + "' AND BookingID = '" + BookingID.ToString() + "')"; if (bsTableMapping.Find(ColumnName.TableID, TableID) == -1) { cboTableMapping.Value = ((Desktop.Entity.BusinessDataSet.AreaTableMappingRow)dsBusiness.AreaTableMapping.Rows[0]).TableID; } else { cboTableMapping.Value = TableID; } } }
protected void ControlComboEditor_ItemNotInList(object sender, ValidationErrorEventArgs e) { try { UltraComboEditor control = (UltraComboEditor)sender; if (string.IsNullOrEmpty(control.Text.Trim())) { return; } // Tiếp tục Focus vào control có giá trị nhập sai e.RetainFocus = true; // Thông báo lỗi dữ liệu nhập MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Error_Input_Dropdown, control.Tag)); if (e.LastValidValue != null) { control.Value = e.LastValidValue; } else { control.SelectedIndex = 0; } control.SelectAll(); control.DropDown(); } catch (Exception ex) { #if Debug MessageBoxCommon.ShowException(ex); #endif } }
/// <summary> /// Thêm món ăn vào Order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Food_Click(object sender, EventArgs e) { try { if (OrderStatus == EnumOrderStatus.Cancel) { MessageBoxCommon.ShowExclamation("Order đã hủy không thể thêm món ăn"); return; } UctFood control = (UctFood)sender; if (control != null) { var uct = CreateUctChooseFood(control.DataInventoryItemRow); if (uct != null) { fpnlChooseFood.Controls.Add(uct); TotalAmount += uct.UnitPrice * uct.Quantity; } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnSaveAdd_Click(object sender, EventArgs e) { try { if (!ValidateForm()) { return; } if (!CheckCodeIsExists()) { return; } if (SaveData() == (int)EnumResultInsertUpdate.Success) { DsDictionary.AcceptChanges(); // Khởi tạo dòng mới FormActionMode = ActionMode.AddNew; LoadDataForm(); } else if (SaveData() == (int)EnumResultInsertUpdate.DuplicateCode) { MessageBoxCommon.ShowExclamation("Trùng mã"); } else if (SaveData() == (int)EnumResultInsertUpdate.Failed) { MessageBoxCommon.ShowExclamation("Lưu dữ liệu thất bại"); } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Thêm đặt bàn /// </summary> private void AddBooking() { if (TableStatus != EnumTableStatus.Empty) { MessageBoxCommon.ShowExclamation("Bàn đã sử dụng không thể thêm Đặt bàn"); return; } using (FrmBookingDetail frm = new FrmBookingDetail()) { frm.FormActionMode = ActionMode.AddNew; frm.DsDictionary = new DictionaryDataSet(); frm.BsDetail.DataSource = frm.DsDictionary; frm.TableID = TableID; if (frm.ShowDialog() == DialogResult.OK) { //if (frm.BookingStatus == EnumBookingStatus.Receiver || frm.BookingStatus == EnumBookingStatus.Cancel) //{ // Empty(); //} //else if (frm.BookingStatus == EnumBookingStatus.Booked) //{ // TableStatus = EnumTableStatus.Booking; // if (frm.DsDictionary.Booking.Rows.Count > 0) // { // var row = (Desktop.Entity.DictionaryDataSet.BookingRow)frm.DsDictionary.Booking.Rows[0]; // BookingID = row.BookingID; // FromTime = row.FromTime; // } //} } } }
private void btnAccept_Click(object sender, EventArgs e) { try { //if (!CommonFunction.CheckNetWork()) return; var connect = CloudLibrary.CreateServiceConnection(); Session.Token = connect.Login(txtUserName.Text, txtPassword.Text); if (!string.IsNullOrEmpty(Session.Token)) { Session.UserLogin = connect.GetUserLogin(txtUserName.Text, txtPassword.Text); if (Session.UserLogin.RoleName.Contains("Chạy bàn") || Session.UserLogin.RoleName.Contains("Nhân viên bếp")) { MessageBoxCommon.ShowExclamation("Bạn không có quyền để sử dụng chức năng này."); } else { DialogResult = DialogResult.OK; } } else { MessageBoxCommon.ShowExclamation("Tài khoản hoặc mật khẩu không chính xác."); } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
protected override bool ValidateForm() { if (!base.ValidateForm()) { return(false); } if (string.IsNullOrEmpty(txtAreaName.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtAreaName.Tag)); txtAreaName.Focus(); return(false); } if (string.IsNullOrEmpty(txtNumberOfTable.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtNumberOfTable.Tag)); txtNumberOfTable.Focus(); return(false); } else { int table = 0; if (int.TryParse(txtNumberOfTable.Value.ToString(), out table)) { if (table <= 0) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control_More, txtNumberOfTable.Tag, "0")); txtNumberOfTable.Focus(); return(false); } } } return(true); }
protected override bool ValidateForm() { if (!base.ValidateForm()) { return(false); } if (string.IsNullOrEmpty(txtUnitName.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtUnitName.Tag)); txtUnitName.Focus(); return(false); } return(true); }
private void btnSave_Click(object sender, EventArgs e) { try { if (!ValidateForm()) { return; } if (!CheckCodeIsExists()) { return; } var result = SaveData(); if (result == (int)EnumResultInsertUpdate.Success) { //if (BsDetail.DataMember != "Order") //{ DsDictionary.AcceptChanges(); DialogResult = DialogResult.OK; //} } else if (result == (int)EnumResultInsertUpdate.DuplicateCode) { if (CurrentRow.Table == DsDictionary.Area || CurrentRow.Table == DsDictionary.Unit) { MessageBoxCommon.ShowExclamation("Trùng tên"); } else { MessageBoxCommon.ShowExclamation("Trùng mã"); } } else if (result == (int)EnumResultInsertUpdate.Failed) { MessageBoxCommon.ShowExclamation("Lưu dữ liệu thất bại"); } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnSendKitchen_Click(object sender, EventArgs e) { try { int countSendKitchen = 0; var oBLSendKitchen = new BLSendKitchen(); foreach (var item in fpnlChooseFood.Controls) { if (item.GetType() == typeof(UctChooseFood)) { UctChooseFood uct = (UctChooseFood)item; if (!uct.IsSendKitchen) { countSendKitchen++; // Insert To SendKitchen var sendKitchenRow = oBLSendKitchen.InitNewRow(dsDictionary.SendKitchen, uct.OrderDetailRow.OrderDetailID); oBLSendKitchen.InsertUpdate(sendKitchenRow); // Update detail uct.OrderDetailRow.OrderDetailStatus = (int)EnumOrderDetailStatus.Served; uct.IsSendKitchen = true; } } } if (SaveData() > 0) { FormActionMode = ActionMode.Edit; DsDictionary.AcceptChanges(); } if (countSendKitchen == 0) { MessageBoxCommon.ShowExclamation("Không có món nào mới để gửi bếp."); } else { IsSendKitchen = true; } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Thêm Order /// </summary> private void AddOrder() { if (TableStatus == EnumTableStatus.Using) { MessageBoxCommon.ShowExclamation("Bàn đã sử dụng không thể thêm Order"); return; } using (FrmOrderDetail frm = new FrmOrderDetail()) { if (TableStatus == EnumTableStatus.Booking) { frm.BookingID = BookingID; } frm.FormActionMode = ActionMode.AddNew; frm.DsDictionary = new DictionaryDataSet(); frm.BsDetail.DataSource = frm.DsDictionary; frm.TableID = TableID; if (frm.ShowDialog() == DialogResult.OK || frm.IsSendKitchen) { //if (TableStatus == EnumTableStatus.Booking) //{ // new Desktop.BL.BLBooking().ChangeBookingStatus(BookingID, (int)EnumBookingStatus.Receiver); //} //if (frm.OrderStatus == EnumOrderStatus.Cancel || frm.OrderStatus == EnumOrderStatus.Done) //{ // Empty(); //} //else if (frm.OrderStatus == EnumOrderStatus.Ordering || frm.OrderStatus == EnumOrderStatus.WaitPay) //{ // TableStatus = EnumTableStatus.Using; // if (frm.DsDictionary.Order.Rows.Count > 0) // { // var row = (Desktop.Entity.DictionaryDataSet.OrderRow)frm.DsDictionary.Order.Rows[0]; // OrderID = row.OrderID; // OrderDate = row.OrderDate; // } //} } } }
private void txtQuantity_Validating(object sender, CancelEventArgs e) { if (string.IsNullOrEmpty(txtQuantity.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtQuantity.Tag)); txtQuantity.Focus(); return; } else { int table = 0; if (int.TryParse(txtQuantity.Value.ToString(), out table)) { if (table <= 0) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control_More, txtQuantity.Tag, "0")); txtQuantity.Focus(); return; } } } }
protected override int SaveData() { int result = 1; int resultAccount = 0; bool checkAccount = false; BsDetail.EndEdit(); if (!string.IsNullOrEmpty(txtUserName.Text) && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtCofirmPassword.Text)) { if (txtPassword.Text != txtCofirmPassword.Text) { MessageBoxCommon.ShowExclamation("Mật khẩu xác nhận không khớp. Vui lòng kiểm tra lại."); return(0); } checkAccount = true; } //var tableChanged = dsDictionary.Employee.GetChanges(); //if (tableChanged == null) //{ // return (int)EnumResultInsertUpdate.Success; //} //else //{ // if (tableChanged.Rows.Count == 0) // return (int)EnumResultInsertUpdate.Success; //} System.Data.DataRow drObjectChange = ((System.Data.DataRowView)bsDetail.Current).Row; if (drObjectChange != null) { ((Desktop.Entity.DictionaryDataSet.EmployeeRow)drObjectChange).IdentifyNumberIssuedDate = DateTime.Now; result = objBLDetail.InsertUpdate(drObjectChange); if (result == 1 && checkAccount) { DictionaryDataSet.UserDataTable table = new DictionaryDataSet.UserDataTable(); Guid userID = Guid.Empty; Guid UserJoinRoleID = Guid.NewGuid(); if (FormActionMode == ActionMode.AddNew) { DictionaryDataSet.UserRow drUser = table.NewUserRow(); drUser.UserID = Guid.NewGuid(); drUser.UserName = txtUserName.Text; drUser.Password = EncryptUtil.MD5Hash(txtPassword.Text); drUser.DisplayName = txtEmployeeName.Text; drUser.ChangedPasswordTime = DateTime.Now; drUser.Inactive = false; drUser.EmployeeID = ((Desktop.Entity.DictionaryDataSet.EmployeeRow)drObjectChange).EmployeeID; resultAccount = objBLDetail.InsertUpdateUser(drUser); userID = drUser.UserID; UserJoinRoleID = drUser.UserJoinRoleID; } else { DataRow drUser = dsDictionary.User.FindByUserID(userID); resultAccount = objBLDetail.InsertUpdateUser(drUser); userID = ((Desktop.Entity.DictionaryDataSet.UserRow)drUser).UserID; UserJoinRoleID = ((Desktop.Entity.DictionaryDataSet.UserRow)drUser).UserJoinRoleID; } if (resultAccount == 1) { DictionaryDataSet.UserJoinRoleDataTable tableRole = new DictionaryDataSet.UserJoinRoleDataTable(); if (FormActionMode == ActionMode.AddNew) { DictionaryDataSet.UserJoinRoleRow drRole = tableRole.NewUserJoinRoleRow(); drRole.UserID = userID; drRole.UserJoinRoleID = Guid.NewGuid(); if (rbAdmin.Checked) { drRole.RoleID = 0; } else if (rbBep.Checked) { drRole.RoleID = 5; } else if (rbLeTan.Checked) { drRole.RoleID = 3; } else if (rbPV.Checked) { drRole.RoleID = 2; } objBLDetail.InsertUpdateRole(drRole); } else { DataRow drRole = dsDictionary.UserJoinRole.FindByUserJoinRoleID(UserJoinRoleID); if (rbAdmin.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 0; } else if (rbBep.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 5; } else if (rbLeTan.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 3; } else if (rbPV.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 2; } resultAccount = objBLDetail.InsertUpdateUser(drRole); } } } } return(result); }
protected override bool ValidateForm() { if (!base.ValidateForm()) { return(false); } if (string.IsNullOrEmpty(txtBookingNo.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtBookingNo.Tag)); txtBookingNo.Focus(); return(false); } if (txtNumberOfPeople.Text == ".., ") { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtNumberOfPeople.Tag)); txtNumberOfPeople.Focus(); return(false); } if (dteBookingDate.Value == null) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, dteBookingDate.Tag)); dteBookingDate.Focus(); return(false); } if (string.IsNullOrEmpty(cboArea.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, cboArea.Tag)); cboArea.Focus(); return(false); } if (string.IsNullOrEmpty(cboTableMapping.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, cboTableMapping.Tag)); cboTableMapping.Focus(); return(false); } if (string.IsNullOrEmpty(cboCustomerID.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, cboCustomerID.Tag)); cboCustomerID.Focus(); return(false); } if (string.IsNullOrEmpty(txtNumberOfPeople.Text.Trim())) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, txtNumberOfPeople.Tag)); txtNumberOfPeople.Focus(); return(false); } else { int table = 0; if (int.TryParse(txtNumberOfPeople.Value.ToString(), out table)) { if (table <= 0) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control_More, txtNumberOfPeople.Tag, "0")); txtNumberOfPeople.Focus(); return(false); } } } if (dteBookingDate.Value == null) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, dteBookingDate.Tag)); dteBookingDate.Focus(); return(false); } if (dteFromTime.Value == null) { MessageBoxCommon.ShowExclamation(string.Format(Properties.Resources.Message_Validate_Control, dteFromTime.Tag)); dteFromTime.Focus(); return(false); } return(true); }