コード例 #1
0
 /// <summary>
 /// gets Shipping cost response
 /// </summary>
 /// <returns></returns>
 private BaseResponseDto<EstimateDeliveryPricePayloadDto> GetShippingResponse()
 {
     try
     {
         EstimateDeliveryPriceRequestDto estimationdto = ShoppingCartHelper.GetEstimationDTO(Cart);
         return ShoppingCartHelper.CallEstimationService(estimationdto);
     }
     catch (Exception ex)
     {
         EventLogProvider.LogInformation("Kadena_CMSWebParts_Kadena_Cart_DistributorCartDetails", "OnPreRender", ex.Message);
         return null;
     }
 }
コード例 #2
0
 public static object GetCartTotalByInventoryType(EvaluationContext context, params object[] parameters)
 {
     try
     {
         int userID         = ValidationHelper.GetInteger(parameters[1], default(int));
         int inventoryType  = ValidationHelper.GetInteger(parameters[2], default(int));
         int openCampaignID = ValidationHelper.GetInteger(parameters[3], default(int));
         if (inventoryType == (Int32)ProductType.PreBuy)
         {
             var query = new DataQuery(SQLQueries.getShoppingCartTotal);
             QueryDataParameters queryParams = new QueryDataParameters();
             queryParams.Add("@ShoppingCartUserID", userID);
             queryParams.Add("@ShoppingCartInventoryType", inventoryType);
             queryParams.Add("@ShoppingCartCampaignID", openCampaignID);
             var cartTotal = ConnectionHelper.ExecuteScalar(query.QueryText, queryParams, QueryTypeEnum.SQLQuery, true);
             return(ValidationHelper.GetDecimal(cartTotal, default(decimal)));
         }
         else
         {
             var     loggedInUSerCartIDs = ShoppingCartHelper.GetCartsByUserID(userID, ProductType.GeneralInventory, openCampaignID);
             decimal cartTotal           = 0;
             loggedInUSerCartIDs.ForEach(cartID =>
             {
                 var Cart = ShoppingCartInfoProvider.GetShoppingCartInfo(cartID);
                 if (Cart.ShippingOption != null && Cart.ShippingOption.ShippingOptionCarrierServiceName.ToLower() != ShippingOption.Ground)
                 {
                     EstimateDeliveryPriceRequestDto estimationdto = ShoppingCartHelper.GetEstimationDTO(Cart);
                     var estimation = ShoppingCartHelper.CallEstimationService(estimationdto);
                     cartTotal     += ValidationHelper.GetDecimal(estimation?.Payload?.Cost, default(decimal));
                 }
             });
             return(ValidationHelper.GetDecimal(cartTotal, default(decimal)));
         }
     }
     catch (Exception ex)
     {
         EventLogProvider.LogInformation("Kadena Macro methods", "BindPrograms", ex.Message);
         return(default(double));
     }
 }