Exemplo n.º 1
0
        public static bool DeleteBeautyServicePackage(int pkid, BeautyServicePackage oldValue, string operateUser)
        {
            bool result = false;

            try
            {
                result = BeautyServicePackageDal.DeleteBeautyServicePackage(pkid);
                var log = new BeautyOprLog
                {
                    LogType     = "DeleteBeautyServicePackage",
                    IdentityID  = $"{pkid}",
                    OldValue    = JsonConvert.SerializeObject(oldValue),
                    NewValue    = null,
                    Remarks     = $"删除集团客户礼包,礼包ID:{pkid}",
                    OperateUser = operateUser,
                };
                LoggerManager.InsertLog("BeautyOprLog", log);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            };

            return(result);
        }
Exemplo n.º 2
0
        public static bool InsertBeautyServicePackage(BeautyServicePackage package)
        {
            bool result = false;

            try
            {
                var insertResult = BeautyServicePackageDal.InsertBeautyServicePackage(package);
                result = insertResult.Item1;
                var log = new BeautyOprLog
                {
                    LogType     = "InsertBeautyServicePackage",
                    IdentityID  = $"{insertResult.Item2}",
                    OldValue    = null,
                    NewValue    = JsonConvert.SerializeObject(package),
                    Remarks     = $"插入集团客户礼包",
                    OperateUser = package.CreateUser,
                };
                LoggerManager.InsertLog("BeautyOprLog", log);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            };

            return(result);
        }
        public ActionResult UpsertBeautyServicePackage(BeautyServicePackage package)
        {
            bool isSuccess = false;
            var  msg       = string.Empty;
            var  user      = HttpContext.User.Identity.Name;

            if (package != null && !string.IsNullOrEmpty(package.PackageName) && package.CooperateId > 0)
            {
                var manager       = new BankMRManager();
                var cooperateUser = manager.FetchMrCooperateUserConfigByPKID(package.CooperateId);
                if (cooperateUser != null)
                {
                    package.VipUserId = cooperateUser.VipUserId;
                    using (var client = new UserAccountClient())
                    {
                        var userServiceResult = client.SelectCompanyUserInfo(cooperateUser.VipUserId);
                        if (userServiceResult.Success && userServiceResult.Result != null)
                        {
                            package.VipUserName = userServiceResult.Result.UserName;
                            if (userServiceResult.Result.CompanyInfo != null)
                            {
                                package.VipCompanyId   = userServiceResult.Result.CompanyInfo.Id;
                                package.VipCompanyName = userServiceResult.Result.CompanyInfo.Name;
                            }
                        }
                    }
                }

                if (package.PKID > 0)
                {
                    package.UpdateUser = user;
                    isSuccess          = BeautyServicePackageManager.UpdateBeautyServicePackage(package);
                }
                else
                {
                    package.CreateUser = user;
                    isSuccess          = BeautyServicePackageManager.InsertBeautyServicePackage(package);
                }
                if (!isSuccess)
                {
                    msg = "更新失败";
                }
                else
                {
                    msg = "成功";
                }
            }
            else
            {
                msg = "信息不完善";
            }

            return(Json(new { IsSuccess = isSuccess, Msg = msg }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public static BeautyServicePackage GetBeautyServicePackage(int packageId)
        {
            BeautyServicePackage result = null;

            try
            {
                result = BeautyServicePackageDal.SelectBeautyServicePackage(packageId);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            };

            return(result);
        }
Exemplo n.º 5
0
        public static bool UpdateBeautyServicePackage(BeautyServicePackage package)
        {
            bool result = false;

            try
            {
                var oldValue = GetBeautyServicePackage(package.PKID);
                var writeStr = BeautyServicePackageDal.GetTuhuGrouponWriteConnstr();
                using (var dbhelper = new SqlDbHelper(writeStr))
                {
                    dbhelper.BeginTransaction();
                    var updateBeautyServicePackageResult = BeautyServicePackageDal.UpdateBeautyServicePackage(dbhelper, package);
                    BeautyServicePackageDal.UpdateBeautyServicePackageDetailCooperateIdByPackageId(dbhelper, package.PKID, package.CooperateId);
                    if (!updateBeautyServicePackageResult)
                    {
                        throw new Exception("更新兑换码配置失败");
                    }
                    if (package.IsPackageCodeGenerated && (package.PackageCodeStartTime != oldValue.PackageCodeStartTime ||
                                                           package.PackageCodeEndTime != oldValue.PackageCodeEndTime))
                    {
                        var updateBeautyServicePackageCodeTimeResult = BeautyServicePackageDal.UpdateBeautyServicePackageCodeTime(dbhelper, package.PKID, package.PackageCodeStartTime, package.PackageCodeEndTime);
                        if (!updateBeautyServicePackageCodeTimeResult)
                        {
                            throw new Exception("更新兑换码时间失败");
                        }
                    }
                    dbhelper.Commit();
                    result = true;
                    var log = new BeautyOprLog
                    {
                        LogType     = "UpdateBeautyServicePackage",
                        IdentityID  = $"{package.PKID}",
                        OldValue    = JsonConvert.SerializeObject(oldValue),
                        NewValue    = JsonConvert.SerializeObject(package),
                        Remarks     = $"修改集团客户礼包,礼包ID为:{package.PKID}",
                        OperateUser = package.UpdateUser,
                    };
                    LoggerManager.InsertLog("BeautyOprLog", log);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
            };

            return(result);
        }
Exemplo n.º 6
0
        public static async Task <CreateOrderResult> CreatePackageCodeOrderForVipUser(BeautyServicePackage package, IEnumerable <BeautyServicePackageDetail> packageDetails)
        {
            var vipuserInfo = await GetCompanyUserInfo(package.VipUserId);

            var totalMoney         = packageDetails.Sum(t => t.VipSettlementPrice * t.Num) * package.PackageCodeNum;
            var createOrderRequest = new CreateOrderRequest
            {
                OrderChannel = orderChannel,
                OrderType    = orderType,
                Status       = OrderEnum.OrderStatus.New,
                Customer     = new OrderCustomer()
                {
                    UserId   = package.VipUserId,
                    UserName = package.VipUserName,// wesureUser.Profile?.UserName,
                    UserTel  = vipuserInfo.UserMobile
                },
                Delivery = new OrderDelivery
                {
                    DeliveryStatus = OrderEnum.DeliveryStatus.NotStarted,
                    DeliveryType   = OrderEnum.DeliveryType.NoDelivery,
                    InstallType    = OrderEnum.InstallType.NoInstall,
                },
                Payment = new OrderPayment
                {
                    PayStatus   = OrderEnum.PayStatus.Waiting,
                    PayMothed   = OrderEnum.PayMethod.MonthPay,
                    PaymentType = "5Special",
                },
                Money = new OrderMoney()
                {
                    SumMoney       = totalMoney,
                    SumMarkedMoney = totalMoney
                },
                Items = packageDetails.Select(p => new OrderItem()
                {
                    Price    = p.VipSettlementPrice,
                    Pid      = p.PID,
                    Num      = package.PackageCodeNum * p.Num,
                    Name     = p.Name,
                    Category = (GetProduct(p.PID))?.Category
                }),
                BigCustomerCompanyId   = vipuserInfo.CompanyInfo?.Id,
                BigCustomerCompanyName = vipuserInfo.CompanyInfo?.Name,
                SumNum = packageDetails.Sum(t => t.Num) * package.PackageCodeNum
            };
            var result = await CreateOrder(createOrderRequest);

            if (result.OrderId > 0)
            {
                ExecuteOrderProcess(new ExecuteOrderProcessRequest()
                {
                    CreateBy         = vipuserInfo.UserName,
                    OrderId          = result.OrderId,
                    OrderProcessEnum = OrderProcessEnum.GeneralCompleteToHome,
                    PayMethod        = OrderEnum.PayMethod.MonthPay
                });
            }
            return(result);
        }