Example #1
0
 public List<BPhanHuongNhuCauModel> searchModel(DMToaSoanSearchModel obj)
 {
     throw new NotImplementedException();
 }
Example #2
0
 public List<BPhanHuongNhuCauModel> searchModel(DMToaSoanSearchModel obj, int page, int pageSize, out int pageCount, out int totalitem)
 {
     throw new NotImplementedException();
 }
Example #3
0
 /***
 * function: SearchModel()
 * param : string MaDiemIn, int page, int pageSize, out int pageCount
 * result: List<DMDiemIn>
 * author: vietvb
 * Tìm kiếm theo mã điểm in, tên điểm in và phân trang
 * */
 public List<DMToaSoanModel> searchModel(DMToaSoanSearchModel obj, int page, int pageSize, out int pageCount, out int totalitem)
 {
     List<DMToaSoanModel> result = new List<DMToaSoanModel>();
     IEnumerable<DMToaSoanModel> query = null;
     query = (from t in db.DMToaSoans
              where t.Status == (int)Enums.RecordStatusCode.active
              select new DMToaSoanModel()
              {
                  Id = t.Id,
                 MaToaSoan = t.MaToaSoan,
                 TenToaSoan = t.TenToaSoan,
                 DiaChi = t.DiaChi,
                 SoDienThoai = t.SoDienThoai,
                 Email = t.Email,
                 Web = t.Web,
                 MaSoThue = t.MaSoThue,
                 TaiKhoan = t.TaiKhoan,
                 TongBienTap = t.TongBienTap,
                 NguoiDaiDien = t.NguoiDaiDien,
                 CoQuanChuQuan = t.CoQuanChuQuan,
                 Status = t.Status,
                 KieuToaSoan = t.KieuToaSoan,
                 NganHang = t.NganHang
              });
     if (!String.IsNullOrEmpty(obj.MaToaSoan))
     {
         query = query.Where(r => r.MaToaSoan.ToLower().Contains(obj.MaToaSoan.ToLower()));
     }
     if (!String.IsNullOrEmpty(obj.TenToaSoan))
     {
         query = query.Where(r => r.TenToaSoan.ToLower().Contains(obj.TenToaSoan.ToLower()));
     }
     if (!String.IsNullOrEmpty(obj.SoDienThoai))
     {
         query = query.Where(r => r.SoDienThoai.ToLower().Contains(obj.SoDienThoai.ToLower()));
     }
     if (query != null)
     {
         int count = query.Count();
         totalitem = count;
         //neu khong co du lieu thi return
         if (count == 0)
         {
             pageCount = 0;
             return result;
         }
         //pageSize nho hon 10 thi dat bang 10
         if (pageSize < 10)
             pageSize = 2;
         //tinh pagecount
         pageCount = count / pageSize;
         //Neu so luong con du thi tang pagecount len 1
         if (count % pageSize > 0) pageCount++;
         //Neu trang hien tai lon hon pagecount thi thiet lap bang pageCount-1
         if (page >= pageCount)
             page = pageCount - 1;
         else
             page = page - 1;//So trang bat dau tu 0
         result = query.OrderBy(i => i.MaToaSoan).Skip(page * pageSize).Take(pageSize).ToList();
         return result;
     }
     else
     {
         totalitem = 0;
         pageCount = 0;
         return result;
     }
 }
Example #4
0
        /***
        * function: Search()
        * param : DMToaSoanSearchModel
        * result: List<DMDiemIn>
        * author: vietvb
        * Tìm kiếm theo mã điểm in, tên điểm in và phân trang
        * */
        public List<DMToaSoanModel> searchModel(DMToaSoanSearchModel obj)
        {
            List<DMToaSoanModel> result = new List<DMToaSoanModel>();
            IEnumerable<DMToaSoanModel> query = null;
            query = (from t in db.DMToaSoans
                     where t.Status == 1
                     select new DMToaSoanModel()
                     {
                         Id = t.Id,
                         MaToaSoan = t.MaToaSoan,
                         TenToaSoan = t.TenToaSoan,
                         DiaChi = t.DiaChi,
                         SoDienThoai = t.SoDienThoai,
                         Email = t.Email,
                         Web = t.Web,
                         MaSoThue = t.MaSoThue,
                         TaiKhoan = t.TaiKhoan,
                         TongBienTap = t.TongBienTap,
                         NguoiDaiDien = t.NguoiDaiDien,
                         CoQuanChuQuan = t.CoQuanChuQuan,
                         Status = t.Status,
                         KieuToaSoan = t.KieuToaSoan,
                         NganHang = t.NganHang
                     });
            if (!String.IsNullOrEmpty(obj.MaToaSoan))
            {
                query = query.Where(r => r.MaToaSoan.Contains(obj.MaToaSoan));
            }
            if (!String.IsNullOrEmpty(obj.TenToaSoan))
            {
                query = query.Where(r => r.TenToaSoan.Contains(obj.TenToaSoan));
            }
            if (!String.IsNullOrEmpty(obj.SoDienThoai))
            {
                query = query.Where(r => r.SoDienThoai.Contains(obj.SoDienThoai));
            }
            if (query != null)
            {
                int count = query.Count();
                //neu khong co du lieu thi return

                result = query.ToList();
                return result;
            }
            else
            {
                return result;
            }
        }
 public List<BDieuChinhPhanHuongUnitModel> searchModel(DMToaSoanSearchModel obj)
 {
     throw new NotImplementedException();
 }