Пример #1
0
        //TODO: UNIT Test
        public void SaveCharacterForceTechnique(int CharacterID)
        {
            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_CharacterForceTechnique";
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceSecretID", SqlDbType.Int, ForceTechniqueID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterID", SqlDbType.Int, CharacterID.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();
            }
        }
Пример #2
0
        /// <summary>
        /// Deletes the extra class item.
        /// </summary>
        /// <returns></returns>
        public bool DeleteForceTechnique()
        {
            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_ForceTechnique";
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTechniqueID", SqlDbType.Int, ForceTechniqueID.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);
        }
Пример #3
0
        /// <summary>
        /// Saves the force Technique.
        /// </summary>
        /// <returns>A ForceTechnique object</returns>
        public ForceTechnique SaveForceTechnique()
        {
            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_ForceTechnique";
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTechniqueID", SqlDbType.Int, ForceTechniqueID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTechniqueName", SqlDbType.VarChar, ForceTechniqueName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTechniqueDescription", SqlDbType.VarChar, ForceTechniqueDescription.ToString(), 500));
                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);
            //finally
            //{
            //    command.Dispose();
            //    connection.Close();
            //}
        }