public List <ContactInfoModel> SearchContacts(string args, int cid) { List <ContactInfoModel> contactInfoModels = new List <ContactInfoModel>(); CustomerModel customerModel = _getCustomerBll.GetCustomerByCid(cid); if (!string.IsNullOrEmpty(customerModel.CorpID) && customerModel.Corporation != null) { if (customerModel.Corporation.IsAmplitudeCorp == "T") { if (customerModel.IsMaster == "T") { //查询当前公司下所有的联系人信息 //List<CustomerModel> customerModels = _getCustomerBll.GetCustomerByCorpId(customerModel.CorpID); //List<int> cidList = customerModels.Select(n => n.Cid).ToList(); //contactInfoModels = _getContactBll.GetContactByCid(cidList, args); //查询当前客户名下的联系人信息 contactInfoModels = _getContactBll.GetContactByCid(customerModel.Cid, args); } else { //查询当前客户名下的联系人信息 contactInfoModels = _getContactBll.GetContactByCid(customerModel.Cid, args); } } else { //查询当前公司下所有的联系人信息 List <CustomerModel> customerModels = _getCustomerBll.GetCustomerByCorpId(customerModel.CorpID); List <int> cidList = customerModels.Select(n => n.Cid).ToList(); contactInfoModels = _getContactBll.GetContactByCid(cidList, args); } } else { //查询当前客户名下的联系人信息 contactInfoModels = _getContactBll.GetContactByCid(customerModel.Cid, args); } return(contactInfoModels); }
public List <GetContactInfoModel> GetContactByCid(int cid) { List <GetContactInfoModel> getContactInfoModels = new List <GetContactInfoModel>(); List <ContactInfoModel> contactInfoModelList = _getContactBll.GetContactByCid(cid); foreach (var contactInfoModel in contactInfoModelList) { GetContactInfoModel getContactInfoModel = new GetContactInfoModel().ConvertEntity(contactInfoModel); getContactInfoModels.Add(getContactInfoModel); } return(getContactInfoModels); }