public static Geodet Detail_geodeta(int idGeo, Database pDb = null) { Database db; if (pDb == null) { db = new Database(); db.Connect(); } else { db = pDb; } SqlCommand command = db.CreateCommand(SQL_DETAIL); command.Parameters.AddWithValue("@idGeo", idGeo); SqlDataReader reader = db.Select(command); Geodet geodet = Read_geo_ONE(reader); reader.Close(); if (pDb == null) { db.Close(); } return(geodet); }
public static Geodet Read_geo_ONE(SqlDataReader reader) { Geodet geodet = new Geodet(); while (reader.Read()) { int i = -1; geodet.Idgeo = reader.GetInt32(++i); geodet.Jmeno_geodeta = reader.GetString(++i); geodet.Prijmeni_geodeta = reader.GetString(++i); geodet.Ulice_cislo = reader.GetString(++i); geodet.Email = reader.GetString(++i); geodet.Mesto_idmes = ShowMesto.Detail_mesta(reader.GetInt32(++i)); geodet.Plat = reader.GetInt32(++i); geodet.Dokoncene_zakazky = reader.GetInt32(++i); } return(geodet); }