public static BackModel GetBackById(int BackID ) { DataTable dt = BackModelSetDAL.GetDataTable("select * from BackModel where AutoID=" + BackID); List<BackModel> list = new List<BackModel>(); foreach (DataRow dr in dt.Rows) { BackModel model = new BackModel(); model.FillData(dr); list.Add(model); } return list.FirstOrDefault(); }
public static List<BackModel> GetBackModel(int pageSize, int pageIndex, ref int totalCount, ref int pageCount,string sqlwhere="",bool asc=false) { string tablename = " BackModel a "; string sql = " 1=1 "; DataTable dt = CommonBusiness.GetPagerData(tablename, " a.* ", sql + sqlwhere, " a.WinFee ", pageSize, pageIndex, out totalCount, out pageCount, asc); List<BackModel> list = new List<BackModel>(); foreach (DataRow dr in dt.Rows) { BackModel model = new BackModel(); model.FillData(dr); list.Add(model); } return list; }