/// <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> /// 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); } }
public DataRow InitNewRow(DictionaryDataSet.SAInvoiceDataTable table, DictionaryDataSet.OrderRow orderRow) { DictionaryDataSet.SAInvoiceRow drNewRow = table.NewSAInvoiceRow(); drNewRow.OrderID = Guid.NewGuid(); drNewRow.EmployeeID = Session.UserLogin.EmployeeID; drNewRow.CreatedDate = DateTime.Now; drNewRow.CreatedBy = Session.UserLogin.UserName; drNewRow.ModifiedDate = DateTime.Now; drNewRow.ModifiedBy = Session.UserLogin.UserName; table.Rows.InsertAt(drNewRow, 0); return(drNewRow); }
public DataRow InitNewRow(DictionaryDataSet.OrderDataTable table) { DictionaryDataSet.OrderRow drNewRow = table.NewOrderRow(); drNewRow.OrderID = Guid.NewGuid(); drNewRow.OrderNo = DateTime.Now.Year.ToString() + "." + GetNumberOrder(DateTime.Now.Year); drNewRow.OrderDate = DateTime.Now; drNewRow.OrderStatus = 0; drNewRow.NumberOfPeople = 1; drNewRow.EmployeeID = Session.UserLogin.EmployeeID; drNewRow.CreatedDate = DateTime.Now; drNewRow.CreatedBy = Session.UserLogin.UserName; drNewRow.ModifiedDate = DateTime.Now; drNewRow.ModifiedBy = Session.UserLogin.UserName; table.Rows.InsertAt(drNewRow, 0); return(drNewRow); }
/// <summary> /// Thêm mới món ăn /// </summary> /// <param name="inventoryItem"></param> /// <returns></returns> private UctChooseFood CreateUctChooseFood(DictionaryDataSet.InventoryItemRow inventoryItem) { DictionaryDataSet.OrderRow master = (DictionaryDataSet.OrderRow)dsDictionary.Order.FindByOrderID(OrderID); var row = dsDictionary.OrderDetail.FirstOrDefault((t) => t.RowState != DataRowState.Deleted && t.InventoryItemID == inventoryItem.InventoryItemID && t.OrderDetailStatus == (int)EnumOrderDetailStatus.Ordering); if (row != null) { row.Quantity += 1; return(null); } else { DictionaryDataSet.OrderDetailRow orderDetail = (DictionaryDataSet.OrderDetailRow)_oBL.InitNewRowDetail(dsDictionary.OrderDetail, master, inventoryItem.InventoryItemID); var uct = new UctChooseFood(orderDetail); uct.Click += ChooseFood_Click; uct.CalculateAmount += new EventHandler(CalculateAmount); return(uct); } }
protected override void InitNewRow() { base.InitNewRow(); DictionaryDataSet.OrderRow row = (DictionaryDataSet.OrderRow)objBLDetail.InitNewRow(DsDictionary.Order); if (BookingID != Guid.Empty) { row.BookingID = BookingID; var bookingRow = ShareDictionary.DsDictionary.Booking.FindByBookingID(BookingID); if (bookingRow != null) { row.CustomerID = ShareDictionary.DsDictionary.Booking.FindByBookingID(BookingID).CustomerID; row.NumberOfPeople = bookingRow.NumberOfPeople; row.OrderDate = bookingRow.FromTime; } else { row.OrderDate = Session.Today; } } BsDetail.MoveFirst(); txtOrderNo.Focus(); }
public DataRow InitNewRowDetail(DictionaryDataSet.OrderDetailDataTable table, DictionaryDataSet.OrderRow master, Guid inventoryItemID) { DictionaryDataSet.OrderDetailRow drNewRow = table.NewOrderDetailRow(); drNewRow.OrderDetailID = Guid.NewGuid(); drNewRow.OrderID = master.OrderID; drNewRow.InventoryItemID = inventoryItemID; drNewRow.Quantity = 1; drNewRow.SortOrder = table.Rows.Count + 1; drNewRow.CookedQuantity = 0; drNewRow.ServedQuantity = 0; drNewRow.ServedQuantity = 0; drNewRow.CookingQuantity = 0; drNewRow.OrderDetailStatus = 0; table.Rows.InsertAt(drNewRow, 0); return(drNewRow); }
protected override int SaveData() { int result = 1; BsDetail.EndEdit(); //var tableChanged = dsDictionary.Order.GetChanges(); //var tableDetailChanged = dsDictionary.OrderDetail.GetChanges(); //if (tableChanged == null && tableDetailChanged == null) //{ // return (int)EnumResultInsertUpdate.Success; //} //else //{ // //if (tableChanged.Rows.Count == 0 && tableDetailChanged.Rows.Count == 0) // // return (int)EnumResultInsertUpdate.Success; //} //DictionaryDataSet.OrderRow drObjectChange = (DictionaryDataSet.OrderRow)CurrentRow; DictionaryDataSet.OrderDataTable table = DsDictionary.Order; DictionaryDataSet.OrderRow drObjectChange = table.NewOrderRow(); if (FormActionMode == ActionMode.AddNew) { drObjectChange.OrderID = Guid.NewGuid(); } else { drObjectChange.OrderID = OrderID; } drObjectChange.OrderNo = txtOrderNo.Text; drObjectChange.OrderDate = DateTime.Now; drObjectChange.OrderStatus = 0; drObjectChange.NumberOfPeople = 1; drObjectChange.EmployeeID = Session.UserLogin.EmployeeID; drObjectChange.CreatedDate = DateTime.Now; drObjectChange.CreatedBy = Session.UserLogin.UserName; drObjectChange.ModifiedDate = DateTime.Now; drObjectChange.ModifiedBy = Session.UserLogin.UserName; drObjectChange.TableID = Guid.Parse(cboTableMapping.Value.ToString()); drObjectChange.CustomerID = Guid.Parse(cboCustomerID.Value.ToString()); drObjectChange.NumberOfPeople = Int32.Parse(txtNumberOfPeople.Text); drObjectChange.OrderDate = DateTime.Now; drObjectChange.CancelReason = txtCancelReason.Text; if (BookingID == Guid.Empty) { drObjectChange.BookingID = _bookingID; } else { drObjectChange.BookingID = BookingID; } //////Chỗ này nhớ lấy booking id if (drObjectChange != null) { drObjectChange.ModifiedDate = DateTime.Now; drObjectChange.ModifiedBy = Session.UserLogin.UserName; for (int i = 0; i < DsDictionary.Tables[10].Rows.Count; i++) { DsDictionary.Tables[10].Rows[i][1] = drObjectChange.OrderID; } objBLDetail.InsertUpdateOrder(drObjectChange, DsDictionary); } return(result); }