public static CarriageType GetCarriageTypeByType(string type)
        {
            CarriageType result = null;
            Hashtable    pars   = new Hashtable();

            pars.Add("@type", type);
            try
            {
                using (DBManager db = new DBManager())
                {
                    db.Open();
                    using (SqlDataReader reader = db.ExecuteQuery(GetCarriageTypeQueryByType, pars))
                    {
                        result = GetCarriageTypeFromDataReader(reader);
                        reader.Close();
                    }
                    db.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        private static CarriageType GetCarriageTypeFromDataReader(SqlDataReader reader)
        {
            reader.Read();
            CarriageType t = new CarriageType()
            {
                Id_CarriageType = reader.GetInt32(0),
                Type            = reader.GetString(1),
                PlasesCount     = reader.GetInt32(2)
            };

            return(t);
        }
        private static List <CarriageType> GetCarriageTypesListFromDataReader(SqlDataReader reader)
        {
            List <CarriageType> result = new List <CarriageType>();

            while (reader.Read())
            {
                CarriageType t = new CarriageType()
                {
                    Id_CarriageType = reader.GetInt32(0),
                    Type            = reader.GetString(1),
                    PlasesCount     = reader.GetInt32(2)
                };
                result.Add(t);
            }
            return(result);
        }