コード例 #1
0
        public IActionResult List1(CallLogRequstPaload payload)
        {
            using (_dbContext)
            {
                using (_dbContext)
                {
                    var query = from c1 in _dbContext.ContactCallLog
                                join c2 in _dbContext.ContactPerson
                                on c1.ContactPersonUuid equals c2.ContactPersonUuid
                                where c1.IsDelete == 0
                                //& c2.SystemUserUuid == Guid.Parse(payload.Kw)

                                select new
                    {
                        c1.Id,
                        c1.CallContent,
                        c1.CallTime,
                        c1.CallLogUuid,
                        c2.ContactName,
                        Manager = c2.ClientUu.ClientManager,
                        c1.ClientUu.ClientName,
                        ClientManager = CooM(c1.ClientUuid),
                        c1.ClientUuid,
                        c1.SheBeiId,
                        c1.BusinessUuid,
                        c1.ContactDetailsUuid,
                        businessName = c1.BusinessUu.BusinessName,
                        cdName       = c1.ContactDetailsName,
                        //cdText = c1.ContactDetailsUuid == null ? "" : c1.ContactDetailsUuid != null ? SleectText(c1.ContactDetailsUuid) : "",
                    };
                    if (AuthContextService.CurrentUser.RoleName != "超级管理员" && AuthContextService.CurrentUser.RoleName != "行业经理")
                    {
                        query = query.Where(x => x.Manager == Guid.Parse(payload.Kw));
                    }
                    if (!string.IsNullOrEmpty(payload.Kw1))
                    {
                        query = query.Where(x => x.ContactName.Contains(payload.Kw1));
                    }
                    if (!string.IsNullOrEmpty(payload.Kw2))
                    {
                        query = query.Where(x => x.ClientName.Contains(payload.Kw2));
                    }
                    query = query.OrderByDescending(x => x.Id);
                    var list       = query.Paged(payload.CurrentPage, payload.PageSize).ToList();
                    var totalCount = query.Count();
                    var response   = ResponseModelFactory.CreateResultInstance;
                    response.SetData(list, totalCount);
                    return(Ok(response));
                }
            }
        }
コード例 #2
0
        public IActionResult AppCallLogList(CallLogRequstPaload payload)
        {
            using (_dbContext)
            {
                var d5    = DateTime.Now.ToString("yyyy-MM-dd");
                var query = from c1 in _dbContext.ContactCallLog
                            where c1.IsDelete == 0
                            select new
                {
                    c1.Id,
                    c1.CallContent,
                    c1.CallTime,
                    c1.CallLogUuid,
                    c1.ContactPersonUu.ContactName,
                    c1.ContactPersonUuid,
                    c1.ClientUu.ClientName,
                    BusinessName = c1.BusinessUu.BusinessName == null ? "" : c1.BusinessUu.BusinessName != null ? c1.BusinessUu.BusinessName : "",
                    c1.ClientUu.ClientManager,
                    c1.ClientUuid,
                    c1.SheBeiId,
                };

                // TODO:不可以硬编码,下个版本解决
                // 如果是我们指定的角色,可以查看所有的联系记录,否则只能看自己的联系记录
                if (AuthContextService.CurrentUser.RoleName != "超级管理员" && AuthContextService.CurrentUser.RoleName != "行业经理")
                {
                    query = query.Where(x => x.ClientManager == AuthContextService.CurrentUser.Guid);
                }
                //如果联系人名字不为空 则模糊匹配该联系人的联系记录
                if (!string.IsNullOrEmpty(payload.ContactName))
                {
                    query = query.Where(x => x.ContactName.Contains(payload.ContactName));
                }
                //如果客户经理不为空 则查血客户经理是当前登录用户的当天的联系就记录
                if (payload.logUuid != "")
                {
                    query = query.Where(x => x.ClientManager.ToString() == payload.logUuid && x.CallTime.Substring(0, 10) == d5);
                }
                //按照ID排序(降序)
                query = query.OrderByDescending(x => x.Id);
                var query1   = query.ToList();
                var response = ResponseModelFactory.CreateResultInstance;
                response.SetData(query1);
                return(Ok(response));
            }
        }