public ProvidersEntity GetProviderByID(string providerid) { DataTable dt = dal.GetProviderByID(providerid); ProvidersEntity model = new ProvidersEntity(); if (dt.Rows.Count > 0) { model.FillData(dt.Rows[0]); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); } return model; }
public List<ProvidersEntity> GetProviders(string clientid) { DataTable dt = dal.GetProviders(clientid); List<ProvidersEntity> list = new List<ProvidersEntity>(); foreach (DataRow dr in dt.Rows) { ProvidersEntity model = new ProvidersEntity(); model.FillData(dr); list.Add(model); } return list; }
public List<ProvidersEntity> GetProviders(string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientid) { var dal = new StockDAL(); string where = " ClientID='" + clientid + "' and Status<>9"; if (!string.IsNullOrEmpty(keyWords)) { where += " and (Name like '%" + keyWords + "%' or Contact like '%" + keyWords + "%' or MobileTele like '%" + keyWords + "%')"; } DataTable dt = CommonBusiness.GetPagerData("Providers", "*", where, "AutoID", pageSize, pageIndex, out totalCount, out pageCount); List<ProvidersEntity> list = new List<ProvidersEntity>(); foreach (DataRow dr in dt.Rows) { ProvidersEntity model = new ProvidersEntity(); model.FillData(dr); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); list.Add(model); } return list; }