Beispiel #1
0
        public static ObservableCollection <Item> GetBumpedOrderItems(List <int> groupKeys, GroupType inGroupType, int terminalKey)
        {
            var inClouse = inGroupType == GroupType.ServingCourse ? " AND A.SERVINGCOURSE_KEY in (" : " AND A.COURSE_KEY in (";

            foreach (var groupKey in groupKeys)
            {
                inClouse += groupKey + ",";
            }
            inClouse = inClouse.Substring(0, inClouse.Length - 1);

            var queryString = @"SELECT * FROM ORDERITEMS A
                                INNER JOIN ITEMS B
                                ON A.ITEM_KEY = B.ITEM_KEY
                                WHERE A.TERMINAL_KEY = @TERMINAL_KEY ";

            queryString += inClouse + ")";
            var queryParameters = new List <QueryParameter>();

            queryParameters.Add(new QueryParameter("TERMINAL_KEY", terminalKey));
            queryParameters.Add(new QueryParameter("ORDER_ITEM_STATUS", OrderStatus.Bumped));
            var resultSet = DatabaseCore.Instance.ExecuteDataSetQuery(queryString, queryParameters);
            var items     = ExtractItemsInformation(resultSet);

            foreach (var item in items)
            {
                item.Sides   = DbOrderItemSide.GetOrderItemSides(item);
                item.Options = DbOrderItemOption.GetOrderItemOptions(item);
            }
            return(items);
        }
Beispiel #2
0
        public static Item GetOrderItemFromItemKey(int inOrderIemKey)
        {
            var queryString = @"SELECT * FROM ORDERITEMS A
                                INNER JOIN ITEMS B
                                ON A.ITEM_KEY = B.ITEM_KEY
                                WHERE A.ORDERITEM_KEY = @ORDERITEM_KEY";
            var parameters  = new List <QueryParameter>();

            parameters.Add(new QueryParameter("ORDERITEM_KEY", inOrderIemKey));
            var resultSet = DatabaseCore.Instance.ExecuteDataSetQuery(queryString, parameters);
            var item      = ExtractItemInformation(resultSet.Rows[0]);

            item.Sides   = DbOrderItemSide.GetOrderItemSides(item);
            item.Options = DbOrderItemOption.GetOrderItemOptions(item);
            return(item);
        }
Beispiel #3
0
        public static void AddOrderItem(Item item, int terminalKey)
        {
            item.ItemKey      = DbItem.GetOrCreateItem(item);
            item.OrderItemKey = DatabaseCore.Instance.GetGeneratorValue("GEN_ORDERITEM");
            var fbParameters = new List <QueryParameter>();

            fbParameters.Add(new QueryParameter("ORDERITEM_KEY", item.OrderItemKey));
            fbParameters.Add(new QueryParameter("ITEM_KEY", item.ItemKey));
            fbParameters.Add(new QueryParameter("COURSE_KEY", item.CourseGroup.OrderGroupKey));
            fbParameters.Add(new QueryParameter("SERVINGCOURSE_KEY", item.SCourseGroup.OrderGroupKey));
            fbParameters.Add(new QueryParameter("ORDERITEM_POS_KEY", item.OrderItemPosKey));
            fbParameters.Add(new QueryParameter("TERMINAL_KEY", terminalKey));
            fbParameters.Add(new QueryParameter("ORDER_ITEM_STATUS", item.OrderStatus));
            fbParameters.Add(new QueryParameter("ORDERITEM_NOTE", item.Note));
            fbParameters.Add(new QueryParameter("ARRIVAL_TIME", item.ArrivalTime));
            var queryString = DatabaseCore.Instance.BuildInsertQuery("ORDERITEMS", fbParameters);

            DatabaseCore.Instance.ExecuteNonQuery(queryString, fbParameters);
            DbOrderItemSide.AddOrderItemSides(item.Sides);
            DbOrderItemOption.AddOrderItemOptions(item.Options);
        }