/// <summary>
        /// Load activities from DB
        /// </summary>
        public static ActivityCollection Load(ActivityFilter filter)
        {
            ActivityCollection activities = new ActivityCollection();
            Activity           a;

            Data.Sql    db = new Data.Sql();
            Data.Reader reader;

            BuildCommand(db, filter);

            try {
                reader = db.GetReader();
            } catch (System.Exception ex) {
                AMP.Exception.Log(ex);
                return(null);
            }

            while (reader.Read())
            {
                a           = new Activity();
                a.Type      = (Activity.Types)reader.GetInt32("Type");
                a.IpAddress = reader.GetIpAddress("IpAddress");
                a.Note      = reader.GetString("Note");
                a.On        = reader.GetTau("HappenedOn");
                activities.Add(a);
            }
            reader.Close();
            db.Finish(true);

            return(activities);
        }
예제 #2
0
        /// <summary>
        /// Log activity
        /// </summary>
        /// <param name="state">Optional callback state</param>
        private void Save(object state)
        {
            return;

            int ip = (_ipAddress == null) ? 0 : _ipAddress.ToInt32();

            object[] values = new object[] { (int)_type, ip, _userID, _entityID, _note };
            Data.Sql db     = new Data.Sql("ActivityInsert", values);

            try {
                db.ExecuteOnly();
            } catch (System.Exception e) {
                AMP.Exception.Log(e, Exception.Types.Database, db.Command.ToString());
            }
        }