Beispiel #1
0
        /// <summary>
        /// 校验用户信息
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="rm"></param>
        /// <returns></returns>
        public ReturnMsg CheckSysUsrInfo(SysUsrMstrDto dto, ReturnMsg rm)
        {
            if (string.IsNullOrEmpty(dto.USR_NAME))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入用户名";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.USR_PWD))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入密码";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.USR_MOBILE))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入用户手机";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.USR_TYPE))
            {
                rm.IsSuccess = false;
                rm.msg       = "请选择账号类型";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.USR_REAL_NAME))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入真实姓名";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.ERP_EMP_ID))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入员工编码";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.ORG_NO))
            {
                rm.IsSuccess = false;
                rm.msg       = "请选择所属机构";
                return(rm);
            }
            var result = new List <SysUsrMstr>();

            dto.USR_PWD = Encrypt.Md5Hash(dto.USR_PWD);
            result      = dto.Id == 0 ? _sysUsrMstrRepository.GetAllList(c => c.USR_NAME == dto.USR_NAME && c.USR_PWD == dto.USR_PWD && c.DEL_FLAG == 1)
                : _sysUsrMstrRepository.GetAllList(c => c.USR_NAME == dto.USR_NAME && c.USR_PWD == dto.USR_PWD && c.Id != dto.Id & c.DEL_FLAG == 1);
            if (result.Count > 0)
            {
                rm.IsSuccess = false;
                rm.msg       = "用户名/密码已存在,请重新输入";
                return(rm);
            }
            result = dto.Id == 0 ? _sysUsrMstrRepository.GetAllList(c => c.USR_MOBILE == dto.USR_MOBILE && c.DEL_FLAG == 1 && c.ORG_NO == dto.ORG_NO)
                : _sysUsrMstrRepository.GetAllList(c => c.USR_MOBILE == dto.USR_MOBILE && c.Id != dto.Id & c.DEL_FLAG == 1 && c.ORG_NO == dto.ORG_NO);
            if (result.Count > 0)
            {
                rm.IsSuccess = false;
                rm.msg       = "该手机已存在,请重新输入";
                return(rm);
            }
            result = dto.Id == 0 ? _sysUsrMstrRepository.GetAllList(c => c.ERP_EMP_ID == dto.ERP_EMP_ID && c.DEL_FLAG == 1 && c.ORG_NO == dto.ORG_NO)
                : _sysUsrMstrRepository.GetAllList(c => c.ERP_EMP_ID == dto.ERP_EMP_ID && c.Id != dto.Id & c.DEL_FLAG == 1 && c.ORG_NO == dto.ORG_NO);
            if (result.Count > 0)
            {
                rm.IsSuccess = false;
                rm.msg       = "该员工代码已存在,请重新输入";
                return(rm);
            }
            rm.IsSuccess = true;

            return(rm);
        }
Beispiel #2
0
        /// <summary>
        /// 分配预约专员
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="basInfo"></param>
        /// <param name="log"></param>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public bool GetWxUsrAptInfo(AptInfo obj, WctBasConfig basInfo, Log log, ref SysUsrMstr userInfo)
        {
            bool ret = true;

            try
            {
                var usrList   = new List <SysUsrMstr>();
                var job       = obj.APT_TYPE == 1 ? basInfo.SALE_APT : basInfo.AFTER_SALE_APT;
                var salescode = "";
                //查询微信粉丝信息
                string where = string.Format(" OPEN_ID='{0}' and BG_NO='{1}' and FOLLOW_STATUS=1 and DEL_FLAG=1", obj.openId, obj.BG_NO);
                var wctInfo = _sysUsrWctRepository.FirstOrDefault(c => c.OPEN_ID == obj.openId && c.BG_NO == obj.BG_NO && c.DEL_FLAG == 1);
                if (wctInfo == null)
                {
                    ret = false;
                    log.Write("该粉丝信息不存在或未关注公众号!");
                    return(ret);
                }
                var sql = string.Format("ORG_NO='{0}' and DEL_FLAG=1", obj.orgNo);
                usrList = _sysUsrMstrRepository.GetAllList(c => c.ORG_NO == obj.orgNo && c.USR_TYPE == "2" && c.DEL_FLAG == 1);
                //未绑定预约专员
                if (string.IsNullOrEmpty(obj.APT_TYPE == 1 ? wctInfo.CUS_SVC_CODE : wctInfo.AFTER_SALE_CODE))
                {
                    //绑定销售顾问
                    userInfo = GetAptUser(usrList, wctInfo, job);
                    if (userInfo != null)
                    {
                        log.Write("绑定成功");
                    }
                    else
                    {
                        log.Write("绑定失败");
                        ret = false;
                        return(ret);
                    }
                    salescode = userInfo.ERP_EMP_ID;//赋值预约专员erp编码
                }
                else
                {
                    //查询绑定的预约专员是否存在
                    salescode = obj.APT_TYPE == 1 ? wctInfo.CUS_SVC_CODE : wctInfo.AFTER_SALE_CODE;
                    userInfo  = usrList.Where(c => c.ERP_EMP_ID == salescode && c.USR_JOB == job).FirstOrDefault();
                    if (userInfo == null)
                    {
                        //重新绑定销售顾问
                        userInfo = GetAptUser(usrList, wctInfo, job);
                        if (userInfo != null)
                        {
                            log.Write("更新绑定成功");
                        }
                        else
                        {
                            log.Write("更新绑定失败");
                            ret = false;
                            return(ret);
                        }
                        salescode = userInfo.ERP_EMP_ID;
                    }
                    else
                    {
                        salescode = userInfo.ERP_EMP_ID;
                        log.Write("该粉丝已绑定预约专员");
                    }
                }
                if (obj.APT_TYPE == 1 && wctInfo.CUS_SVC_CODE != salescode)
                {
                    wctInfo.CUS_SVC_CODE = salescode;
                    _sysUsrWctRepository.Update(wctInfo);
                }
                if (obj.APT_TYPE == 2 && wctInfo.AFTER_SALE_CODE != salescode)
                {
                    wctInfo.AFTER_SALE_CODE = salescode;
                    _sysUsrWctRepository.Update(wctInfo);
                }
            }
            catch (Exception ex)
            {
                log.Write("" + ex.Message + "");
            }
            return(ret);
        }