private DBSearchLog GetSearchLogFromReader(IDataReader dataReader)
 {
     DBSearchLog searchLog = new DBSearchLog();
     searchLog.SearchLogID = NopSqlDataHelper.GetInt(dataReader, "SearchLogID");
     searchLog.SearchTerm = NopSqlDataHelper.GetString(dataReader, "SearchTerm");
     searchLog.CustomerID = NopSqlDataHelper.GetInt(dataReader, "CustomerID");
     searchLog.CreatedOn = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
     return searchLog;
 }
        private DBSearchLog GetSearchLogFromReader(IDataReader dataReader)
        {
            var item = new DBSearchLog();

            item.SearchLogId = NopSqlDataHelper.GetInt(dataReader, "SearchLogID");
            item.SearchTerm  = NopSqlDataHelper.GetString(dataReader, "SearchTerm");
            item.CustomerId  = NopSqlDataHelper.GetInt(dataReader, "CustomerID");
            item.CreatedOn   = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            return(item);
        }
Beispiel #3
0
        private DBSearchLog GetSearchLogFromReader(IDataReader dataReader)
        {
            DBSearchLog searchLog = new DBSearchLog();

            searchLog.SearchLogID = NopSqlDataHelper.GetInt(dataReader, "SearchLogID");
            searchLog.SearchTerm  = NopSqlDataHelper.GetString(dataReader, "SearchTerm");
            searchLog.CustomerID  = NopSqlDataHelper.GetInt(dataReader, "CustomerID");
            searchLog.CreatedOn   = NopSqlDataHelper.GetUtcDateTime(dataReader, "CreatedOn");
            return(searchLog);
        }
        private static SearchLog DBMapping(DBSearchLog dbItem)
        {
            if (dbItem == null)
                return null;

            SearchLog item = new SearchLog();
            item.SearchLogID = dbItem.SearchLogID;
            item.SearchTerm = dbItem.SearchTerm;
            item.CustomerID = dbItem.CustomerID;
            item.CreatedOn = dbItem.CreatedOn;

            return item;
        }
        /// <summary>
        /// Gets a search log item
        /// </summary>
        /// <param name="searchLogId">The search log item identifier</param>
        /// <returns>Search log item</returns>
        public override DBSearchLog GetSearchLogById(int searchLogId)
        {
            DBSearchLog item      = null;
            Database    db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand   dbCommand = db.GetStoredProcCommand("Nop_SearchLogLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "SearchLogID", DbType.Int32, searchLogId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetSearchLogFromReader(dataReader);
                }
            }
            return(item);
        }
Beispiel #6
0
        /// <summary>
        /// Gets all search log items
        /// </summary>
        /// <returns>Search log collection</returns>
        public override DBSearchLogCollection GetAllSearchLogs()
        {
            DBSearchLogCollection searchLogCollection = new DBSearchLogCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_SearchLogLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBSearchLog searchLog = GetSearchLogFromReader(dataReader);
                    searchLogCollection.Add(searchLog);
                }
            }

            return(searchLogCollection);
        }
Beispiel #7
0
        /// <summary>
        /// Inserts a search log item
        /// </summary>
        /// <param name="SearchTerm">The search term</param>
        /// <param name="CustomerID">The customer identifier</param>
        /// <param name="CreatedOn">The date and time of instance creation</param>
        /// <returns>Search log item</returns>
        public override DBSearchLog InsertSearchLog(string SearchTerm, int CustomerID, DateTime CreatedOn)
        {
            DBSearchLog searchLog = null;
            Database    db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand   dbCommand = db.GetStoredProcCommand("Nop_SearchLogInsert");

            db.AddOutParameter(dbCommand, "SearchLogID", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "SearchTerm", DbType.String, SearchTerm);
            db.AddInParameter(dbCommand, "CustomerID", DbType.Int32, CustomerID);
            db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, CreatedOn);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                int SearchLogID = Convert.ToInt32(db.GetParameterValue(dbCommand, "@SearchLogID"));
                searchLog = GetSearchLogByID(SearchLogID);
            }

            return(searchLog);
        }