Esempio n. 1
0
        public List <SentRemindersLogTbl> GetAllByDate(DateTime pDateSent, string SortBy)
        {
            List <SentRemindersLogTbl> _DataItems = new List <SentRemindersLogTbl>();
            TrackerDb _TrackerDb = new TrackerDb();
            string    _sqlCmd    = CONST_SQL_SELECT_BYDATESENT;

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

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

                    _DataItem.ReminderID        = (_DataReader["ReminderID"] == DBNull.Value) ? 0 : Convert.ToInt32(_DataReader["ReminderID"]);
                    _DataItem.CustomerID        = (_DataReader["CustomerID"] == DBNull.Value) ? 0 : Convert.ToInt64(_DataReader["CustomerID"]);
                    _DataItem.DateSentReminder  = (_DataReader["DateSentReminder"] == DBNull.Value) ? System.DateTime.Now.Date : Convert.ToDateTime(_DataReader["DateSentReminder"]).Date;
                    _DataItem.NextPrepDate      = (_DataReader["NextPrepDate"] == DBNull.Value) ? System.DateTime.Now.Date : Convert.ToDateTime(_DataReader["NextPrepDate"]).Date;
                    _DataItem.ReminderSent      = (_DataReader["ReminderSent"] == DBNull.Value) ? false : Convert.ToBoolean(_DataReader["ReminderSent"]);
                    _DataItem.HadAutoFulfilItem = (_DataReader["HadAutoFulfilItem"] == DBNull.Value) ? false : Convert.ToBoolean(_DataReader["HadAutoFulfilItem"]);
                    _DataItem.HadReoccurItems   = (_DataReader["HadReoccurItems"] == DBNull.Value) ? false : Convert.ToBoolean(_DataReader["HadReoccurItems"]);
                    _DataItems.Add(_DataItem);
                }
                _DataReader.Close();
            }
            _TrackerDb.Close();
            return(_DataItems);
        }
Esempio n. 2
0
        public string InsertLogItem(SentRemindersLogTbl pSentRemindersLog)
        {
            string _ErrString = String.Empty;

            TrackerDb _TDB = new TrackerDb();

            _TDB.AddParams(pSentRemindersLog.CustomerID, DbType.Int64);
            _TDB.AddParams(pSentRemindersLog.DateSentReminder, DbType.Date);
            _TDB.AddParams(pSentRemindersLog.NextPrepDate, DbType.Date);
            _TDB.AddParams(pSentRemindersLog.ReminderSent, DbType.Boolean);
            _TDB.AddParams(pSentRemindersLog.HadAutoFulfilItem, DbType.Boolean);
            _TDB.AddParams(pSentRemindersLog.HadReoccurItems, DbType.Boolean);
            _ErrString = _TDB.ExecuteNonQuerySQL(CONST_SQL_INSERT);
            _TDB.Close();

            return(_ErrString);
        }