public ModificationType GetModificationType(string ModificationTypeName) { return(GetSingleModificationType("Select_ModificationType", " ModificationTypeName='" + ModificationTypeID.ToString() + "'", "")); }
public ModificationType SaveModificationType() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_ModificationType"; command.Parameters.Add(dbconn.GenerateParameterObj("@ModificationTypeID", SqlDbType.Int, ModificationTypeID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ModificationTypeName", SqlDbType.VarChar, ModificationTypeName, 50)); command.Parameters.Add(dbconn.GenerateParameterObj("@ModificationTypeDescription", SqlDbType.VarChar, ModificationTypeDescription, 100)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message.ToString()); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }
/// <summary> /// Delete the ModificationType. /// </summary> /// <returns>Boolean</returns> public bool DeleteModificationType() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Delete_ModificationType"; command.Parameters.Add(dbconn.GenerateParameterObj("@ModificationTypeID", SqlDbType.Int, ModificationTypeID.ToString(), 0)); result = command.ExecuteReader(); } catch { Exception e = new Exception(); this._deleteOK = false; this._deletionMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this.DeleteOK); }