コード例 #1
0
ファイル: DbOrder.cs プロジェクト: radtek/Pos
        public static Order GetOrderFromOrderGroupKey(int inOrderGroupKey, int terminalKey)
        {
            var group = DbOrderGroup.GetOrderGroup(inOrderGroupKey);
            var order = GetOrder(group.OrderKey);

            group.Order = order;
            if (group.GroupType == GroupType.ServingCourse)
            {
                order.ServingCourseGroups.Add(group);
                var        items           = GetItemsByGroups(order.ServingCourseGroups, GroupType.ServingCourse, terminalKey);
                List <int> courseGroupKeys = new List <int>();
                items.ForEach(s => courseGroupKeys.Add(s.CourseKey));
                order.CourseGroups = DbOrderGroup.GetOrderGroups(order, courseGroupKeys);
                FilterItems(order, items);
            }
            else
            {
                order.CourseGroups.Add(group);
                var        items            = GetItemsByGroups(order.ServingCourseGroups, GroupType.ServingCourse, terminalKey);
                List <int> sCourseGroupKeys = new List <int>();
                items.ForEach(s => sCourseGroupKeys.Add(s.ServingCourseKey));
                order.ServingCourseGroups = DbOrderGroup.GetOrderGroups(order, sCourseGroupKeys);
                FilterItems(order, items);
            }
            return(order);
        }
コード例 #2
0
ファイル: DbOrder.cs プロジェクト: radtek/Pos
        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
ファイル: DbOrder.cs プロジェクト: radtek/Pos
        public static Order GetOrder(int inOrderKey, int terminalKey, bool isBumped = false)
        {
            var order = GetOrder(inOrderKey);

            if (order != null)
            {
                order.ServingCourseGroups = DbOrderGroup.GetOrderGroups(order, GroupType.ServingCourse);
                order.CourseGroups        = DbOrderGroup.GetOrderGroups(order, GroupType.Course);
                var items = GetItemsByGroups(order.ServingCourseGroups, GroupType.ServingCourse, terminalKey, isBumped);
                FilterItems(order, items);
            }
            return(order);
        }
コード例 #4
0
        public static void UpdateGroupInformation(Item item)
        {
            if (item.SCourseGroup.OrderGroupKey == 0)
            {
                DbOrderGroup.AddOrderGroup(item.SCourseGroup);
            }
            if (item.CourseGroup.OrderGroupKey == 0)
            {
                DbOrderGroup.AddOrderGroup(item.CourseGroup);
            }
            var whereCondition = " Where ORDERITEM_KEY = @ORDERITEM_KEY";
            var fbParameters   = new List <QueryParameter>();

            fbParameters.Add(new QueryParameter("COURSE_KEY", item.CourseGroup.OrderGroupKey));
            fbParameters.Add(new QueryParameter("SERVINGCOURSE_KEY", item.SCourseGroup.OrderGroupKey));
            var commandText = DatabaseCore.Instance.BuildUpdateQuery("ORDERITEMS", fbParameters, whereCondition);

            fbParameters.Add(new QueryParameter("ORDERITEM_KEY", item.OrderItemKey));
            DatabaseCore.Instance.ExecuteNonQuery(commandText, fbParameters);
        }
コード例 #5
0
ファイル: DbOrder.cs プロジェクト: radtek/Pos
        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);
                }
            }
        }