public virtual void Init(string appAlias, string appVersion)
 {
     PrincipalBase.UpgradeSettings(appVersion);
     CheckModulesVersion();
     CheckCrystalReportsVersion();
     CheckServerPath();
 }
Beispiel #2
0
        protected virtual void Login()
        {
            try
            {
                if (AppContext.Principal != null)
                {
                    AppContext.Principal.Logout();
                }
                PrincipalBase.Login();

                MyLogger.LogText(string.Format("CONNECTED TO {0}:{1} AS USER {2}",
                                               SettingsMng.Instance.GetActiveServer(),
                                               SettingsMng.Instance.GetDBName(),
                                               SettingsMng.Instance.GetDBUser()),
                                 "Service::Login");
            }
            catch (Exception ex)
            {
                MyLogger.LogException(ex, "ServiceBase::Login");
                if (AppContext.Principal != null)
                {
                    AppContext.Principal.Close();
                }
            }
        }
Beispiel #3
0
        public override Schema Save()
        {
            // Por la posible doble interfaz Root/Child
            if (IsChild)
            {
                throw new iQException(Resources.Messages.CHILD_SAVE_NOT_ALLOWED);
            }

            if (IsDeleted && !CanDeleteObject())
            {
                throw new System.Security.SecurityException(Resources.Messages.USER_NOT_ALLOWED);
            }
            else if (IsNew && !CanAddObject())
            {
                throw new System.Security.SecurityException(Resources.Messages.USER_NOT_ALLOWED);
            }
            else if (!CanEditObject())
            {
                throw new System.Security.SecurityException(Resources.Messages.USER_NOT_ALLOWED);
            }

            // Guardamos si es nuevo pq tras el Save la propiedad IsNew es false
            // y necesitamos saber si es un Insert para crear el eschema de usuarios
            // tras guardar la empresa
            Boolean isNew = IsNew;

            try
            {
                ValidationRules.CheckRules();
            }
            catch (iQValidationException ex)
            {
                iQExceptionHandler.TreatException(ex);
                return(this);
            }

            try
            {
                base.Save();

                Transaction().Commit();

                if (isNew)
                {
                    PrincipalBase.NewSchema(Oid);
                }

                return(this);
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
                return(null);
            }
            finally
            {
                if (CloseSessions)
                {
                    CloseSession();
                }
                else
                {
                    BeginTransaction();
                }
            }
        }