private void btnRight_Click(object sender, EventArgs e) { try { foreach (Control ctr in flpNewTable.Controls) { UCOrder ucOrder = (UCOrder)ctr; if (ucOrder.BackColor == Color.FromArgb(0, 102, 204)) { OrderDetailModel itemOrder = (OrderDetailModel)ucOrder.Tag; OrderSlpitNew.FloorID = lblNewTable.Text; OrderSlpitNew.ShiftID = OrderMain.ShiftID; OrderSlpitNew.ListOrderDetail.Remove(itemOrder); OrderMain.addItemToList(itemOrder); OrderSlpitNew.SubTotal(); OrderMain.SubTotal(); OrderMain.isTransferTableAll = 0; RefeshOrderMain(OrderMain, flpOldTable); RefeshOrderMain(OrderSlpitNew, flpNewTable); } } } catch (Exception ex) { LogPOS.WriteLog("frmTransferTable::::::::::::::::::btnLeft_Click::::::::::::::::::::" + ex.Message); } }
public ActionResult SendOrder(string lstOrderItem, string lstModifierItem, string lstSeat) { var session = Session["User"] as StaffModel; if (session != null) { GetListPrinter(); try { int KeyItem = 0; string FloorID = Class.FloorID; List <OrderItem> listOrderItem = new JavaScriptSerializer().Deserialize <List <OrderItem> >(lstOrderItem); List <ModifierModel> listModifier = new JavaScriptSerializer().Deserialize <List <ModifierModel> >(lstModifierItem); List <SeatModel> listSeat = new JavaScriptSerializer().Deserialize <List <SeatModel> >(lstSeat); OrderDateModel OrderTemp = OrderService.GetOrderByTable(FloorID, 0); if (OrderTemp.Status != 2) { if (OrderTemp.ListOrderDetail.Count > 0) { OrderMain.OrderNumber = OrderTemp.OrderNumber; OrderMain.OrderID = OrderTemp.OrderID; OrderMain.IsLoadFromData = true; OrderMain.SubTotalVoid(); } else { OrderMain.IsLoadFromData = false; } OrderMain.UserName = session.UserName; OrderMain.FloorID = FloorID; OrderMain.PrintType = 1; OrderMain.PDA = 99; foreach (OrderItem item in listOrderItem) { if (OrderMain.IsLoadFromData == false) { if (item.ChangeStatus != 2) { OrderDetailModel detailModel = new OrderDetailModel(); detailModel.ProductID = Convert.ToInt32(item.ProductID); detailModel.Price = Convert.ToDouble(item.Price); detailModel.ProductName = item.ProductName; detailModel.Qty = Convert.ToInt32(item.Qty); detailModel.Total = Convert.ToDouble(item.Price); detailModel.ChangeStatus = Convert.ToInt32(item.ChangeStatus); detailModel.KeyItem = KeyItem; detailModel.Seat = Convert.ToInt32(item.Seat); detailModel.DynID = Convert.ToInt32(item.DynID); detailModel.CategoryID = Convert.ToInt32(item.CategoryID); detailModel.KeyItem = Convert.ToInt32(item.KeyIndex); var dataPrint = ProductService.GetListPrintJob(detailModel.ProductID, detailModel.CategoryID); foreach (PrinteJobDetailModel itemPrint in dataPrint) { PrinteJobDetailModel p = new PrinteJobDetailModel(); p.ProductID = itemPrint.ProductID; p.PrinterID = itemPrint.PrinterID; detailModel.ListPrintJob.Add(p); } if (detailModel.ProductID == 0) { var dataPrintOpenItem = ProductService.GetListPrintJobOpenItem(detailModel.DynID); foreach (PrinteJobDetailModel itemPrint in dataPrintOpenItem) { PrinteJobDetailModel p = new PrinteJobDetailModel(); p.PrinterID = Convert.ToInt32(itemPrint.PrinterID); detailModel.ListPrintJob.Add(p); } } OrderMain.addItemToList(detailModel); foreach (ModifierModel modifi in listModifier) { if (Convert.ToInt32(modifi.ProdutcID) == Convert.ToInt32(item.ProductID) && modifi.KeyModi == item.KeyIndex) { OrderDetailModifireModel modifiDetail = new OrderDetailModifireModel(); modifiDetail.ProductID = Convert.ToInt32(modifi.ProdutcID); modifiDetail.ModifireName = modifi.ModifiName; modifiDetail.Qty = Convert.ToInt32(modifi.Qty); modifiDetail.ModifireID = Convert.ToInt32(modifi.ModifiID); modifiDetail.ChangeStatus = Convert.ToInt32(modifi.ChangeStatusM); modifiDetail.DynID = Convert.ToInt32(modifi.DynID); modifiDetail.Price = Convert.ToDouble(modifi.ModifiPrice); OrderMain.addModifierToList(modifiDetail, KeyItem + 1); } } KeyItem++; } } else { OrderDetailModel detailModel = new OrderDetailModel(); detailModel.ProductID = Convert.ToInt32(item.ProductID); detailModel.Price = Convert.ToDouble(item.Price); detailModel.ProductName = item.ProductName; detailModel.Qty = Convert.ToInt32(item.Qty); detailModel.Total = Convert.ToDouble(item.Price); detailModel.ChangeStatus = Convert.ToInt32(item.ChangeStatus); detailModel.KeyItem = KeyItem; detailModel.Seat = Convert.ToInt32(item.Seat); detailModel.DynID = Convert.ToInt32(item.DynID); detailModel.CategoryID = Convert.ToInt32(item.CategoryID); detailModel.KeyItem = Convert.ToInt32(item.KeyIndex); var dataPrint = ProductService.GetListPrintJob(detailModel.ProductID, detailModel.CategoryID); foreach (PrinteJobDetailModel itemPrint in dataPrint) { PrinteJobDetailModel p = new PrinteJobDetailModel(); p.ProductID = itemPrint.ProductID; p.PrinterID = itemPrint.PrinterID; detailModel.ListPrintJob.Add(p); } if (detailModel.ProductID == 0) { var dataPrintOpenItem = ProductService.GetListPrintJobOpenItem(detailModel.DynID); foreach (PrinteJobDetailModel itemPrint in dataPrintOpenItem) { PrinteJobDetailModel p = new PrinteJobDetailModel(); p.PrinterID = Convert.ToInt32(itemPrint.PrinterID); detailModel.ListPrintJob.Add(p); } } OrderMain.addItemToList(detailModel); foreach (ModifierModel modifi in listModifier) { if (Convert.ToInt32(modifi.ProdutcID) == Convert.ToInt32(item.ProductID) && modifi.KeyModi == item.KeyIndex) { OrderDetailModifireModel modifiDetail = new OrderDetailModifireModel(); modifiDetail.ProductID = Convert.ToInt32(modifi.ProdutcID); modifiDetail.ModifireName = modifi.ModifiName; modifiDetail.Qty = Convert.ToInt32(modifi.ModifieQty); modifiDetail.ModifireID = Convert.ToInt32(modifi.ModifiID); modifiDetail.ChangeStatus = Convert.ToInt32(modifi.ChangeStatusM); modifiDetail.DynID = Convert.ToInt32(modifi.DynID); modifiDetail.Price = Convert.ToDouble(modifi.ModifiPrice); OrderMain.addModifierToList(modifiDetail, KeyItem + 1); } } KeyItem++; } } foreach (SeatModel seatItem in listSeat) { OrderMain.ListSeatOfOrder.Add(seatItem); } if (OrderMain.ListOrderDetail.Count() > 0) { if (checkOrderSended(OrderMain) == false) { return(Json("NoSend", JsonRequestBehavior.AllowGet)); } else { OrderMain.SubTotalVoid(); if (OrderService.InsertOrder(OrderMain) == 1) { if (!OrderMain.IsLoadFromData) { OrderMain.OrderID = OrderService.GetOrderID(); } PrinterServer printServer = new PrinterServer(); printServer.PrintData(OrderMain, PrintData); return(Json("1", JsonRequestBehavior.AllowGet)); } } } } else { return(Json("BILL", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { SystemLog.LogPOS.WriteLog("OrderController::::::::::::::::::::SendOrder::::::::::::::::::" + ex.Message); return(null); } } else { return(RedirectToAction("Index", "Login")); } return(null); }