Esempio n. 1
0
 public bool VersionValidate(bool bothKeyID)
 {
     if (bothKeyID)
     { //CHECK BOTH VersionID AND StoredID
         if (this.totalSmartPortalEntities.GetVersionValidate(GlobalEnums.ConfigID, GlobalEnums.ConfigVersionID(GlobalEnums.ConfigID)).Single() == null)
         {
             this.HandleException("This web application must be updated. Please contact your administrators.");
         }
     }
     else
     { //CHECK ONLY VersionID.
         int?versionID = this.GetVersionID(GlobalEnums.ConfigID);
         if (versionID == null || (int)versionID != GlobalEnums.ConfigVersionID(GlobalEnums.ConfigID))
         {
             this.HandleException("This web application must be updated. Please contact your administrators.");
         }
     }
     return(true);
 }
Esempio n. 2
0
        private void VersionValidate()
        {
            if (MenuSession.GetFreshSession(this.HttpContext) == null || MenuSession.GetFreshSession(this.HttpContext) == "Restore")
            {
                foreach (GlobalEnums.FillingLine fillingLine in Enum.GetValues(typeof(GlobalEnums.FillingLine)))
                {
                    this.moduleRepository.ExecuteStoreCommand("UPDATE Configs SET VersionID = " + GlobalEnums.ConfigVersionID((int)fillingLine) + " WHERE ConfigID = " + (int)fillingLine + " AND VersionID < " + GlobalEnums.ConfigVersionID((int)fillingLine), new ObjectParameter[] { });
                }

                if (!this.moduleRepository.VersionValidate(false)) //JUST CHECK ONLY VersionID. THEN CALL AutoUpdates RIGHT BELOW TO UPDATE StoredID IF NEEDED
                {
                    throw new Exception("This web application must be updated. Please contact your administrators.");
                }

                if (!this.moduleRepository.AutoUpdates(MenuSession.GetFreshSession(this.HttpContext) == "Restore"))
                {
                    throw new Exception("This web application must be updated. Please contact your administrators.");
                }
            }
            MenuSession.SetFreshSession(this.HttpContext, "CLOSED");
        }