Ejemplo n.º 1
0
        public override IDataReader GetByPage(object tableName, string fieldList, FilterObject[] filterObjects, OrderObject[] orderObjects, int pageNum, int pageSize, ref int pageCount, ref int totalRowCount)
        {
            string filter = PagingHelper.CreateSafeFilter(filterObjects);

            try
            {
                totalRowCount = (int)SqlHelper.ExecuteScalar(_connectionString, StoredProcedureName.TotalRowCount, tableName, filter);
            }
            catch
            {
                totalRowCount = 0;
            }
            if (totalRowCount == 0)
            {
                pageCount = 0;
                return(null);
            }
            if (pageSize <= 0 || totalRowCount <= pageSize)
            {
                pageCount = 1;
            }
            else
            {
                pageCount = (totalRowCount + pageSize - 1) / pageSize;
            }
            if (pageNum < 1 || pageNum > pageCount)
            {
                return(null);
            }
            return(SqlHelper.ExecuteReader(_connectionString, StoredProcedureName.GetByPage, tableName, fieldList, filter,
                                           PagingHelper.CreateOrder(orderObjects), pageNum, pageSize, pageCount));
        }
Ejemplo n.º 2
0
 public static List <NhanVienInfo> GetAll()
 {
     if (Cache)
     {
         List <NhanVienInfo> list = DataCache.GetCache(Key) as List <NhanVienInfo>;
         if (list == null)
         {
             list = CBO.FillCollection <NhanVienInfo>(DataProvider.Instance().GetAll(
                                                          Table.NhanVien,
                                                          PagingHelper.CreateOrder(new OrderObject(TableNhanVien.MaNV, SortOrder.Desc))));
             list.TrimExcess();
             DataCache.SetCache(Key, list);
         }
         return(list);
     }
     return(CBO.FillCollection <NhanVienInfo>(DataProvider.Instance().GetAll(
                                                  Table.NhanVien,
                                                  PagingHelper.CreateOrder(new OrderObject(TableNhanVien.MaNV, SortOrder.Desc)))));
 }
Ejemplo n.º 3
0
 public static List <Customer_ContractInfo> GetAll()
 {
     if (Cache)
     {
         List <Customer_ContractInfo> list = DataCache.GetCache(Key) as List <Customer_ContractInfo>;
         if (list == null)
         {
             list = CBO.FillCollection <Customer_ContractInfo>(DataProvider.Instance().GetAll(
                                                                   Table.Customer_Contract,
                                                                   PagingHelper.CreateOrder(new OrderObject(TableCustomer_Contract.ID, SortOrder.Desc))));
             list.TrimExcess();
             DataCache.SetCache(Key, list);
         }
         return(list);
     }
     return(CBO.FillCollection <Customer_ContractInfo>(DataProvider.Instance().GetAll(
                                                           Table.Customer_Contract,
                                                           PagingHelper.CreateOrder(new OrderObject(TableCustomer_Contract.ID, SortOrder.Desc)))));
 }
Ejemplo n.º 4
0
 public static List <Monitoring_Seed_QuantityInfo> GetAll()
 {
     if (Cache)
     {
         List <Monitoring_Seed_QuantityInfo> list = DataCache.GetCache(Key) as List <Monitoring_Seed_QuantityInfo>;
         if (list == null)
         {
             list = CBO.FillCollection <Monitoring_Seed_QuantityInfo>(DataProvider.Instance().GetAll(
                                                                          Table.Monitoring_Seed_Quantity,
                                                                          PagingHelper.CreateOrder(new OrderObject(TableMonitoring_Seed_Quantity.ID, SortOrder.Desc))));
             list.TrimExcess();
             DataCache.SetCache(Key, list);
         }
         return(list);
     }
     return(CBO.FillCollection <Monitoring_Seed_QuantityInfo>(DataProvider.Instance().GetAll(
                                                                  Table.Monitoring_Seed_Quantity,
                                                                  PagingHelper.CreateOrder(new OrderObject(TableMonitoring_Seed_Quantity.ID, SortOrder.Desc)))));
 }
Ejemplo n.º 5
0
 public static List <ChiTietTraHangInfo> GetAll()
 {
     if (Cache)
     {
         List <ChiTietTraHangInfo> list = DataCache.GetCache(Key) as List <ChiTietTraHangInfo>;
         if (list == null)
         {
             list = CBO.FillCollection <ChiTietTraHangInfo>(DataProvider.Instance().GetAll(
                                                                Table.ChiTietTraHang,
                                                                PagingHelper.CreateOrder(new OrderObject(TableChiTietTraHang.MaPhieuTra, SortOrder.Desc))));
             list.TrimExcess();
             DataCache.SetCache(Key, list);
         }
         return(list);
     }
     return(CBO.FillCollection <ChiTietTraHangInfo>(DataProvider.Instance().GetAll(
                                                        Table.ChiTietTraHang,
                                                        PagingHelper.CreateOrder(new OrderObject(TableChiTietTraHang.MaPhieuTra, SortOrder.Desc)))));
 }