/// <summary> /// Saves the talent. /// </summary> /// <returns>Talent object</returns> public Talent SaveTalent() { 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_Talent"; command.Parameters.Add(dbconn.GenerateParameterObj("@TalentID", SqlDbType.Int, TalentID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@TalentTreeID", SqlDbType.Int, TalentTreeID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@TalentName", SqlDbType.VarChar, TalentName.ToString(), 100)); command.Parameters.Add(dbconn.GenerateParameterObj("@TalentDescription", SqlDbType.VarChar, TalentDescription.ToString(), 4000)); command.Parameters.Add(dbconn.GenerateParameterObj("@TalentSpecial", SqlDbType.VarChar, TalentSpecial.ToString(), 1000)); command.Parameters.Add(dbconn.GenerateParameterObj("@TurnSegmentID", SqlDbType.Int, TurnSegmentID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@MultipleSelection", SqlDbType.Int, MultipleSelection.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@BookID", SqlDbType.Int, BookID.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }
/// <summary> /// Deletes the talent. /// </summary> /// <returns>boolean</returns> public bool DeleteTalent() { 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_Talent"; command.Parameters.Add(dbconn.GenerateParameterObj("@TalentID", SqlDbType.Int, TalentID.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); }
/// <summary> /// Saves the talent prerequiste ability. /// </summary> /// <returns>TalentPrerequisteAbility object</returns> public TalentPrerequisteAbility SaveTalentPrerequisteAbility() { 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_TalentPrerequisteAbility"; command.Parameters.Add(dbconn.GenerateParameterObj("@AbilityID", SqlDbType.Int, AbilityID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@TalentID", SqlDbType.Int, TalentID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@AbilityMinimum", SqlDbType.Int, AbilityMinimum.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }