Пример #1
0
        public void Add(string itemNumber, char caseOrPackage, string orderSource, string cartId, string productGroupingInsightKey)
        {
            var orderSourceId = connection.Query <int>(
                @"select OrderSourceId
                                                    from Orders.RecommendedOrderSource
                                                    where OrderSource = @OrderSource",
                new
            {
                OrderSource = orderSource
            }).FirstOrDefault();

            connection.Execute(
                @"INSERT INTO [Orders].[RecommendedItemsOrderedAnalytics]
                            ([CartId],[ItemNumber],[UnitOfMeasure],[OrderSourceId],[ProductGroupingInsightKey])
                          VALUES
                            (@CartId,@ItemNumber,@UnitOfMeasure,@OrderSourceId,@ProductGroupingInsightKey)",
                new
            {
                CartId     = cartId,
                ItemNumber = itemNumber,
                ProductGroupingInsightKey = productGroupingInsightKey,
                UnitOfMeasure             = caseOrPackage,
                OrderSourceId             = orderSourceId
            });
        }
        public List <GrowthAndRecoveriesModel> GetGrowthAdnGetGrowthAndRecoveryOpportunities(string customerNumber, string branchId)
        {
            List <GrowthAndRecoveriesModel> results = connection.Query <GrowthAndRecoveriesModel>(@"
                SELECT
	                g.Id,
	                g.BranchId,
	                g.CustomerNumber,
	                g.Amount,
	                g.GrowthAndRecoveryProductGroup,
	                g.GrowthAndRecoveryTypeKey,
	                pg.Code as GroupingCode,
                    pg.Description as GroupingDescription,
                    g.ProductGroupingInsightKey,
                    g.CustomerInsightVersionKey
                FROM Customers.GrowthAndRecoveries g
                LEFT JOIN Customers.GrowthAndRecoveryProductGroups pg ON pg.GrowthAndRecoveryProductGroup = g.GrowthAndRecoveryProductGroup
                WHERE 
	                g.CustomerNumber = @CustomerNumber
                AND	g.BranchId = @BranchId
                ORDER BY g.Amount DESC",
                                                                                                  new {
                CustomerNumber = customerNumber,
                BranchId       = branchId
            }).ToList();

            return(results);
        }
Пример #3
0
        public MinimumOrderAmountModel GetMinimumOrderAmount(string customerNumber, string branchId)
        {
            MinimumOrderAmountModel results = connection.Query <MinimumOrderAmountModel>(@"
                SELECT
                    Value AS ApprovedAmount
                FROM Customers.CustomerOptions
                WHERE 
	                CustomerNumber = @CustomerNumber
                AND	BranchId = @BranchId"    , new
            {
                CustomerNumber = customerNumber,
                BranchId       = branchId
            }).FirstOrDefault();

            return(results);
        }