Ejemplo n.º 1
0
        public static Typ_zakazky Detail_typu_zakazky(int idTyp, 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("@idTyp", idTyp);
            SqlDataReader reader = db.Select(command);

            Typ_zakazky typy = Read_One(reader);

            reader.Close();

            if (pDb == null)
            {
                db.Close();
            }

            return(typy);
        }
Ejemplo n.º 2
0
        private static Typ_zakazky Read_One(SqlDataReader reader)
        {
            Typ_zakazky typy_zakazek = new Typ_zakazky();

            while (reader.Read())
            {
                int i = -1;
                typy_zakazek.Idtyp         = reader.GetInt32(++i);
                typy_zakazek.Jmeno_zakazky = reader.GetString(++i);
                typy_zakazek.Pocet_typu    = reader.GetInt32(++i);
            }
            return(typy_zakazek);
        }
Ejemplo n.º 3
0
        private static Collection <Typ_zakazky> Read(SqlDataReader reader)
        {
            Collection <Typ_zakazky> typy_zakazek = new Collection <Typ_zakazky>();

            while (reader.Read())
            {
                Typ_zakazky Typ = new Typ_zakazky();
                int         i   = -1;
                Typ.Idtyp         = reader.GetInt32(++i);
                Typ.Jmeno_zakazky = reader.GetString(++i);
                Typ.Pocet_typu    = reader.GetInt32(++i);
                typy_zakazek.Add(Typ);
            }
            return(typy_zakazek);
        }