Beispiel #1
0
        public ResultDTO SaveApply(DistributApplyFullDTO dto)
        {
            base.Do();
            Stopwatch timer = new Stopwatch();

            timer.Start();
            var result = this.SaveApplyExt(dto);

            timer.Stop();
            LogHelper.Debug(string.Format("DistributorSV.SaveApply:耗时:{0}。入参:dto:{1},\r\n出参:{2}", timer.ElapsedMilliseconds, JsonHelper.JsonSerializer(dto), JsonHelper.JsonSerializer(result)));
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 添加申请成为分销商资料
        /// </summary>
        /// <param name="userCode"></param>
        /// <param name="userId"></param>
        /// <param name="ruleId"></param>
        /// <param name="distributApplyFullDto"></param>
        /// <returns></returns>
        public ResultDTO AddDistributionIdentityInfo(string userCode, string userId, string ruleId,
                                                     DistributApplyFullDTO distributApplyFullDto)
        {
            base.Do();
            Stopwatch timer = new Stopwatch();

            timer.Start();
            var result = this.AddDistributionIdentityInfoExt(userCode, userId, ruleId, distributApplyFullDto);

            timer.Stop();
            Jinher.JAP.Common.Loging.LogHelper.Debug(string.Format("DistributeBP.AddDistributionIdentityInfo:耗时:{0}。",
                                                                   timer.ElapsedMilliseconds));
            return(result);
        }
Beispiel #3
0
        public ResultDTO SaveApply(DistributApplyFullDTO dto)
        {
            //定义返回值
            Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO result;

            try
            {
                //调用代理方法
                result = base.Channel.SaveApply(dto);
            }
            catch
            {
                //抛异常
                throw;
            }
            finally
            {
                //关链接
                ChannelClose();
            }            //返回结果
            return(result);
        }
Beispiel #4
0
 /// <summary>
 /// 添加申请成为分销商资料
 /// </summary>
 /// <returns></returns>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddDistributionIdentityInfo(string userCode, string userId,
                                                                              string ruleId, DistributApplyFullDTO distributApplyFullDto)
 {
     base.Do();
     return(this.Command.AddDistributionIdentityInfo(userCode, userId, ruleId, distributApplyFullDto));
 }
