Пример #1
0
        /// <summary>
        /// Delete the ConditionTrack.
        /// </summary>
        /// <returns>Boolean</returns>
        public bool DeleteConditionTrack()
        {
            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_ConditionTrack";
                command.Parameters.Add(dbconn.GenerateParameterObj("@ConditionTrackID", SqlDbType.Int, ConditionTrackID.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);
        }
Пример #2
0
        /// <summary>
        /// Saves the ConditionTrack.
        /// </summary>
        /// <returns>ConditionTrack Object</returns>
        public ConditionTrack SaveConditionTrack()
        {
            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_ConditionTrack";

                command.Parameters.Add(dbconn.GenerateParameterObj("@ConditionTrackID", SqlDbType.Int, ConditionTrackID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Modifier", SqlDbType.Int, Modifier.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Description", SqlDbType.VarChar, Description.ToString(), 200));

                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);
        }