Ejemplo n.º 1
0
        /// <summary>
        /// Deletes the extra class item.
        /// </summary>
        /// <returns></returns>
        public bool DeleteForcePower()
        {
            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_ForcePower";
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePowerID", SqlDbType.Int, ForcePowerID.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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves the force power.
        /// </summary>
        /// <returns></returns>
        public ForcePower SaveForcePower()
        {
            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_ForcePower";
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePowerID", SqlDbType.Int, ForcePowerID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePowerName", SqlDbType.VarChar, ForcePowerName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePowerDescription", SqlDbType.VarChar, ForcePowerDescription.ToString(), 500));
                command.Parameters.Add(dbconn.GenerateParameterObj("@TurnSegmentID", SqlDbType.Int, TurnSegmentID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePowerTarget", SqlDbType.VarChar, ForcePowerTarget.ToString(), 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePowerSpecial", SqlDbType.VarChar, ForcePowerDescription.ToString(), 1000));
                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);
        }