Ejemplo n.º 1
0
		public static DataSet GetParameterSets(int vehicleBuild, int buildType)
		{
			DataSet dataSet = new DataSet("Parameter");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetParameters", sqlConnection);
				sqlCommand.get_Parameters().Add("@VehicleBuildID", vehicleBuild);
				sqlCommand.get_Parameters().Add("@BuildType", buildType);
				sqlCommand.set_CommandType(4);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
Ejemplo n.º 2
0
		public int ExecuteScalar()
		{
			int result = 0;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand(this.Name, sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.set_CommandTimeout(120);
				IEnumerator enumerator = this.StoredProcParams.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						StoredProcParam storedProcParam = (StoredProcParam)enumerator.get_Current();
						sqlCommand.get_Parameters().Add(storedProcParam.ParamID, storedProcParam.ParamValue);
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				sqlConnection.Open();
				result = Convert.ToInt32(sqlCommand.ExecuteScalar());
				sqlConnection.Close();
			}
			return result;
		}
Ejemplo n.º 3
0
		public DataSet ExecuteDataSet()
		{
			DataSet dataSet;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand(this.Name, sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.set_CommandTimeout(120);
				IEnumerator enumerator = this.StoredProcParams.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						StoredProcParam storedProcParam = (StoredProcParam)enumerator.get_Current();
						sqlCommand.get_Parameters().Add(storedProcParam.ParamID, storedProcParam.ParamValue);
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				dataSet = new DataSet();
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
Ejemplo n.º 4
0
		public static DataSet GetUser(int id)
		{
			DataSet dataSet = new DataSet("User");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetUser", sqlConnection);
				sqlCommand.get_Parameters().Add("@ID", id);
				sqlCommand.set_CommandType(4);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
Ejemplo n.º 5
0
		public static DataSet GetVehicleBuild(bool showAll)
		{
			DataSet dataSet = new DataSet("VehicleBuild");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				int num = Convert.ToInt32(showAll);
				SqlCommand sqlCommand = new SqlCommand("upGetVehicleBuilds", sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.get_Parameters().Add("@ShowAll", num);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
Ejemplo n.º 6
0
		public int ExecuteReturnVal()
		{
			int result = 0;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand(this.Name, sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.set_CommandTimeout(120);
				SqlParameter sqlParameter = new SqlParameter("@RETURN", 8);
				sqlParameter.set_Direction(6);
				sqlCommand.get_Parameters().Add(sqlParameter);
				IEnumerator enumerator = this.StoredProcParams.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						StoredProcParam storedProcParam = (StoredProcParam)enumerator.get_Current();
						sqlCommand.get_Parameters().Add(storedProcParam.ParamID, storedProcParam.ParamValue);
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				sqlConnection.Open();
				sqlCommand.ExecuteNonQuery();
				sqlConnection.Close();
				result = (int)sqlParameter.get_Value();
			}
			return result;
		}
Ejemplo n.º 7
0
		public static int GetVehicleBuildID(string vehicleInstID)
		{
			int result = 0;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetVehicleBuildIDByVehicleInst", sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.get_Parameters().Add("@VehicleInst", vehicleInstID);
				sqlConnection.Open();
				result = Convert.ToInt32(sqlCommand.ExecuteScalar());
				sqlConnection.Close();
			}
			return result;
		}
Ejemplo n.º 8
0
		public static DataSet GetVehicleInstParameters(string vehicleInstId)
		{
			DataSet dataSet = new DataSet("VehicleInst");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetVehicleInstParameters", sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.get_Parameters().Add("@VehicleInstID", vehicleInstId);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}