/// <summary>
        /// Execute method to write transaction to the database.
        /// </summary>
        public void Execute()
        {
            // store the view to the database if the viewer is NOT the target (don't track looking at your own record)
            if (ViewerPersonAliasId != TargetPersonAliasId)
            {
                var pvRecord = new PersonViewed();
                pvRecord.TargetPersonAliasId = TargetPersonAliasId;
                pvRecord.ViewerPersonAliasId = ViewerPersonAliasId;
                pvRecord.ViewDateTime        = DateTimeViewed;
                pvRecord.IpAddress           = IPAddress;
                pvRecord.Source = Source;

                using (var rockContext = new Rock.Data.RockContext())
                {
                    var pvService = new PersonViewedService(rockContext);
                    pvService.Add(pvRecord);
                    rockContext.SaveChanges();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Execute method to write transaction to the database.
        /// </summary>
        public void Execute()
        {
            // store the view to the database if the viewer is NOT the target (don't track looking at your own record)
            if (ViewerPersonId != TargetPersonId)
            {
                using (new Rock.Data.UnitOfWorkScope())
                {
                    PersonViewedService pvService = new PersonViewedService();

                    PersonViewed pvRecord = new PersonViewed();
                    pvService.Add(pvRecord, null);

                    pvRecord.IpAddress      = IPAddress;
                    pvRecord.TargetPersonId = TargetPersonId;
                    pvRecord.ViewerPersonId = ViewerPersonId;
                    pvRecord.ViewDateTime   = DateViewed;
                    pvRecord.Source         = Source;

                    pvService.Save(pvRecord, null);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Execute method to write transaction to the database.
        /// </summary>
        public void Execute()
        {
            // store the view to the database if the viewer is NOT the target (don't track looking at your own record)
            if ( ViewerPersonId != TargetPersonId )
            {
                using ( new Rock.Data.UnitOfWorkScope() )
                {

                    PersonViewedService pvService = new PersonViewedService();

                    PersonViewed pvRecord = new PersonViewed();
                    pvService.Add( pvRecord, null );

                    pvRecord.IpAddress = IPAddress;
                    pvRecord.TargetPersonId = TargetPersonId;
                    pvRecord.ViewerPersonId = ViewerPersonId;
                    pvRecord.ViewDateTime = DateViewed;
                    pvRecord.Source = Source;

                    pvService.Save( pvRecord, null );
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Execute method to write transaction to the database.
        /// </summary>
        public void Execute()
        {
            // store the view to the database if the viewer is NOT the target (don't track looking at your own record)
            if ( ViewerPersonAliasId != TargetPersonAliasId )
            {

                var pvRecord = new PersonViewed();
                pvRecord.TargetPersonAliasId = TargetPersonAliasId;
                pvRecord.ViewerPersonAliasId = ViewerPersonAliasId;
                pvRecord.ViewDateTime = DateTimeViewed;
                pvRecord.IpAddress = IPAddress;
                pvRecord.Source = Source;

                var rockContext = new Rock.Data.RockContext();
                var pvService = new PersonViewedService( rockContext );
                pvService.Add( pvRecord );
                rockContext.SaveChanges();
            }
        }