Пример #1
0
        private static ObservableCollection <Item> GetItemsByGroups(ObservableCollection <Group> groups,
                                                                    GroupType groupType, int terminalKey, bool isBumped = false)
        {
            var groupKeys = new List <int>();

            groups.ForEach(s => groupKeys.Add(s.OrderGroupKey));
            var items = new ObservableCollection <Item>();

            items = !isBumped?DbOrderItem.GetOrderItems(groupKeys, groupType, terminalKey) : DbOrderItem.GetBumpedOrderItems(groupKeys, groupType, terminalKey);

            return(items);
        }
Пример #2
0
        public static Order GetOrderFromOrderItemKey(int inOrderIemKey, int terminalKey)
        {
            var item         = DbOrderItem.GetOrderItemFromItemKey(inOrderIemKey);
            var sCoursegroup = DbOrderGroup.GetOrderGroup(item.ServingCourseKey);
            var courseGroup  = DbOrderGroup.GetOrderGroup(item.CourseKey);
            var order        = GetOrder(sCoursegroup.OrderKey);

            order.ServingCourseGroups.Add(sCoursegroup);
            order.CourseGroups.Add(courseGroup);
            FilterItem(order, item);
            return(order);
        }
Пример #3
0
        public static void AddOrder(Order order, int terminalKey, bool addItems = true)
        {
            order.OrderKey = DatabaseCore.Instance.GetGeneratorValue("GEN_ORDERS");
            var fbParameters = new List <QueryParameter>();

            fbParameters.Add(new QueryParameter("ORDER_KEY", order.OrderKey));
            fbParameters.Add(new QueryParameter("ORDER_NUMBER", order.OrderNumber));
            fbParameters.Add(new QueryParameter("ORDER_POS_KEY", order.OrderPosKey));
            fbParameters.Add(new QueryParameter("PATRON_COUNT", order.PatronCount));
            fbParameters.Add(new QueryParameter("CHIT_VALUE", order.ChitValue));
            fbParameters.Add(new QueryParameter("TABLE_TAB_NAME", order.TableTabName));
            fbParameters.Add(new QueryParameter("SOURCE_TABLE_TAB_NAME", order.SourceTableName));
            fbParameters.Add(new QueryParameter("PARTY_NAME", order.PartyName));
            fbParameters.Add(new QueryParameter("SERVER_NAME", order.ServerName));
            fbParameters.Add(new QueryParameter("CUSTOMER_NAME", order.CustomerName));
            fbParameters.Add(new QueryParameter("ORDER_TYPE", order.OrderType));
            fbParameters.Add(new QueryParameter("ORDER_STATUS", order.OrderStatus));
            fbParameters.Add(new QueryParameter("ORDER_SALE_START_TIME", order.SaleStartTime));
            fbParameters.Add(new QueryParameter("ORDER_SALE_FINISH_TIME", order.SaleFinishTime));
            fbParameters.Add(new QueryParameter("DELIVERY_TIME", order.DeliveryTime));
            fbParameters.Add(new QueryParameter("ARRIVAL_TIME", order.ArrivalTime));
            fbParameters.Add(new QueryParameter("IS_BUMPED", false));
            var  queryString = DatabaseCore.Instance.BuildInsertQuery("ORDERS", fbParameters);
            bool result      = DatabaseCore.Instance.ExecuteNonQuery(queryString, fbParameters);

            if (result)
            {
                //Add Order Groups
                DbOrderGroup.AddOrderGroups(order.ServingCourseGroups);
                DbOrderGroup.AddOrderGroups(order.CourseGroups);
                if (addItems)
                {
                    DbOrderItem.AddOrderItems(order.Items, terminalKey, order.OrderKey);
                }
            }
        }