예제 #1
0
        /// <summary>
        /// 查看短信配置
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Tuple <List <VipPaintPackageSmsConfig>, int> SelectPackageSmsConfig
            (VipPaintPackageSmsConfig model, int pageIndex, int pageSize)
        {
            var result     = null as List <VipPaintPackageSmsConfig>;
            var totalCount = 0;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                 DalVipPaintPackage.SelectPackageSmsConfig(conn, model, pageIndex, pageSize, out totalCount));
                var vipUsers = new VipBaoYangPackageManager().GetAllBaoYangPackageUser();
                if (result != null && result.Any() && vipUsers != null && vipUsers.Any())
                {
                    result.ForEach(s =>
                    {
                        s.VipUserName = vipUsers.FirstOrDefault(v => string.Equals(v.VipUserId, s.VipUserId.ToString()))?.VipUserName;
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error("SelectVipPaintPackageSmsConfig", ex);
            }
            return(Tuple.Create(result, totalCount));
        }
예제 #2
0
        /// <summary>
        /// 删除塞券详情记录
        /// </summary>
        /// <param name="pkid"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool DeletePromotionDetail(long pkid, string user)
        {
            var result = false;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn => DalVipPaintPackage.GetPromotionDetail(conn, pkid));
                if (oldValue != null)
                {
                    result = dbScopeManagerConfiguration.Execute(conn => DalVipPaintPackage.DeletePromotionDetail(conn, pkid));
                    if (result)
                    {
                        var log = new
                        {
                            ObjectId    = $"PromotionDetail_{pkid}",
                            ObjectType  = "VipPaintPackage",
                            BeforeValue = JsonConvert.SerializeObject(oldValue),
                            AfterValue  = "",
                            Remark      = $"喷漆大客户塞券详情:{oldValue.BatchCode}批次中删除PKID为:{oldValue.PKID}的记录",
                            Creator     = user
                        };
                        LoggerManager.InsertLog("CommonConfigLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("DeletePromotionDetail", ex);
            }
            return(result);
        }
예제 #3
0
        /// <summary>
        /// 获取当前批次相关信息及对应套餐配置
        /// </summary>
        /// <param name="batchCode"></param>
        /// <returns></returns>
        public VipPaintPackageConfigForDetail GetPromotionConfigForDetail(string batchCode)
        {
            var result = null as VipPaintPackageConfigForDetail;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                 DalVipPaintPackage.GetPackageConfigByBatchCode(conn, batchCode));
                if (result != null)
                {
                    using (var client = new PromotionClient())
                    {
                        var clientResult = client.GetCouponRule(result.RuleGUID);
                        clientResult.ThrowIfException(true);
                        if (clientResult.Result != null)
                        {
                            result.RuleId        = clientResult.Result.RuleID;
                            result.PromotionName = clientResult.Result.PromotionName;
                            result.Description   = clientResult.Result.Description;
                        }
                    }
                    result.VipUserName = new VipBaoYangPackageManager().GetAllBaoYangPackageUser()
                                         ?.FirstOrDefault(s => string.Equals(s.VipUserId, result.VipUserId.ToString()))?.VipUserName;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetPromotionConfigForDetail", ex);
            }
            return(result);
        }
예제 #4
0
        /// <summary>
        /// 删除喷漆大客户套餐配置
        /// </summary>
        /// <param name="carNoPrefix"></param>
        /// <param name="surfaceCount"></param>
        /// <param name="servicePid"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool DeletePackageConfig(string packageName, string user)
        {
            var result = true;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                       DalVipPaintPackage.GetPackageConfig(conn, packageName));
                if (oldValue != null)
                {
                    result = dbScopeManagerConfiguration.Execute(conn => DalVipPaintPackage.DeletePackageConfig(conn, oldValue.PKID, user));
                    if (result)
                    {
                        var log = new
                        {
                            ObjectId    = $"PackageConfig_{oldValue.PackageName}",
                            ObjectType  = "VipPaintPackage",
                            BeforeValue = JsonConvert.SerializeObject(oldValue),
                            AfterValue  = "",
                            Remark      = $"删除喷漆大客户套餐:{oldValue.PackageName}的配置",
                            Creator     = user,
                        };
                        LoggerManager.InsertLog("CommonConfigLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                result = false;
                Logger.Error("DeleteVipPaintPackageConfig", ex);
            }
            return(result);
        }
예제 #5
0
        /// <summary>
        /// 查询塞券记录
        /// </summary>
        /// <param name="batchCode"></param>
        /// <param name="moileNumber"></param>
        /// <param name="packagePid"></param>
        /// <param name="vipUserId"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Tuple <List <VipPaintPromotionRecordViewModel>, int> SelectPromotionRecord
            (string batchCode, string moileNumber, string packagePid, Guid vipUserId, int pageIndex, int pageSize)
        {
            var result     = null as List <VipPaintPromotionRecordViewModel>;
            var totalCount = 0;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn => DalVipPaintPackage.SelectPromotionRecord
                                                                     (conn, batchCode, moileNumber, packagePid, vipUserId, pageIndex, pageSize, out totalCount));
                if (result != null && result.Any())
                {
                    var vipUsers = new VipBaoYangPackageManager().GetAllBaoYangPackageUser();
                    if (vipUsers != null && vipUsers.Any())
                    {
                        result.ForEach(s =>
                        {
                            s.VipUserName = vipUsers.FirstOrDefault(v =>
                                                                    string.Equals(v.VipUserId, s.VipUserId.ToString()))?.VipUserName;
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("SelectPromotionRecord", ex);
            }
            return(Tuple.Create(result, totalCount));
        }
예제 #6
0
        /// <summary>
        /// 添加塞券记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool InsertPromotionRecord(VipPaintPackagePromotionRecordModel model)
        {
            var result = false;

            try
            {
                var pkid = dbScopeManagerConfiguration.Execute(conn =>
                                                               DalVipPaintPackage.InsertPromotionRecord(conn, model));
                result = pkid > 0;
                if (pkid > 0)
                {
                    model.PKID               = pkid;
                    model.CreateDateTime     = DateTime.Now;
                    model.LastUpdateDateTime = DateTime.Now;
                    var log = new
                    {
                        ObjectType  = "VipPaintPackage",
                        ObjectId    = $"PromotionRecord_{model.BatchCode}",
                        BeforeValue = "",
                        AfterValue  = JsonConvert.SerializeObject(model),
                        Remark      = $"喷漆大客户套餐塞券,批次号:{model.BatchCode}",
                        Creator     = model.CreateUser
                    };
                    LoggerManager.InsertLog("CommonConfigLog", log);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("InsertBaoYangPackagePromotionRecord", ex);
            }
            return(result);
        }
예제 #7
0
        /// <summary>
        /// 添加或更新短信配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateOrInsertPackageSmsPackage(VipPaintPackageSmsConfig model)
        {
            var result = false;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn => DalVipPaintPackage.GetPackageSendSmsConfig(conn, model.PackageId));
                if (oldValue != null)
                {
                    result = dbScopeManagerConfiguration.Execute(conn => DalVipPaintPackage.UpdatePackageSendSms(conn, model));
                    if (result)
                    {
                        model.PKID               = oldValue.PKID;
                        model.CreateDateTime     = oldValue.CreateDateTime;
                        model.LastUpdateDateTime = DateTime.Now;
                        var log = new
                        {
                            ObjectId    = $"SmsConfig_{model.PackageName}",
                            ObjectType  = "VipPaintPackage",
                            BeforeValue = JsonConvert.SerializeObject(oldValue),
                            AfterValue  = JsonConvert.SerializeObject(model),
                            Remark      = $"喷漆大客户套餐:{model.PackageName}的短信配置由{oldValue.IsSendSms}改为{model.IsSendSms}",
                            Creator     = model.Operator
                        };
                        LoggerManager.InsertLog("CommonConfigLog", log);
                    }
                }
                else
                {
                    var pkid = dbScopeManagerConfiguration.Execute(conn => DalVipPaintPackage.InsertPackageSmsConfig(conn, model));
                    result = pkid > 0;
                    if (result)
                    {
                        model.PKID               = pkid;
                        model.CreateDateTime     = DateTime.Now;
                        model.LastUpdateDateTime = DateTime.Now;
                        var log = new
                        {
                            ObjectId    = $"SmsConfig_{model.PackageName}",
                            ObjectType  = "VipPaintPackage",
                            BeforeValue = "",
                            AfterValue  = JsonConvert.SerializeObject(model),
                            Remark      = $"喷漆大客户套餐:{model.PackageName}的短信配置设置为{model.IsSendSms}",
                            Creator     = model.Operator
                        };
                        LoggerManager.InsertLog("CommonConfigLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpdateOrInsertPackageSmsPackage", ex);
            }
            return(result);
        }
예제 #8
0
        /// <summary>
        /// 文件是否已导入过
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public bool IsExistVipPaintFile(string fileName)
        {
            var result = true;

            try
            {
                result = dbScopeManagerTuhulog.Execute(conn => DalVipPaintPackage.IsExistVipPaintFile(conn, fileName));
            }
            catch (Exception ex)
            {
                Logger.Error("IsExistVipPaintFile", ex);
            }
            return(result);
        }
예제 #9
0
        /// <summary>
        /// 获取喷漆大客户下配置的喷漆套餐
        /// </summary>
        /// <param name="vipUserId"></param>
        /// <returns></returns>
        public List <VipPaintPackageSimpleModel> GetVipPaintPackages(Guid vipUserId)
        {
            var result = null as List <VipPaintPackageSimpleModel>;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn => DalVipPaintPackage.GetVipPaintPackages(conn, vipUserId.ToString()));
            }
            catch (Exception ex)
            {
                Logger.Error("GetVipPaintPackages", ex);
            }
            return(result);
        }
예제 #10
0
        /// <summary>
        /// 喷漆套餐是否存在
        /// </summary>
        /// <param name="packageName"></param>
        /// <param name="pkid"></param>
        /// <returns></returns>
        public bool IsExistPackageConfig(string packageName, int pkid)
        {
            var result = false;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                 DalVipPaintPackage.IsExistPackageConfig(conn, packageName, pkid));
            }
            catch (Exception ex)
            {
                Logger.Error("IsExistVipPaintPackageConfig", ex);
            }
            return(result);
        }
예제 #11
0
        /// <summary>
        /// 塞券记录是否存在
        /// 存在塞券记录的套餐无法删除
        /// </summary>
        /// <param name="packageId"></param>
        /// <returns></returns>
        public bool IsExistPromotionRecord(int packageId)
        {
            var result = true;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                 DalVipPaintPackage.IsExistPromotionRecord(conn, packageId));
            }
            catch (Exception ex)
            {
                Logger.Error("IsExistPromotionRecord", ex);
            }
            return(result);
        }
