private void GetGeoZone(Guid guid) { using (IDataReader reader = DBGeoZone.GetOne(guid)) { LoadFromReader(this, reader); } }
//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); }
private bool Update() { return(DBGeoZone.Update( this.guid, this.countryGuid, this.name, this.code)); }
private bool Create() { this.guid = Guid.NewGuid(); int rowsAffected = DBGeoZone.Create( this.guid, this.countryGuid, this.name, this.code); return(rowsAffected > 0); }
public static GeoZone GetByCode(Guid countryGuid, string code) { GeoZone geoZone = new GeoZone(); using (IDataReader reader = DBGeoZone.GetByCode(countryGuid, code)) { LoadFromReader(geoZone, reader); } if (geoZone.Guid == Guid.Empty) { return(null); } return(geoZone); }
public static IDataReader GetByCountry(Guid countryGuid) { return(DBGeoZone.GetByCountry(countryGuid)); }
public static bool Delete(Guid guid) { return(DBGeoZone.Delete(guid)); }