| | |
| | | ResultEntity resultEntity = new ResultEntity(); |
| | | try |
| | | { |
| | | var checkUserSn = _context.IntentionCustomers.Where(x => x.Name == intentionCustomerDTO.Name && x.RecStatus == "A" && x.Id != intentionCustomerDTO.Id).FirstOrDefault(); |
| | | if (checkUserSn != null && (string.IsNullOrWhiteSpace(intentionCustomerDTO.Id) || (!string.IsNullOrWhiteSpace(intentionCustomerDTO.Id) && checkUserSn.Id != intentionCustomerDTO.Id))) |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "客户单位重复"; |
| | | return resultEntity; |
| | | } |
| | | var checkUserSn = _context.IntentionCustomers.Where(x => x.Name == intentionCustomerDTO.Name && x.RecStatus == "A" && x.Id != intentionCustomerDTO.Id).FirstOrDefault(); |
| | | if (checkUserSn != null && (string.IsNullOrWhiteSpace(intentionCustomerDTO.Id) || (!string.IsNullOrWhiteSpace(intentionCustomerDTO.Id) && checkUserSn.Id != intentionCustomerDTO.Id))) |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "客户单位重复"; |
| | | return resultEntity; |
| | | } |
| | | |
| | | var intentionCustomer = _mapper.Map<IntentionCustomer>(intentionCustomerDTO); |
| | | var checkcooper = _context.CooperatecustomCustomers.Where(x => x.Name == intentionCustomerDTO.Name && x.RecStatus == "A" ).FirstOrDefault(); |
| | | if (checkcooper != null ) |
| | | { |
| | | resultEntity.Result = false; |
| | | resultEntity.Message = "已存在合作客户"; |
| | | return resultEntity; |
| | | } |
| | | |
| | | |
| | | var intentionCustomer = _mapper.Map<IntentionCustomer>(intentionCustomerDTO); |
| | | |
| | | |
| | | if (String.IsNullOrEmpty(intentionCustomer.Id)) |
| | |
| | | updateproject.Modifier = intentionCustomer.Modifier; |
| | | updateproject.Modifytime = intentionCustomer.Modifytime; |
| | | |
| | | } |
| | | updateproject.Yixiangtime = intentionCustomer.Yixiangtime; |
| | | updateproject.Yixiang = intentionCustomer.Yixiang; |
| | | updateproject.Dianxiaozhuanyuan = intentionCustomer.Dianxiaozhuanyuan; |
| | | updateproject.Zuijinzhuizongtime = intentionCustomer.Zuijinzhuizongtime; |
| | | |
| | | updateproject.Weixin = intentionCustomer.Weixin; |
| | | updateproject.Shifoutianjiaweixin = intentionCustomer.Shifoutianjiaweixin; |
| | | updateproject.Weixiner = intentionCustomer.Weixiner; |
| | | updateproject.Weixintime = intentionCustomer.Weixintime; |
| | | |
| | | } |
| | | |
| | | _context.SaveChanges(); |
| | | resultEntity.ReturnID = intentionCustomer.Id; |
| | |
| | | DateTime.TryParse(Createtimes[1], out Createtimeend); |
| | | Createtimeend = Createtimeend.AddDays(1); |
| | | } |
| | | |
| | | DateTime Yixiangtimestart = DateTime.Now; |
| | | DateTime Yixiangtimeend = DateTime.Now; |
| | | if (!string.IsNullOrWhiteSpace(searchEntity.Yixiangtime)) |
| | | { |
| | | string[] Yixiangtimes = searchEntity.Yixiangtime.Split("|"); |
| | | DateTime.TryParse(Yixiangtimes[0], out Yixiangtimestart); |
| | | DateTime.TryParse(Yixiangtimes[1], out Yixiangtimeend); |
| | | // Yixiangtimeend = Yixiangtimeend.AddDays(1); |
| | | } |
| | | |
| | | var query = (from a in _context.IntentionCustomers |
| | | join b in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khly") |
| | | var query = (from a in _context.IntentionCustomers |
| | | join b in listCode.Where(x => x.CodeTable == "IntentionCustomer" && x.CodeField == "khly") |
| | | on a.Khly equals b.CodeSn |
| | | join c in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "hyfl") |
| | | on a.Hyfl equals c.CodeSn |
| | |
| | | on a.Ywjl equals e.Id |
| | | into esss |
| | | from abi in esss.DefaultIfEmpty() |
| | | join f in _context.Areas on a.Sheng equals f.CodeId |
| | | |
| | | join f in _context.PltUsers.Where(x => x.RecStatus == "A" && x.Zhiwustatus == "A" ) |
| | | on a.Dianxiaozhuanyuan equals f.Id |
| | | into fsss |
| | | from fff in fsss.DefaultIfEmpty() |
| | | |
| | | join f in _context.Areas on a.Sheng equals f.CodeId |
| | | join g in _context.Areas on a.City equals g.CodeId |
| | | join h in _context.Areas on a.AreaId equals h.CodeId |
| | | |
| | |
| | | && (string.IsNullOrWhiteSpace(searchEntity.AreaId) || a.AreaId == searchEntity.AreaId.Trim()) |
| | | && (string.IsNullOrWhiteSpace(searchEntity.Creater) || a.Creater == searchEntity.Creater.Trim()) |
| | | |
| | | select new IntentionCustomerDTO |
| | | && (string.IsNullOrWhiteSpace(searchEntity.Dianxiaozhuanyuan) || a.Dianxiaozhuanyuan == searchEntity.Dianxiaozhuanyuan.Trim()) |
| | | |
| | | && (string.IsNullOrWhiteSpace(searchEntity.Yixiangtime) || (a.Yixiangtime >= Yixiangtimestart && a.Yixiangtime <= Yixiangtimeend)) |
| | | && (string.IsNullOrWhiteSpace(searchEntity.Yixiang) || ( a.Yixiang == searchEntity.Yixiang.Trim() && (a.Ywjl == null || a.Ywjl == searchEntity.YwjlYx) )) |
| | | //&& (string.IsNullOrWhiteSpace(searchEntity.Shifouweixin) || a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim()) |
| | | select new IntentionCustomerDTO |
| | | { |
| | | Id = a.Id, |
| | | Sheng = a.Sheng, |
| | |
| | | ShrTel = a.ShrTel, |
| | | ShrAddress = a.ShrAddress, |
| | | Remark = a.Remark, |
| | | |
| | | Weixin = a.Weixin, |
| | | Shifoutianjiaweixin = a.Shifoutianjiaweixin, |
| | | Weixiner = a.Weixiner, |
| | | Weixintime = a.Weixintime, |
| | | RecStatus = a.RecStatus, |
| | | Modifier = a.Modifier, |
| | | Modifytime = a.Modifytime, |
| | | CreatetimeName = a.Createtime.ToString("yyyy-MM-dd"), |
| | | } |
| | | Yixiangtime = a.Yixiangtime, |
| | | YixiangtimeName = a.Yixiangtime.HasValue? a.Yixiangtime.Value.ToString("yyyy-MM-dd"):"", |
| | | Yixiang = a.Yixiang, |
| | | Dianxiaozhuanyuan = a.Dianxiaozhuanyuan, |
| | | DianxiaozhuanyuanName = fff.UserName, |
| | | Zuijinzhuizongtime = a.Zuijinzhuizongtime, |
| | | ZuijinzhuizongtimeName = a.Zuijinzhuizongtime.HasValue ? a.Zuijinzhuizongtime.Value.ToString("yyyy-MM-dd") : "", |
| | | } |
| | | ).OrderByDescending(x => x.Modifytime).ToList(); |
| | | |
| | | if (!string.IsNullOrWhiteSpace(searchEntity.Shifouweixin)) |
| | | { |
| | | query = query.Where( a=>a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim()).ToList(); |
| | | } |
| | | |
| | | |
| | | if (searchEntity.totalrows == 0) |
| | | //if (searchEntity.totalrows == 0) |
| | | searchEntity.totalrows = query.Count(); |
| | | var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); |
| | | data.LoadData(searchEntity, lianlist); |
| | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public List<IntentionCustomerDTO> GetListsalary(string userid, DateTime datemin, DateTime datemax) |
| | | { |
| | | |
| | | |
| | | var listPosition = _context.IntentionCustomers.Where(r => r.RecStatus == "A" && r.Creater == userid && r.Createtime >= datemin && r.Createtime < datemax).ToList(); |
| | | |
| | | var list = _mapper.Map<List<IntentionCustomerDTO>>(listPosition); |
| | | return list; |
| | | } |
| | | |
| | | public List<IntentionCustomerDTO> GetListsalaryweixin(string userid, DateTime datemin, DateTime datemax) |
| | | { |
| | | |
| | | |
| | | var listPosition = _context.IntentionCustomers.Where(r => r.RecStatus == "A" && r.Weixiner == userid && r.Weixintime >= datemin && r.Weixintime < datemax).ToList(); |
| | | |
| | | var list = _mapper.Map<List<IntentionCustomerDTO>>(listPosition); |
| | | return list; |
| | | } |
| | | |
| | | public List<IntentionCustomerDTO> GetListsalaryyixiang(string userid, DateTime datemin, DateTime datemax) |
| | | { |
| | | |
| | | |
| | | var listPosition = _context.IntentionCustomers.Where(r => r.RecStatus == "A" && r.Dianxiaozhuanyuan == userid && r.Yixiangtime >= datemin && r.Yixiangtime < datemax).ToList(); |
| | | |
| | | var list = _mapper.Map<List<IntentionCustomerDTO>>(listPosition); |
| | | return list; |
| | | } |
| | | |
| | | } |
| | | } |