예제 #12
0
        /// <summary>
        /// 该批次塞券不成功的记录
        /// </summary>
        /// <param name="batchCode"></param>
        /// <returns></returns>
        public int?GetNotSuccessPromotionDtailCount(string batchCode)
        {
            var result = null as int?;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                 DalVipPaintPackage.GetNotSuccessPromotionDtailCount(conn, batchCode));
            }
            catch (Exception ex)
            {
                Logger.Error("GetNotSuccessPromotionDtailCount", ex);
            }
            return(result);
        }
예제 #13
0
        /// <summary>
        /// 之前导入过相同优惠券的记录
        /// 验证优惠券领取限制
        /// </summary>
        /// <param name="ruleGuid"></param>
        /// <param name="mobileNumbers"></param>
        /// <returns></returns>
        private List <VipPaintPromotionTemplateModel> GetImportedPromotionDetail(
            Guid ruleGuid, IEnumerable <string> mobileNumbers)
        {
            var result = new List <VipPaintPromotionTemplateModel>();

            if (ruleGuid != Guid.Empty && mobileNumbers != null && mobileNumbers.Any())
            {
                for (var i = 1; i <= Math.Ceiling(mobileNumbers.Count() * 1.0 / 500); i++)
                {
                    var batchResult = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                              DalVipPaintPackage.SelectImportedPromotionDetail(conn, ruleGuid, mobileNumbers.Skip((i - 1) * 500).Take(500)));
                    result.AddRange(batchResult);
                }
            }
            return(result);
        }
