/// <summary> /// 获取客户端列表 /// </summary> public static List<Clients> GetClients(string keyWords,int type, string orderBy,int pageSize, int pageIndex, ref int totalCount, ref int pageCount) { string sqlWhere = "a.Status<>9"; if (!string.IsNullOrEmpty(keyWords)) { sqlWhere += " and ( a.CompanyName like '%" + keyWords + "%' or a.AliMemberID like '%" + keyWords + "%' or a.MobilePhone like '%" + keyWords + "%' or a.ClientCode like '%" + keyWords + "%')"; } if (type > -1) { if (type == 0) { sqlWhere += " and len(a.AliMemberID)=0 "; } else { sqlWhere += " and len(a.AliMemberID)>0 "; } } string sqlColumn = @" a.AutoID,a.ClientID,a.ClientCode,a.CompanyName,a.Logo,a.Industry, a.CityCode,a.Address,a.PostalCode,a.ContactName,a.MobilePhone,a.OfficePhone, a.Status,b.EndTime,b.UserQuantity,a.TotalIn,a.TotalOut,a.FreezeMoney, a.Description,a.AuthorizeType,a.IsDefault,a.AgentID,a.CreateTime,a.CreateUserID,a.AliMemberID "; bool isAsc=false; if (string.IsNullOrEmpty(orderBy)) { orderBy = "a.AutoID"; } else { isAsc=orderBy.IndexOf(" asc")>-1?true:false; orderBy = orderBy.Replace(" desc", "").Replace(" asc", ""); } DataTable dt = CommonBusiness.GetPagerData("Clients a join Agents b on a.ClientID=b.ClientID", sqlColumn, sqlWhere, orderBy, pageSize, pageIndex, out totalCount, out pageCount, isAsc); List<Clients> list = new List<Clients>(); Clients model; foreach (DataRow item in dt.Rows) { model = new Clients(); model.FillData(item); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); // model.IndustryEntity =Manage.IndustryBusiness.GetIndustrys().Where(i => i.IndustryID.ToLower() == model.Industry.ToLower()).FirstOrDefault(); list.Add(model); } return list; }
public static Clients GetClientDetailBase(string clientID) { DataTable dt = ClientDAL.BaseProvider.GetClientDetail(clientID); Clients model = new Clients(); if (dt.Rows.Count == 1) { DataRow row = dt.Rows[0]; model.FillData(row); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); //model.IndustryEntity = Manage.IndustryBusiness.GetIndustrys().Where(i => i.IndustryID.ToLower() == model.Industry.ToLower()).FirstOrDefault(); return model; } else { return null; } }