private DBActivityLogType GetActivityLogTypeFromReader(IDataReader dataReader) { var item = new DBActivityLogType(); item.ActivityLogTypeId = NopSqlDataHelper.GetInt(dataReader, "ActivityLogTypeID"); item.SystemKeyword = NopSqlDataHelper.GetString(dataReader, "SystemKeyword"); item.Name = NopSqlDataHelper.GetString(dataReader, "Name"); item.Enabled = NopSqlDataHelper.GetBoolean(dataReader, "Enabled"); return(item); }
/// <summary> /// Gets an activity log type item /// </summary> /// <param name="activityLogTypeId">Activity log type identifier</param> /// <returns>Activity log type item</returns> public override DBActivityLogType GetActivityTypeById(int activityLogTypeId) { DBActivityLogType item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ActivityLogTypeLoadByPrimaryKey"); db.AddInParameter(dbCommand, "ActivityLogTypeID", DbType.Int32, activityLogTypeId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { item = GetActivityLogTypeFromReader(dataReader); } } return(item); }
/// <summary> /// Updates an activity log type item /// </summary> /// <param name="activityLogTypeId">Activity log type identifier</param> /// <param name="systemKeyword">The system keyword</param> /// <param name="name">The display name</param> /// <param name="enabled">Value indicating whether the activity log type is enabled</param> /// <returns>Activity log type item</returns> public override DBActivityLogType UpdateActivityType(int activityLogTypeId, string systemKeyword, string name, bool enabled) { DBActivityLogType item = null; Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_ActivityLogTypeUpdate"); db.AddInParameter(dbCommand, "ActivityLogTypeID", DbType.Int32, activityLogTypeId); db.AddInParameter(dbCommand, "SystemKeyword", DbType.String, systemKeyword); db.AddInParameter(dbCommand, "Name", DbType.String, name); db.AddInParameter(dbCommand, "Enabled", DbType.Boolean, enabled); if (db.ExecuteNonQuery(dbCommand) > 0) { item = GetActivityTypeById(activityLogTypeId); } return(item); }