/// <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); } }
private void FrmInvoice_Load(object sender, EventArgs e) { try { dsDictionary.EnforceConstraints = false; BLOrder oBL = new BLOrder(); var table = oBL.GetDataByID(SAInvoiceID); if (table.Rows.Count <= 0) { BLSAInvoice oBLSAInvoice = new BLSAInvoice(); table = oBLSAInvoice.GetDataByID(SAInvoiceID); // Nếu tạo mới từ Order if (SAInvoiceID != Guid.Empty) { btnSave.Visible = true; dsDictionary.Clear(); dsDictionary.SAInvoice.Merge(oBLSAInvoice.GetDataByID(SAInvoiceID), false, MissingSchemaAction.Ignore); dsDictionary.SAInvoiceDetail.Merge(oBLSAInvoice.GetDataDetailByID(SAInvoiceID), false, MissingSchemaAction.Ignore); CreateSAInvoice(); } // Nếu không phải tạo mới thì load dữ liệu else { btnSave.Visible = false; LoadSAInvoice(); } } else { // Nếu tạo mới từ Order if (SAInvoiceID != Guid.Empty) { btnSave.Visible = true; dsDictionary.Clear(); dsDictionary.Order.Merge(oBLOrder.GetDataByID(SAInvoiceID), false, MissingSchemaAction.Ignore); dsDictionary.OrderDetail.Merge(oBLOrder.GetDataDetailByID(SAInvoiceID), false, MissingSchemaAction.Ignore); CreateSAInvoice(); } // Nếu không phải tạo mới thì load dữ liệu else { btnSave.Visible = false; LoadSAInvoice(); } } if (table != null && table.Rows.Count > 0) { SAInvoiceRow = dsDictionary.SAInvoice.FirstOrDefault(); dsDictionary.Customer.Merge(new BLCustomer().GetDataByID(Guid.Parse(table.Rows[0][5].ToString()))); CustomerRow = dsDictionary.Customer.FindByCustomerID(Guid.Parse(table.Rows[0][5].ToString())); } BindingData(table); } 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 void grdList_MouseDoubleClick(object sender, MouseEventArgs e) { try { var mousePoint = new Point(e.X, e.Y); var element = grdList.DisplayLayout.UIElement.ElementFromPoint(mousePoint); UltraGridRow row = null; row = (UltraGridRow)element.GetContext(typeof(UltraGridRow)); if (row != null) { if (row.Index >= 0) { using (var frm = new FrmInvoice()) { frm.SAInvoiceID = Guid.Parse(row.Cells[ColumnName.RefID].Text); frm.ShowDialog(); } } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnChooseImage_Click(object sender, EventArgs e) { try { // image filters openFileDialog.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp"; if (openFileDialog.ShowDialog() == DialogResult.OK) { // display image in picture box imgFileResource.Image = new Bitmap(openFileDialog.FileName); try { using (Image img = Image.FromFile(openFileDialog.FileName)) using (MemoryStream ms = new MemoryStream()) { img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); ms.Close(); ((DictionaryDataSet.InventoryItemRow)CurrentRow).FileResource = ms.ToArray(); } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Hủy đặt bàn /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancelBooking_Click(object sender, EventArgs e) { try { int result = 1; string cancelDescription = ""; if (MessageBoxCommon.ShowYesNoQuestion_Cancel(EnumCancelAction.Booking, out cancelDescription) == DialogResult.Yes) { DictionaryDataSet.BookingRow drObjectChange = (DictionaryDataSet.BookingRow)CurrentRow; if (drObjectChange != null) { drObjectChange.CancelDescription = cancelDescription; drObjectChange.BookingStatus = (int)EnumBookingStatus.Cancel; result = objBLDetail.InsertUpdateObject(QuizBit.Contract.CommonFunction.GetItem <Booking>(drObjectChange)); if (result > 0) { BookingStatus = EnumBookingStatus.Cancel; DialogResult = DialogResult.OK; } } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Nhận bàn /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnReceiveTable_Click(object sender, EventArgs e) { int result = 1; try { DictionaryDataSet.BookingRow drObjectChange = (DictionaryDataSet.BookingRow)CurrentRow; if (drObjectChange != null) { drObjectChange.BookingStatus = (int)EnumBookingStatus.Receiver; result = objBLDetail.InsertUpdateObject(QuizBit.Contract.CommonFunction.GetItem <Booking>(drObjectChange)); if (result > 0) { using (FrmOrderDetail frm = new FrmOrderDetail()) { frm.FormActionMode = ActionMode.AddNew; frm.DsDictionary = new DictionaryDataSet(); frm.BsDetail.DataSource = frm.DsDictionary; frm.TableID = TableID; frm.BookingID = BookingID; if (frm.ShowDialog() == DialogResult.OK || frm.IsSendKitchen) { BookingStatus = EnumBookingStatus.Receiver; DialogResult = DialogResult.OK; } } } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void grdList_KeyDown(object sender, KeyEventArgs e) { try { if (bsList != null) { if (bsList.Current != null) { if (e.KeyCode == Keys.Return) { if (grdList.ActiveRow != null && grdList.Selected.Rows.Count == 1) { if (grdList.ActiveRow.GetType() == typeof(UltraGridRow)) { Edit(); } } else { grdList.Rows[bsList.Position].Activate(); } } } } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <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 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 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 } }
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); } }
private void cboCustomerID_ValueChanged(object sender, EventArgs e) { try { Guid id = Guid.Empty; if (cboCustomerID.Value == null) { lblCustomerName.Text = ""; lblCustomerMobile.Text = ""; lblCustomerAddress.Text = ""; return; } if (Guid.TryParse(cboCustomerID.Value.ToString(), out id)) { var row = dsDictionary.Customer.FindByCustomerID(Guid.Parse(cboCustomerID.Value.ToString())); //Desktop.Entity.DictionaryDataSet.CustomerRow cRow = lstRow lblCustomerName.Text = row.IsCustomerNameNull() ? "" : row.CustomerName; lblCustomerMobile.Text = row.IsMobileNull() ? "" : row.Mobile; lblCustomerAddress.Text = row.IsAddressNull() ? "" : row.Address; } else { lblCustomerName.Text = ""; lblCustomerMobile.Text = ""; lblCustomerAddress.Text = ""; } } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <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); } }
private void bgwRefreshData_DoWork(object sender, DoWorkEventArgs e) { try { } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void bgwRefreshData_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UctFood_Load(object sender, EventArgs e) { try { } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void tbrFunction_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { try { ToolbarClick(e.Tool.Key); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnCancel_Click(object sender, EventArgs e) { try { Close(); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void grdList_AfterRowActivate(object sender, EventArgs e) { try { ShowHideFunctionByData(); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnLoadInvoice_Click(object sender, EventArgs e) { try { LoadSAInvoice(dteInvoice.DateTime); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnLoadOrder_Click(object sender, EventArgs e) { try { LoadOrderPanel(); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnCancel_Click(object sender, EventArgs e) { try { DialogResult = DialogResult.No; } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void dteFromTime_ValueChanged(object sender, EventArgs e) { try { LoadTableMapping(); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void Table_DoubleClick(object sender, EventArgs e) { try { HandlerTableMapping(sender); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void TxtInventoryItemName_TextChanged(object sender, EventArgs e) { try { //txtInventoryItemNameNonUnicode.Text = CommonFunction.RemoveSignVietnameseString(txtInventoryItemName.Text); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Chuyển khu vực /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tabAreaTableMapping_SelectedTabChanged(object sender, SelectedTabChangedEventArgs e) { try { //LoadTableByAreaID(); ChangeAreaStatus(); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
/// <summary> /// Xóa khỏi Order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRemove_Click(object sender, EventArgs e) { try { IsRemove = true; this.OnClick(e); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void btnLoadArea_Click(object sender, EventArgs e) { try { LoadTableByAreaID(); ChangeAreaStatus(sender, e); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }
private void Table_Click(object sender, EventArgs e) { try { HandlerTableMapping(sender); ChangeAreaStatus(sender, e); } catch (Exception ex) { MessageBoxCommon.ShowException(ex); } }