Beispiel #5
0
        /// <summary>
        /// 添加或编辑申请成为分销商资料
        /// </summary>
        /// <param name="userCode"></param>
        /// <param name="userId"></param>
        /// <param name="ruleId"></param>
        /// <param name="distributApplyFullDto"></param>
        /// <returns></returns>
        public ResultDTO AddDistributionIdentityInfoExt(string userCode, string userId, string ruleId, DistributApplyFullDTO distributApplyFullDto)
        {
            var result = new ResultDTO {
                isSuccess = false
            };

            try
            {
                if (string.IsNullOrEmpty(userId) || (string.IsNullOrEmpty(ruleId) || distributApplyFullDto == null))
                {
                    result.Message = "参数不能为空";
                    return(result);
                }

                var drId = Guid.NewGuid();
                var distributionApply = DistributionApply.ObjectSet().FirstOrDefault(t => t.RuleId == new Guid(ruleId) && t.UserId == new Guid(userId));
                //新增
                if (distributionApply == null)
                {
                    var         dr    = DistributionRule.ObjectSet().FirstOrDefault(t => t.Id == new Guid(ruleId));
                    List <Guid> users = new List <Guid> {
                        new Guid(userId)
                    };
                    var user = CBCSV.Instance.GetUserInfoWithAccountList(users)[0];

                    var da = new DistributionApply()
                    {
                        Id          = drId,
                        SubTime     = distributApplyFullDto.ModifiedOn = DateTime.Now,
                        HasIdentity = dr != null && dr.NeedIdentity,
                        RuleId      = new Guid(ruleId),
                        UserId      = new Guid(userId),
                        UserCode    = userCode,
                        UserName    = user.Name,
                        PicturePath = user.HeadIcon,
                        Remarks     = "",
                        ParentId    = distributApplyFullDto.ParentId,
                        State       = DistributeApplyStateEnum.Other,
                        EntityState = EntityState.Added
                    };
                    ContextFactory.CurrentThreadContext.SaveObject(da);
                }
                //修改
                else
                {
                    drId = distributionApply.Id;
                }

                //先删除相关审核内容
                var distributionIdentityList = DistributionIdentity.ObjectSet().Where(t => t.RuleId == new Guid(ruleId) && t.SubId == new Guid(userId));
                foreach (var distributionIdentity in distributionIdentityList)
                {
                    distributionIdentity.EntityState = EntityState.Deleted;
                    ContextFactory.CurrentThreadContext.SaveObject(distributionIdentity);
                }
                if (distributApplyFullDto.DistributionIdentityFullDtos != null)
                {
                    if (distributionApply != null)
                    {
                        distributionApply.State      = !distributApplyFullDto.IsModified ? DistributeApplyStateEnum.PendingAudit : DistributeApplyStateEnum.AuditAgain;
                        distributionApply.ModifiedOn = DateTime.Now;
                        ContextFactory.CurrentThreadContext.SaveObject(distributionApply);
                    }

                    ResultDTO resultDto = SaveDistributionIdentity(drId, new Guid(ruleId), distributApplyFullDto.DistributionIdentityFullDtos);
                    if (resultDto.isSuccess == false)
                    {
                        result.Message = "保存申请信息失败";
                        return(result);
                    }
                }
                else
                {
                    //添加不同用户的审核资料
                    var distributionIdentitySetList = DistributionIdentitySet.ObjectSet().Where(t => t.RuleId == new Guid(ruleId) && !t.IsDel);
                    var i = 0;
                    foreach (var distributionIdentitySet in distributionIdentitySetList)
                    {
                        var di = new DistributionIdentity
                        {
                            Id            = Guid.NewGuid(),
                            SubTime       = DateTime.Now,
                            ModifiedOn    = DateTime.Now,
                            SubId         = ContextDTO.LoginUserID,
                            ModifiedId    = ContextDTO.LoginUserID,
                            Name          = distributionIdentitySet.Name,
                            IdentitySetId = distributionIdentitySet.Id,
                            RuleId        = new Guid(ruleId),
                            ApplyId       = drId,
                            ValueType     = distributionIdentitySet.ValueType,
                            Value         = "",
                            NameCategory  = i,
                            EntityState   = EntityState.Added
                        };
                        ContextFactory.CurrentThreadContext.SaveObject(di);
                        i++;
                    }
                }

                int esActivityCount = ContextFactory.CurrentThreadContext.SaveChanges();
                if (esActivityCount > 0)
                {
                    result.isSuccess = true;
                    result.Message   = Convert.ToString(drId);
                }
                else
                {
                    result.Message = "添加失败";
                }
                return(result);
            }
            catch (Exception ex)
            {
                LogHelper.Error("AddDistributionIdentityInfoExt异常,异常信息:", ex);

                result.isSuccess = false;
                result.Message   = "出现异常";
                return(result);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 添加申请成为分销商资料
        /// </summary>
        /// <param name="userCode"></param>
        /// <param name="userId"></param>
        /// <param name="ruleId"></param>
        /// <param name="distributApplyFullDto"></param>
        /// <returns></returns>
        public ResultDTO AddDistributionIdentityInfo(string userCode, string userId, string ruleId, DistributApplyFullDTO distributApplyFullDto)
        {
            //定义返回值
            ResultDTO result;

            try
            {
                //调用代理方法
                result = base.Channel.AddDistributionIdentityInfo(userCode, userId, ruleId, distributApplyFullDto);
            }
            catch
            {
                //抛异常
                throw;
            }
            finally
            {
                //关链接
                ChannelClose();
            }            //返回结果
            return(result);
        }
Beispiel #7
0
 private ResultDTO SaveApplyExt(DistributApplyFullDTO dto)
 {
     throw new NotImplementedException();
 }