示例#1
0
        /// <summary>
        /// Saves the Range.
        /// </summary>
        /// <returns>Range object</returns>
        public Range SaveRange()
        {
            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_Range";

                command.Parameters.Add(dbconn.GenerateParameterObj("@RangeID", SqlDbType.Int, RangeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@RangeName", SqlDbType.VarChar, RangeName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@BeginSquare", SqlDbType.Int, BeginSquare.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@EndSquare", SqlDbType.Int, EndSquare.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Modifier", SqlDbType.Int, ModifierID.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 size defense modifier.
        /// </summary>
        /// <returns>boolean</returns>
        public bool DeleteSizeDefenseModifier()
        {
            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_SizeDefenseModifier";
                command.Parameters.Add(dbconn.GenerateParameterObj("@SizeID", SqlDbType.Int, SizeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DefenseID", SqlDbType.Int, DefenseTypeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ModifierID", SqlDbType.Int, ModifierID.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);
        }