//public static DataTable GetPage(int pageNumber, int pageSize) //{ // DataTable dataTable = new DataTable(); // dataTable.Columns.Add("Guid",typeof(Guid)); // dataTable.Columns.Add("CountryGuid",typeof(Guid)); // dataTable.Columns.Add("CountryName", typeof(string)); // dataTable.Columns.Add("Name",typeof(string)); // dataTable.Columns.Add("Code",typeof(string)); // dataTable.Columns.Add("TotalPages", typeof(int)); // IDataReader reader = DBGeoZone.GetGeoZonePage(pageNumber, pageSize); // while (reader.Read()) // { // DataRow row = dataTable.NewRow(); // row["Guid"] = reader["Guid"]; // row["CountryGuid"] = reader["CountryGuid"]; // row["CountryName"] = reader["CountryName"]; // row["Name"] = reader["Name"]; // row["Code"] = reader["Code"]; // row["TotalPages"] = Convert.ToInt32(reader["TotalPages"]); // dataTable.Rows.Add(row); // } // reader.Close(); // return dataTable; //} public static DataTable GetPage( Guid countryGuid, int pageNumber, int pageSize, out int totalPages) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("Guid", typeof(Guid)); dataTable.Columns.Add("CountryGuid", typeof(Guid)); dataTable.Columns.Add("CountryName", typeof(string)); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Code", typeof(string)); //dataTable.Columns.Add("TotalPages", typeof(int)); using (IDataReader reader = DBGeoZone.GetPage(countryGuid, pageNumber, pageSize, out totalPages)) { while (reader.Read()) { DataRow row = dataTable.NewRow(); row["Guid"] = new Guid(reader["Guid"].ToString()); row["CountryGuid"] = reader["CountryGuid"]; row["CountryName"] = reader["CountryName"]; row["Name"] = reader["Name"]; row["Code"] = reader["Code"]; //row["TotalPages"] = Convert.ToInt32(reader["TotalPages"]); dataTable.Rows.Add(row); } } return(dataTable); }