Пример #1
0
 public WeaponDamageType GetWeaponDamageType(string WeaponDamageTypeName)
 {
     return(GetSingleWeaponDamageType("Select_WeaponDamageType", " WeaponDamageTypeName='" + WeaponDamageTypeID.ToString() + "'", ""));
 }
Пример #2
0
        public WeaponDamageType SaveWeaponDamageType()
        {
            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_WeaponDamageType";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponDamageTypeID", SqlDbType.Int, WeaponDamageTypeID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponDamageTypeName", SqlDbType.VarChar, WeaponDamageTypeName, 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponDamageTypeDescription", SqlDbType.VarChar, WeaponDamageTypeDescription, 100));

                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);
        }
Пример #3
0
        /// <summary>
        /// Delete the WeaponDamageType.
        /// </summary>
        /// <returns>Boolean</returns>
        public bool DeleteWeaponDamageType()
        {
            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_WeaponDamageType";
                command.Parameters.Add(dbconn.GenerateParameterObj("@WeaponDamageTypeID", SqlDbType.Int, WeaponDamageTypeID.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);
        }