Пример #1
0
        /// <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);
        }
Пример #2
0
        /// <summary>
        /// Deletes the talent tree.
        /// </summary>
        /// <returns>Boolean</returns>
        public bool DeleteTalentTree()
        {
            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_TalentTree";
                command.Parameters.Add(dbconn.GenerateParameterObj("@TalentTreeID", SqlDbType.Int, TalentTreeID.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);
        }