public static List <SearchNXB> LayNXBtheoTimKiem(SearchNXB serach) { DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); List <SearchNXB> ListSearch = new List <SearchNXB>(); var _NXB = (from p in model.Nhaxuatban select p); if (serach.MaNXB != "") { _NXB = _NXB.Where(q => q.MaNXB.Trim().Equals(serach.MaNXB)); } if (serach.notu != 0 && serach.noden != 0) { _NXB = _NXB.Where(q => q.No >= serach.notu && q.No <= serach.noden); } else if (serach.notu != 0 && serach.noden == 0) { _NXB = _NXB.Where(q => q.No >= serach.notu); } else if (serach.notu == 0 && serach.noden != 0) { _NXB = _NXB.Where(q => q.No <= serach.noden); } foreach (var row in _NXB) { SearchNXB _Search = new SearchNXB(); _Search.TenNXB = row.TenNXB.Trim(); _Search.MaNXB = row.MaNXB.Trim(); _Search.Duong = row.Diachi.Trim(); _Search.Quan = row.Diachi.Trim(); ListSearch.Add(_Search); } return(ListSearch); }
public static List<SearchNXB> LayNXBtheoTimKiem(SearchNXB serach) { DBQLPhatHanhSachEntities model = new DBQLPhatHanhSachEntities(); List<SearchNXB> ListSearch = new List<SearchNXB>(); var _NXB = (from p in model.Nhaxuatban select p); if(serach.MaNXB!="") { _NXB = _NXB.Where(q => q.MaNXB.Trim().Equals(serach.MaNXB)); } if(serach.notu!=0&&serach.noden!=0) { _NXB = _NXB.Where(q => q.No >= serach.notu && q.No <= serach.noden); } else if(serach.notu!=0&&serach.noden==0) { _NXB = _NXB.Where(q => q.No >= serach.notu ); } else if (serach.notu == 0 && serach.noden != 0) { _NXB = _NXB.Where(q => q.No <= serach.noden); } foreach (var row in _NXB) { SearchNXB _Search = new SearchNXB(); _Search.TenNXB = row.TenNXB.Trim(); _Search.MaNXB = row.MaNXB.Trim(); _Search.Duong = row.Diachi.Trim(); _Search.Quan = row.Diachi.Trim(); ListSearch.Add(_Search); } return ListSearch; }
public BUSNXB(SearchNXB Search) { this.Search = Search; }