Example #1
0
        public List <TransactionTypesTbl> GetAll(string SortBy)
        {
            List <TransactionTypesTbl> _DataItems = new List <TransactionTypesTbl>();
            TrackerDb _TrackerDb = new TrackerDb();
            string    _sqlCmd    = CONST_SQL_SELECT;

            if (!String.IsNullOrEmpty(SortBy))
            {
                _sqlCmd += " ORDER BY " + SortBy;                              // Add order by string
            }
            // params would go here if need
            IDataReader _DataReader = _TrackerDb.ExecuteSQLGetDataReader(_sqlCmd);

            if (_DataReader != null)
            {
                while (_DataReader.Read())
                {
                    TransactionTypesTbl _DataItem = new TransactionTypesTbl();

                    _DataItem.TransactionID   = (_DataReader["TransactionID"] == DBNull.Value) ? 0 : Convert.ToInt32(_DataReader["TransactionID"]);
                    _DataItem.TransactionType = (_DataReader["TransactionType"] == DBNull.Value) ? string.Empty : _DataReader["TransactionType"].ToString();
                    _DataItem.Notes           = (_DataReader["Notes"] == DBNull.Value) ? string.Empty : _DataReader["Notes"].ToString();
                    _DataItems.Add(_DataItem);
                }
                _DataReader.Close();
            }
            _TrackerDb.Close();
            return(_DataItems);
        }
Example #2
0
        public string InsertTransactionType(TransactionTypesTbl pTransactionType)
        {
            TrackerDb _TDB = new TrackerDb();

            _TDB.AddParams(pTransactionType.TransactionID, DbType.Int32);
            _TDB.AddParams(pTransactionType.TransactionType);
            _TDB.AddParams(pTransactionType.Notes);

            string _Result = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);

            _TDB.Close();

            return(_Result);
        }
Example #3
0
        public static void UpdateTransaction(TransactionTypesTbl pTransactionType, int pOrignal_TransactionID)
        {
            TrackerDb _TDB = new TrackerDb();

            _TDB.AddParams(pTransactionType.TransactionType);
            _TDB.AddParams(pTransactionType.Notes);

            if (pOrignal_TransactionID > 0)
            {
                _TDB.AddWhereParams(pOrignal_TransactionID, DbType.Int32);
            }
            else
            {
                _TDB.AddWhereParams(pTransactionType.TransactionID, DbType.Int32);
            }

            string _Result = _TDB.ExecuteNonQuerySQL(CONST_SQL_UPDATE);

            _TDB.Close();

            // return _Result;
        }
Example #4
0
 public static void UpdateTransaction(TransactionTypesTbl pTransactionType)
 {
     UpdateTransaction(pTransactionType, 0);
 }