/// <summary>
        /// 获取参与人名字
        /// </summary>
        /// <param name="businessUuid"></param>
        /// <returns></returns>
        private static string SelectName(Guid businessUuid)
        {
            var systemUserName = "";

            using var c1 = new HaikanCRMContext();

            var participantIds = c1.Business.Where(x => x.BusinessUuid == businessUuid).ToList()[0].SystemUserUuid;//参与人uuid

            if (string.IsNullOrEmpty(participantIds))
            {
                return(systemUserName);
            }

            var patCount = participantIds.Split(',');

            for (var i = 0; i < patCount.Length; i++)
            {
                if (patCount[i] != "")
                {
                    systemUserName += c1.SystemUser.Where(x => x.SystemUserUuid == Guid.Parse(patCount[i])).ToList()[0]
                                      .RealName + ",";
                }
            }

            return(systemUserName);
        }
        /// <summary>
        /// 获取参与人名字
        /// </summary>
        /// <param name="contactBusName"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        private static string SelectNameLog(string contactBusName, HaikanCRMContext context)
        {
            string systemUserName;

            //var response = ResponseModelFactory.CreateResultInstance;
            if (contactBusName.Substring(contactBusName.Length - 1) == ",")
            {
                contactBusName = contactBusName.Substring(0, contactBusName.Length - 1);
            }
            var ids = contactBusName.Split(',');

            for (int i = 0; i < ids.Length; i++)
            {
                ids[i] = "'" + ids[i] + "'";
            }
            var idstr = string.Join(",", ids);

            //select stuff((select ',' + ContactName from ContactPerson where ContactPersonUUID in (
            var sql    = string.Format("select stuff((select ',' + ContactName from ContactPerson where ContactPersonUUID in ({0}) for xml path('')),1,1,'') as Names ", idstr);
            var cNames = context.Database.FromSql <CNames>(sql);

            systemUserName = cNames[0].Names;

            return(systemUserName);
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="mapper"></param>
 public UserController(HaikanCRMContext dbContext, IMapper mapper, IOptions <MdDesEncrypt> mdDesEncrypt, IOptions <AppAuthenticationSettings> appSettings)
 {
     _appSettings = appSettings.Value;
     _dbContext   = dbContext;
     _mapper      = mapper;
     MdDesEncrypt = mdDesEncrypt.Value;
 }
        /// <summary>
        /// 根据uuid查客户经理的名字
        /// </summary>
        /// <param name="clientUuid"></param>
        /// <returns></returns>
        private static string CooM(Guid?clientUuid)
        {
            string clientManager = "";

            using (HaikanCRMContext c1 = new HaikanCRMContext())
            {
                var query  = c1.Customer.FirstOrDefault(x => x.ClientUuid == clientUuid);
                var query2 = c1.SystemUser.FirstOrDefault(x => x.SystemUserUuid == query.ClientManager);
                if (query2 != null)
                {
                    clientManager = query2.RealName;
                }
                return(clientManager);
            }
        }
        /// <summary>
        /// 通过联系人uuid查询联系人名称
        /// </summary>
        /// <param name="contactPersonUuid"></param>
        /// <returns></returns>
        private static string SelectName(Guid contactPersonUuid)
        {
            string contactName = "";

            //var response = ResponseModelFactory.CreateResultInstance;
            using (HaikanCRMContext c1 = new HaikanCRMContext())
            {
                var participantids = c1.ContactPerson.FirstOrDefault(x => x.ContactPersonUuid == contactPersonUuid);
                var query          = c1.Customer.FirstOrDefault(x => x.ClientUuid == participantids.ClientUuid);
                if (query != null)
                {
                    if (participantids != null)
                    {
                        contactName = participantids.ContactName + "(" + query.ClientName + ")";
                    }
                }
            }
            return(contactName);
        }
        /// <summary>
        /// 计算用户当天的联系记录数量
        /// </summary>
        /// <param name="SystemUserUuid"></param>
        /// <returns></returns>
        private static int Xxdd(Guid SystemUserUuid)
        {
            int txlu = 0;

            using (HaikanCRMContext c1 = new HaikanCRMContext())
            {
                var que = c1.Customer.Where(x => x.ClientManager == SystemUserUuid);

                var d5 = DateTime.Now.ToString("yyyy-MM-dd");
                if (que.ToList().Count > 0)
                {
                    for (int i = 0; i < que.ToList().Count; i++)
                    {
                        txlu += c1.ContactCallLog.Count(x => x.ClientUuid == que.ToList()[i].ClientUuid && x.CallTime.Substring(0, 10) == d5);
                    }
                }
            }

            return(txlu);
        }
        private string GetroleName(string ids)
        {
            string s = "";

            string[] temp = ids.TrimEnd(',').Split(',');
            using (HaikanCRMContext cc = new HaikanCRMContext())
            {
                for (int i = 0; i < temp.Length; i++)
                {
                    if (!string.IsNullOrEmpty(temp[i]))
                    {
                        var qu = cc.SystemRole.Where(x => x.SystemRoleUuid == Guid.Parse(temp[i])).Select(x => new { x.RoleName }).ToList();
                        if (!string.IsNullOrEmpty(qu[0].RoleName))
                        {
                            s += qu[0].RoleName + ",";
                        }
                    }
                }
                return(s.TrimEnd(','));
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="appSettings"></param>
 public OauthController(IOptions <AppAuthenticationSettings> appSettings, HaikanCRMContext dbContext, IOptions <MdDesEncrypt> mdDesEncrypt)
 {
     _appSettings = appSettings.Value;
     _dbContext   = dbContext;
     MdDesEncrypt = mdDesEncrypt.Value;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 public AppMessageController(HaikanCRMContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 public IndexStatisticsController(HaikanCRMContext dbContext)
 {
     _dbContext = dbContext;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="mapper"></param>
 public PermissionController(HaikanCRMContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 public AppContactController(HaikanCRMContext dbContext)
 {
     _dbContext = dbContext;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 public BusinessController(HaikanCRMContext dbContext)
 {
     _dbContext = dbContext;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 public AppCustomerController(HaikanCRMContext dbContext)
 {
     _dbContext = dbContext;
 }
Beispiel #15
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="hostingEnvironment"></param>
 public ContactController(HaikanCRMContext dbContext, IWebHostEnvironment hostingEnvironment)
 {
     _dbContext          = dbContext;
     _webHostEnvironment = hostingEnvironment;
 }
Beispiel #16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="mapper"></param>
 public RoleController(HaikanCRMContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
 /// <summary>
 ///构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="iWebHostEnvironment"></param>
 public GlobalController(HaikanCRMContext dbContext, IWebHostEnvironment iWebHostEnvironment)
 {
     _dbContext = dbContext;
     //_mapper = mapper;
     _hostEnv = iWebHostEnvironment;
 }
Beispiel #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dbContext"></param>
 public AccountController(HaikanCRMContext dbContext)
 {
     _dbContext = dbContext;
 }
Beispiel #19
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 /// <param name="hostingEnvironment"></param>
 public BusinessDocumentsController(HaikanCRMContext dbContext, IWebHostEnvironment hostingEnvironment)
 {
     _dbContext          = dbContext;
     _hostingEnvironment = hostingEnvironment;
 }
Beispiel #20
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbContext"></param>
 public AppCallLogController(HaikanCRMContext dbContext)
 {
     _dbContext = dbContext;
 }