Exemplo n.º 1
0
        private KitchenOrderPrint GetKitchenOrderPrintModel(Services.Printout order)
        {
            Services.Item     item, itemMenu;
            KitchenOrderPrint model;
            List <LineItem>   subItems;

            try {
                model             = new KitchenOrderPrint();
                model.Items       = new List <LineItem>();
                model.Check       = _orderService.GetCheck(order.CheckId);
                model.id          = order.id;
                model.CreatedDate = model.Check.DateCreated;
                model.Comments    = _commentService.GetItemComment(order.CheckId, CommonUnit.CommentType.Check, SessionData.customer.id);

                // If no printers - webSocket not running, or no connection to webSocket
                if (SessionData.printers != null)
                {
                    model.PrinterKitchenWidth = SessionData.printerKitchenWidth;
                }

                List <Services.ChecksMenu> menus = _orderService.GetMenuItems(order.CheckId);
                List <ChecksMenuProduct>   products;
                Boolean ordered;
                foreach (Services.ChecksMenu menuItem in menus)
                {
                    itemMenu = _itemService.GetItem(menuItem.MenuId);
                    ordered  = ((CommonUnit.MenuItemStatus)menuItem.Status == CommonUnit.MenuItemStatus.Ordered);
                    products = _orderService.GetProducts(menuItem.id);
                    subItems = new List <LineItem>();
                    foreach (Services.ChecksMenuProduct productItem in products)
                    {
                        foreach (Services.ChecksMenuProductItem associatedItem in productItem.ChecksMenuProductItems)
                        {
                            item = _itemService.GetItemProductAssosiationsById(associatedItem.ItemId);
                            if (item != null)
                            {
                                subItems.Add(new LineItem()
                                {
                                    Description = item.Name, Ordered = ordered
                                });
                            }
                        }
                    }
                    model.Items.Add(new LineItem()
                    {
                        Description = itemMenu.Name, Ordered = ordered, id = itemMenu.id, Comments = _commentService.GetItemComment(menuItem.id, CommonUnit.CommentType.MenuItem, SessionData.customer.id), SubItems = subItems
                    });
                    _orderService.UpdateMenuItemStatus(menuItem.id, CommonUnit.MenuItemStatus.Ordered);
                }
            }
            catch (Exception ex) {
                base.Log(ex);
                return(null);
            }
            finally {
            }

            return(model);
        }
Exemplo n.º 2
0
        public String PrintKitchenOrders(Services.Printout order)
        {
            KitchenOrderPrint model = GetKitchenOrderPrintModel(order);

            return(RenderViewToString(this.ControllerContext, "Printouts/_SendKitchenOrder2PrinterPartial", model));
        }
Exemplo n.º 3
0
        public Boolean UpdateCheckStatus(Int32 checkId, Common.CheckStatus status) {
            Check query = new Check();
            Printout kitchenOrder;
            if (checkId != 0) {
                using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
                    query = db.Checks.FirstOrDefault(m => m.id == checkId);
                    if (query != default(Check)) {
                        query.Status = (Int32)status;
                        if (status == Common.CheckStatus.Ordered) {
                            // Run Inventory
                            UpdateInventory(checkId);

                            kitchenOrder = db.Printouts.FirstOrDefault(m => m.CheckId == checkId);
                            if (kitchenOrder == default(Printout)) {
                                kitchenOrder = new Printout();
                            }
                            kitchenOrder.Status = (Int32)Common.PrintStatus.Queued;
                            kitchenOrder.Type = (Int32)Common.PrintType.KitchenOrder;
                            kitchenOrder.CheckId = checkId;
                            if (kitchenOrder.id == 0) {
                                db.Printouts.InsertOnSubmit(kitchenOrder);
                            }
                        }
                        db.SubmitChanges();
                        return true;
                    }
                }
            }
            return false;
        }
Exemplo n.º 4
0
 public Boolean UpdateKitchenOrderPrintStatus(Int32 id) {
     Printout query = new Printout();
     if (id != 0) {
         using (menuzRusDataContext db = new menuzRusDataContext(base.connectionString)) {
             query = db.Printouts.FirstOrDefault(m => m.id == id);
             if (query != default(Printout)) {
                 query.Status = (Int32)Common.PrintStatus.Printed;
                 db.SubmitChanges();
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 5
0
 partial void DeletePrintout(Printout instance);
Exemplo n.º 6
0
 partial void UpdatePrintout(Printout instance);
Exemplo n.º 7
0
 partial void InsertPrintout(Printout instance);
Exemplo n.º 8
0
		private void detach_Printouts(Printout entity)
		{
			this.SendPropertyChanging();
			entity.Check = null;
		}
Exemplo n.º 9
0
		private void attach_Printouts(Printout entity)
		{
			this.SendPropertyChanging();
			entity.Check = this;
		}