Esempio n. 1
0
        public Model(String argConnection, System.String argModel)
        {
            mConnection = argConnection;
            string        pstrSql = "SELECT * FROM Model WHERE Model='" + argModel + "'";
            SqlDataReader dr      = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql);

            if (dr.Read())
            {
                mModelId         = (System.Int32)dr["ModelId"];
                mVehicleMake     = new VehicleMake(Connection, (int)dr["VehicleMakeId"]);
                mVehicleCategory = new VehicleCategory(Connection, (int)dr["VehicleCategoryId"]);
                mDefault         = (System.String)dr["Model"];
                mExcess          = (System.Single)dr["Excess"];
                mTypeOfBody      = dr["TypeOfBody"].ToString();
                mModelType       = (System.Int32)dr["ModelType"];
                mVehicleCategory = new VehicleCategory(Connection, (System.Int32)dr["VehicleCategoryId"]);
            }
            else
            {
                Exception ex = new Exception("Identifier does not exist.");
                ex.Source = "Model.Model()";
                throw ex;
            }
            dr.Close();
        }
Esempio n. 2
0
        public PartVehicleMake(String argConnection, Int32 argPartVehicleMakeId)
        {
            mConnection = argConnection;
            string        pstrSql = "SELECT * FROM PartVehicleMake WHERE PartVehicleMakeId=" + argPartVehicleMakeId;
            SqlDataReader dr      = SqlHelper.ExecuteReader(Connection, CommandType.Text, pstrSql);

            if (dr.Read())
            {
                mPartVehicleMakeId = (System.Int32)dr["PartVehicleMakeId"];
                mVehicleMake       = new VehicleMake(Connection, (int)dr["VehicleMakeId"]);
                mPart = new Part(Connection, (int)dr["PartId"]);
            }
            else
            {
                Exception ex = new Exception("Identifier does not exist.");
                ex.Source = "PartVehicleMake.PartVehicleMake()";
                throw ex;
            }
            dr.Close();
        }