Exemplo n.º 1
0
        /// <summary>
        /// 创建套餐对应产品
        /// </summary>
        /// <param name="variantId"></param>
        /// <param name="displayName"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static string CreateProduct(string variantId, string displayName, string user)
        {
            var result = string.Empty;

            try
            {
                WholeProductInfo info = new WholeProductInfo()
                {
                    ProductID             = "BY-TUHU-BXGSDCBY",
                    VariantID             = variantId,
                    CategoryName          = "CarPAR",
                    DefinitionName        = "Service",
                    PrimaryParentCategory = "BXGSDCBY",
                    Image_filename        = "/Images/Products/bf46/d111/fbda108daa189c1f90cd0324_w800_h800.jpg",
                    CP_Tire_ROF           = "非防爆",
                    invoice     = "Yes",
                    CP_ShuXing3 = "商品安装服务",
                    stockout    = false,
                    IsDaiFa     = false,
                    DisplayName = displayName,
                    Description = "<p> < br /></ p > ",
                    CP_Brand    = "途虎/Tuhu",
                    Name        = "保险公司单次保养"
                };
                result = BaoYangExternalService.CreateProductV2(info, user, ChannelType.Tuhu);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建套餐对应产品
        /// </summary>
        /// <param name="variantId"></param>
        /// <param name="displayName"></param>
        /// <param name="user"></param>
        /// <returns>套餐Pid</returns>
        private static string CreatePaintPackageProduct(string variantId, string displayName, string user)
        {
            WholeProductInfo info = new WholeProductInfo()
            {
                ProductID             = "FU-PQXB-KAT",
                VariantID             = variantId,
                TaxRate               = 0.006M,
                DefinitionName        = "Service",
                UseCategoryPricing    = false,
                PrimaryParentCategory = "DKHPQTC",
                Image_filename        = "/Images/Products/f7bb/9327/a10280c22b32649423a82b62_w800_h800.png",
                CP_Tire_ROF           = "非防爆",
                invoice               = "Yes",
                gift        = "Full",
                CP_ShuXing3 = "商品安装服务",
                stockout    = false,
                IsDaiFa     = false,
                DisplayName = displayName,
                Description = "<p> < br /></ p > ",
                CP_Brand    = "途虎/Tuhu",
                Name        = "喷漆大客户套餐"
            };
            var result = BaoYangExternalService.CreateProductV2(info, user, ChannelType.Tuhu);

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据手机号获取用户
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        public static User GetUserByMobile(string phone)
        {
            User result = null;

            try
            {
                result = BaoYangExternalService.GetUserByMobile(phone);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 调用生成兑换码服务
        /// </summary>
        /// <param name="pack"></param>
        /// <param name="quantity"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static GenerateRedemptionCodeResult GenerateRedemptionCode(
            int quantity, DateTime startTime, DateTime endTime, string user)
        {
            var result = BaoYangExternalService.GenerateRedemptionCode(new GenerateRedemptionCodeRequest
            {
                CreateUser         = user,
                EndTime            = endTime,
                StartTime          = startTime,
                Quantity           = quantity,
                RedemptionCodeType = RedemptionCodeEnum.Type.SingleBaoYangPackage,
                Remark             = "单次保养兑换码生成",
            });

            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 根据主键Id获取套餐详情
        /// </summary>
        /// <param name="pkid"></param>
        /// <returns></returns>
        public VipBaoYangPackageViewModel SelectVipBaoYangPackageByPkid(int pkid)
        {
            VipBaoYangPackageViewModel result = null;

            try
            {
                var package = dbScopeReadManager.Execute(conn => DALVipBaoYangPackage.SelectVipBaoYangPackageByPkid(conn, pkid));
                result = new VipBaoYangPackageViewModel(package);
                var user = BaoYangExternalService.GetCompanyUserInfo(result.VipUserId);
                result.VipUserName = user?.UserName;
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }
Exemplo n.º 6
0
        public static bool ExecuteOrderProcess(ExecuteOrderProcessRequest request)
        {
            var result = false;

            try
            {
                var executeResult = BaoYangExternalService.ExecuteOrderProcess(request);
                result = string.IsNullOrEmpty(executeResult);
                if (!result)
                {
                    Logger.Warn($"更新订单{request.OrderId}失败, request=>{JsonConvert.SerializeObject(request)}result=>{executeResult}");
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"更新订单信息失败!request=>{JsonConvert.SerializeObject(request)}", ex);
            }
            return(result);
        }
Exemplo n.º 7
0
        public static CreateOrderResult CreateOrder(decimal price, string pid, string name, Guid vipUserId,
                                                    int num, string remark)
        {
            var vipUser     = BaoYangExternalService.GetCompanyUserInfo(vipUserId);
            var companyId   = vipUser.CompanyId == 0 ? (int?)null : vipUser.CompanyId;
            var companyName = string.Empty;

            if (companyId != null && vipUser.CompanyInfo != null)
            {
                if (vipUser.CompanyInfo.Id == companyId.Value)
                {
                    companyName = vipUser.CompanyInfo.Name;
                }
                else if (vipUser.CompanyInfo.ChildCompany != null)
                {
                    companyName = vipUser.CompanyInfo.ChildCompany.FirstOrDefault(c => c.Id == companyId.Value)?.Name;
                }
            }
            var createOrderRequest = new CreateOrderRequest
            {
                OrderChannel = "f大客户保养套餐",
                OrderType    = "44大客户保养2B保批",
                Status       = OrderEnum.OrderStatus.New,
                Customer     = new OrderCustomer
                {
                    UserId   = vipUser.UserId,
                    UserName = vipUser.UserName,
                    UserTel  = vipUser.UserMobile,
                },
                Delivery = new OrderDelivery
                {
                    DeliveryStatus = OrderEnum.DeliveryStatus.Signed,
                    DeliveryType   = OrderEnum.DeliveryType.NoDelivery,
                    InstallType    = OrderEnum.InstallType.ShopInstall,
                },
                Payment = new OrderPayment
                {
                    PayStatus   = OrderEnum.PayStatus.Waiting,
                    PayMothed   = OrderEnum.PayMethod.MonthPay,
                    PaymentType = "5Special",
                },
                Money = new OrderMoney
                {
                    SumMoney       = price * num,
                    SumMarkedMoney = price * num,
                },
                Items = new List <OrderItem>()
                {
                    new OrderItem()
                    {
                        Price    = price,
                        Pid      = pid,
                        Num      = num,
                        Name     = name,
                        Category = "BXGSDCBY"
                    }
                },
                SumNum = num,
                Remark = remark,
                BigCustomerCompanyId   = companyId,
                BigCustomerCompanyName = companyName,
            };
            CreateOrderResult result = null;

            try
            {
                result = BaoYangExternalService.CreateOrder(createOrderRequest);
            }
            catch (Exception ex)
            {
                Logger.Error($"创建订单失败, request:{{{JsonConvert.SerializeObject(createOrderRequest)}}}", ex);
            }
            return(result);
        }