public Organization SaveOrganization() { 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_Organization"; command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationID", SqlDbType.Int, OrganizationID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationName", SqlDbType.VarChar, OrganizationName, 100)); command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationDescription", SqlDbType.VarChar, OrganizationDescription, 4000)); command.Parameters.Add(dbconn.GenerateParameterObj("@ScaleID", SqlDbType.Int, ScaleID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationTypeID", SqlDbType.Int, OrganizationTypeID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationAllies", SqlDbType.VarChar, OrganizationAllies, 4000)); command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationEnemies", SqlDbType.VarChar, OrganizationEnemies, 4000)); command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTraditionID", SqlDbType.Int, ForceTraditionID.ToString(), 0)); 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); }
public OrganizationType GetOrganizationType(string OrganizationTypeName) { return(GetSingleOrganizationType("Select_OrganizationType", " OrganizationTypeName='" + OrganizationTypeID.ToString() + "'", "")); }
public OrganizationType SaveOrganizationType() { 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_OrganizationType"; command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationTypeID", SqlDbType.Int, OrganizationTypeID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationTypeName", SqlDbType.VarChar, OrganizationTypeName, 200)); command.Parameters.Add(dbconn.GenerateParameterObj("@KnowledgeSpeciality", SqlDbType.VarChar, KnowledgeSpeciality, 200)); // command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterLevelArmor", SqlDbType.Int, CharacterLevelArmor.ToString(), 0)); // command.Parameters.Add(dbconn.GenerateParameterObj("@AbilityMod", SqlDbType.Int, AbilityMod.ToString(), 0)); // command.Parameters.Add(dbconn.GenerateParameterObj("@ClassMod", SqlDbType.Int, ClassMod.ToString(), 0)); // command.Parameters.Add(dbconn.GenerateParameterObj("@RaceMod", SqlDbType.Int, RaceMod.ToString(), 0)); // command.Parameters.Add(dbconn.GenerateParameterObj("@FeatTalentMod", SqlDbType.Int, FeatTalentMod.ToString(), 0)); // command.Parameters.Add(dbconn.GenerateParameterObj("@MiscellaneousMod", SqlDbType.Int, MiscellaneousMod.ToString(), 0)); 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 OrganizationType. /// </summary> /// <returns>Boolean</returns> public bool DeleteOrganizationType() { 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_OrganizationType"; command.Parameters.Add(dbconn.GenerateParameterObj("@OrganizationTypeID", SqlDbType.Int, OrganizationTypeID.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); }