public void SubmitForm(CustomerEntity customerEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { //更新业务员跟单记录信息 var lst = tranService.IQueryable().Where(t => t.CustomerId.Equals(keyValue)); foreach (var item in lst) { item.SalesmanCode = customerEntity.SalesmanCode; item.Salesman = customerEntity.Salesman; item.Modify(item.Id); tranService.SubmitForm(item, item.Id); } customerEntity.Modify(keyValue); } else { //先根据客户名称 var expression = ExtLinq.True <CustomerEntity>(); expression = expression.And(t => t.Company.Contains(customerEntity.Company.Trim())); expression = expression.And(t => t.Telphone.Contains(customerEntity.Telphone)); var lst = service.IQueryable(expression); if (lst != null & lst.Count() > 0) { throw new Exception("存在相同的客户信息!!!"); } customerEntity.Create(); } service.SubmitForm(customerEntity, keyValue); }
public List <CustomerTransactionEntity> GetList(DateTime?beginTime, DateTime?endTime, bool?tranStatus) { var expression = ExtLinq.True <CustomerTransactionEntity>(); if (beginTime != null) { expression = expression.And(t => t.BillDate >= beginTime); } if (endTime != null) { DateTime?e = endTime.Value.AddDays(1); expression = expression.And(t => t.BillDate < endTime); } if (tranStatus != null) { expression = expression.And(t => t.TradStatus.Equals(tranStatus)); } return(service.IQueryable(expression).OrderByDescending(t => t.CreatorTime).ToList()); }