Ejemplo n.º 1
0
 //====================================================================================================
 /// <summary>
 /// dispose.
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         this.disposed = true;
         if (disposing)
         {
             //
             // call .dispose for managed objects
             //
             // ----- Block all output from underlying routines
             //
             doc.blockExceptionReporting = true;
             doc.continueProcessing      = false;
             //
             // content server object is valid
             //
             if (serverConfig != null)
             {
                 if (appConfig != null)
                 {
                     if (appConfig.appStatus == AppConfigBaseModel.AppStatusEnum.ok)
                     {
                         if (deleteSessionOnExit)
                         {
                             if ((session != null))
                             {
                                 if ((session.visit != null) && (session.visit.id > 0))
                                 {
                                     //
                                     // -- delete visit
                                     visitProperty.deleteAll(session.user.id);
                                     DbBaseModel.delete <VisitModel>(cpParent, session.visit.id);
                                     //
                                     // -- delete viewing
                                     DbBaseModel.deleteRows <ViewingModel>(cpParent, "(visitId=" + session.visit.id + ")");
                                 }
                                 if ((session.visitor != null) && (session.visitor.id > 0))
                                 {
                                     //
                                     // -- delete visitor
                                     visitorProperty.deleteAll(session.user.id);
                                     DbBaseModel.delete <VisitorModel>(cpParent, session.visit.id);
                                 }
                             }
                         }
                         if (!deleteSessionOnExit && siteProperties.allowVisitTracking)
                         {
                             //
                             // If visit tracking, save the viewing record
                             //
                             string ViewingName = ((string)(session.visit.id + "." + session.visit.pageVisits)).left(10);
                             int    PageId      = 0;
                             if (_doc != null)
                             {
                                 if (doc.pageController.page != null)
                                 {
                                     PageId = doc.pageController.page.id;
                                 }
                             }
                             //
                             // -- convert requestForm to a name=value string for Db storage
                             string requestFormSerialized = GenericController.convertNameValueDictToREquestString(webServer.requestForm);
                             string pagetitle             = "";
                             if (!doc.htmlMetaContent_TitleList.Count.Equals(0))
                             {
                                 pagetitle = doc.htmlMetaContent_TitleList[0].content;
                             }
                             string sql = "insert into ccviewings ("
                                          + "Name,VisitId,MemberID,Host,Path,Page,QueryString,Form,Referer,DateAdded,StateOK,pagetime,Active,RecordID,ExcludeFromAnalytics,pagetitle,ccguid"
                                          + ")values("
                                          + " " + DbController.encodeSQLText(ViewingName)
                                          + "," + session.visit.id.ToString()
                                          + "," + session.user.id.ToString()
                                          + "," + DbController.encodeSQLText(webServer.requestDomain)
                                          + "," + DbController.encodeSQLText(webServer.requestPath)
                                          + "," + DbController.encodeSQLText(webServer.requestPage)
                                          + "," + DbController.encodeSQLText(webServer.requestQueryString.left(255))
                                          + "," + DbController.encodeSQLText(requestFormSerialized.left(255))
                                          + "," + DbController.encodeSQLText(webServer.requestReferrer.left(255))
                                          + "," + DbController.encodeSQLDate(doc.profileStartTime)
                                          + "," + DbController.encodeSQLBoolean(session.visitStateOk)
                                          + "," + doc.appStopWatch.ElapsedMilliseconds.ToString()
                                          + ",1"
                                          + "," + PageId.ToString()
                                          + "," + DbController.encodeSQLBoolean(webServer.pageExcludeFromAnalytics)
                                          + "," + DbController.encodeSQLText(pagetitle)
                                          + "," + DbController.encodeSQLText(doc.docGuid);
                             sql += ");";
                             Task.Run(() => db.executeNonQueryAsync(sql));
                         }
                     }
                 }
             }
             //
             // ----- dispose objects created here
             //
             if (_addon != null)
             {
                 _addon.Dispose();
                 _addon = null;
             }
             //
             if (_db != null)
             {
                 _db.Dispose();
                 _db = null;
             }
             //
             if (_cache != null)
             {
                 _cache.Dispose();
                 _cache = null;
             }
             //
             if (_db != null)
             {
                 _db.Dispose();
                 _db = null;
             }
             //
             _siteProperties  = null;
             _domains         = null;
             _docProperties   = null;
             _webServer       = null;
             _visitProperty   = null;
             _visitorProperty = null;
             _userProperty    = null;
         }
         //
         // cleanup non-managed objects
         //
     }
 }
Ejemplo n.º 2
0
        //
        //========================================================================
        /// <summary>
        /// Clears the edit lock for this record
        /// </summary>
        /// <param name="ContentName"></param>
        /// <param name="RecordID"></param>
        public static void clearEditLock(CoreController core, int tableId, int recordId)
        {
            string criteria = "(contentRecordKey=" + getTableRecordKey(tableId, recordId) + ")";

            DbBaseModel.deleteRows <AuthoringControlModel>(core.cpParent, criteria);
        }