예제 #14
0
        /// <summary>
        /// 塞券详情
        /// </summary>
        /// <param name="batchCode"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Tuple <List <VipPaintPromotionDetailViewModel>, int> SelectPromotionDetail
            (VipPaintPackagePromotionDetail model, int pageIndex, int pageSize)
        {
            var result     = null as List <VipPaintPromotionDetailViewModel>;
            int totalCount = 0;

            try
            {
                result = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                 DalVipPaintPackage.SelectPromotionDetail(conn, model, pageIndex, pageSize, out totalCount));
                result = FillOrderForPromotionDetail(result, model.BatchCode);
            }
            catch (Exception ex)
            {
                Logger.Error("SelectPromotionDetail", ex);
            }
            return(Tuple.Create(result, totalCount));
        }
예제 #15
0
        /// <summary>
        /// 套餐是否发送短信
        /// </summary>
        /// <param name="packageId"></param>
        /// <returns></returns>
        public bool IsPackageSms(int packageId)
        {
            var result = false;//默认不发送短信

            try
            {
                var config = dbScopeManagerProductcatalogRead.Execute(conn =>
                                                                      DalVipPaintPackage.GetPackageSendSmsConfig(conn, packageId));
                if (config != null)
                {
                    result = config.IsSendSms;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("IsPackageSms", ex);
            }
            return(result);
        }
예제 #16
0
        /// <summary>
        /// 获取配置了套餐的喷漆大客户
        /// </summary>
        /// <returns></returns>
        public List <VipSimpleUser> GetPaintVipUsers()
        {
            var result = new List <VipSimpleUser>();

            try
            {
                var vipUserIds  = dbScopeManagerConfiguration.Execute(conn => DalVipPaintPackage.GetPaintVipUsers(conn));
                var allVipUsers = new VipBaoYangPackageManager().GetAllBaoYangPackageUser();
                if (vipUserIds != null && vipUserIds.Any() && allVipUsers != null && allVipUsers.Any())
                {
                    result = allVipUsers.Where(s => vipUserIds.Contains(s.VipUserId)).ToList();
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetAllPaintVipUsers", ex);
                result = null;
            }
            return(result);
        }
예제 #17
0
        /// <summary>
        /// 更新塞券详情记录
        /// </summary>
        /// <param name="pkid"></param>
        /// <param name="mobileNumber"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool UpdatePromotionDetail(long pkid, string mobileNumber, string user)
        {
            var result = false;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn => DalVipPaintPackage.GetPromotionDetail(conn, pkid));
                if (oldValue != null)
                {
                    var remark = $"{user}于{DateTime.Now.ToString("yyyy年MM月dd日 hh:mm")}更新";
                    result = dbScopeManagerConfiguration.Execute(conn => DalVipPaintPackage.UpdatePromotionDetail(conn, pkid, mobileNumber, remark));
                    if (result)
                    {
                        var model = JsonConvert.DeserializeObject <VipPaintPackagePromotionDetail>(JsonConvert.SerializeObject(oldValue));
                        model.MobileNumber       = mobileNumber;
                        model.Status             = Status.WAIT.ToString();
                        model.Remarks            = remark;
                        model.LastUpdateDateTime = DateTime.Now;
                        var log = new
                        {
                            ObjectId    = $"PromotionDetail_{pkid}",
                            ObjectType  = "VipPaintPackage",
                            BeforeValue = JsonConvert.SerializeObject(oldValue),
                            AfterValue  = JsonConvert.SerializeObject(model),
                            Remark      = $"喷漆大客户塞券详情:{oldValue.BatchCode}批次中更新PKID为:{oldValue.PKID}的手机号为{mobileNumber}",
                            Creator     = user
                        };
                        LoggerManager.InsertLog("CommonConfigLog", log);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("UpdatePromotionDetail", ex);
            }
            return(result);
        }
예제 #18
0
        /// <summary>
        /// 添加喷漆大客户套餐配置
        /// </summary>
        /// <param name="model"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool AddPackageConfig(VipPaintPackageConfigModel model)
        {
            var result = false;

            try
            {
                var oldValue = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                       DalVipPaintPackage.GetPackageConfig(conn, model.PackageName));
                dbScopeManagerConfiguration.CreateTransaction
                    (conn =>
                {
                    var addResult = false;
                    if (oldValue == null)
                    {
                        var pkid   = DalVipPaintPackage.AddPackageConfig(conn, model);
                        addResult  = pkid > 0;
                        model.PKID = addResult ? pkid : 0;
                    }
                    if (addResult)
                    {
                        model.PackagePid = $"FU-PQXB-KAT|{model.PKID.ToString()}";
                        var pidResult    = DalVipPaintPackage.UpdatePackagePID(conn, model.PKID, model.PackagePid);
                        if (pidResult)
                        {
                            var packagePid = CreatePaintPackageProduct(model.PKID.ToString(), model.PackageName, model.Operator);
                            if (string.IsNullOrWhiteSpace(packagePid))
                            {
                                throw new Exception($"CreatePaintPackageProduct失败,待创建产品{JsonConvert.SerializeObject(model)}");
                            }
                            else if (!string.Equals(packagePid, model.PackagePid))
                            {
                                model.PackagePid = packagePid;
                                result           = DalVipPaintPackage.UpdatePackagePID(conn, model.PKID, model.PackagePid);
                            }
                            else
                            {
                                result = true;
                            }
                        }
                        else
                        {
                            throw new Exception($"AddVipPackageConfig失败,待插入配置{JsonConvert.SerializeObject(model)}");
                        }
                    }
                });
                if (result)
                {
                    model.CreateDateTime     = DateTime.Now;
                    model.LastUpdateDateTime = DateTime.Now;
                    var log = new
                    {
                        ObjectId    = $"PackageConfig_{model.PackageName}",
                        ObjectType  = "VipPaintPackage",
                        BeforeValue = "",
                        AfterValue  = JsonConvert.SerializeObject(model),
                        Remark      = $"添加喷漆大客户套餐:{model.PackageName}的配置",
                        Creator     = model.Operator
                    };
                    LoggerManager.InsertLog("CommonConfigLog", log);
                }
            }
            catch (Exception ex)
            {
                result = false;
                Logger.Error("AddVipPackageConfig", ex);
            }
            return(result);
        }
예제 #19
0
        /// <summary>
        /// 填充订单信息至塞券详情记录
        /// </summary>
        /// <param name="models"></param>
        /// <param name="batchCode"></param>
        /// <returns></returns>
        private List <VipPaintPromotionDetailViewModel> FillOrderForPromotionDetail(List <VipPaintPromotionDetailViewModel> models, string batchCode)
        {
            var package = dbScopeManagerProductcatalogRead.Execute(conn =>
                                                                   DalVipPaintPackage.GetPackageConfigByBatchCode(conn, batchCode));
            var promotions   = null as List <PromotionCodeModel>;
            var promotionIds = models?.Where(w => w.PromotionId > 0).Select(s => s.PromotionId).ToList();

            if (promotionIds != null && promotionIds.Any())
            {
                using (var client = new PromotionClient())
                {
                    promotions = client.GetPromotionCodeByIDs(new GetPromotionCodesRequest()
                    {
                        PKIDList = promotionIds
                    }).Result?.ToList();
                }
            }
            if (package != null && string.Equals(package.SettlementMethod, SettlementMethod.ByPeriod.ToString()))
            {
                if (promotions != null && promotions.Any())
                {
                    promotions.ForEach(f =>
                    {
                        var detail = models.FirstOrDefault(s => s.PromotionId == f.Pkid);
                        var status = GetPromotionStatus(f.Status);
                        if (detail != null)
                        {
                            detail.ToCOrder = f.OrderId > 0 ? Convert.ToString(f.OrderId) : string.Empty;
                            if (f.OrderId > 0)
                            {
                                using (var orderClient = new Service.Order.OrderQueryClient())
                                {
                                    var orderResult = orderClient.GetOrderRelationShip(f.OrderId);
                                    if (orderResult.Success && orderResult.Result != null && orderResult.Result.Any())
                                    {
                                        var toBOrder    = orderResult.Result.FirstOrDefault().Value?.FirstOrDefault();
                                        detail.ToBOrder = string.IsNullOrEmpty(toBOrder) ? detail.ToBOrder : toBOrder;
                                    }
                                }
                            }
                            detail.Status = string.IsNullOrEmpty(status) ? detail.Status : status;
                        }
                    });
                }
            }
            else if (package != null && string.Equals(package.SettlementMethod, SettlementMethod.PreSettled.ToString()))
            {
                var record = dbScopeManagerConfigurationRead.Execute(conn =>
                                                                     DalVipPaintPackage.GetPromotionRecord(conn, batchCode));
                if (promotions != null && promotions.Any())
                {
                    promotions.ForEach(f =>
                    {
                        var detail = models.FirstOrDefault(s => s.PromotionId == f.Pkid);
                        var status = GetPromotionStatus(f.Status);
                        if (detail != null)
                        {
                            detail.ToCOrder = f.OrderId > 0 ? Convert.ToString(f.OrderId) : string.Empty;
                            detail.Status   = string.IsNullOrEmpty(status) ? detail.Status : status;
                        }
                    });
                }
                if (record != null && !string.IsNullOrWhiteSpace(record.ToBOrder))
                {
                    models?.ForEach(s => s.ToBOrder = record.ToBOrder);
                }
            }
            return(models);
        }
예제 #20
0
        /// <summary>
        /// 作废券
        /// </summary>
        /// <param name="promotionIds"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public Dictionary <int, bool> InvalidCodes(List <int> promotionIds, string user)
        {
            Dictionary <int, bool> result = new Dictionary <int, bool>();

            try
            {
                List <PromotionCodeModel> promotionCodes = new List <PromotionCodeModel>();
                using (var client = new PromotionClient())
                {
                    var serviceResult = client.GetPromotionCodeByIDs(new GetPromotionCodesRequest()
                    {
                        PKIDList = promotionIds
                    });
                    if (serviceResult.Success)
                    {
                        promotionCodes = serviceResult.Result.ToList();
                    }
                }
                foreach (var code in promotionCodes)
                {
                    using (var client = new PromotionClient())
                    {
                        var serviceResult = client.UpdateUserPromotionCodeStatus(new UpdateUserPromotionCodeStatusRequest()
                        {
                            Status          = 3,
                            PromotionCodeId = code.Pkid,
                            OperationAuthor = user,
                            Channel         = "setting.tuhu.cn",
                            UserID          = Guid.Parse(code.UserId)
                        });
                        if (serviceResult.Exception != null)
                        {
                            Logger.Error(serviceResult.Exception);
                        }
                        result[code.Pkid] = serviceResult.Success && serviceResult.Result;
                    }
                }

                foreach (var item in result)
                {
                    if (item.Value)
                    {
                        var log = new
                        {
                            ObjectId    = $"PromotionDetail_{item.Key}",
                            ObjectType  = "VipPaintPackage",
                            BeforeValue = JsonConvert.SerializeObject(item),
                            AfterValue  = "",
                            Remark      = $"喷漆大客户作废券:{user}于{DateTime.Now.ToString("yyyy年MM月dd日 hh:mm")}作废券Id{item.Key}",
                            Creator     = user
                        };
                        LoggerManager.InsertLog("CommonConfigLog", log);
                        dbScopeManagerConfiguration.Execute(conn =>
                                                            DalVipPaintPackage.UpdatePromotionDetailRemark(conn, item.Key, $"{user}于{DateTime.Now.ToString("yyyy年MM月dd日 hh:mm")}作废此券"));
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("InvalidCodes", ex);
            }
            return(result);
        }