Esempio n. 1
0
        public void LoadSettings(User user)
        {
            try
            {
                CloseSettings(user);

                _app_settings = ApplicationSettings.GetList();
                _app_settings.CloseSession();

                _schema_settings = Library.SchemaSettings.GetList();
                _schema_settings.CloseSession();

                if (!_user_settings.ContainsKey(user.Name))
                {
                    _user_settings.Add(user.Name, UserSettings.GetListByUser(user));
                    UserSettings.CloseSession();
                }

                LoadDefaultSettings();
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }
        }
Esempio n. 2
0
        internal void DeleteSelf(SchemaSettings parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            // if we're new then don't update the database
            if (this.IsNew)
            {
                return;
            }

            try
            {
                SessionCode = parent.SessionCode;
                Session().Delete(Session().Get <SchemaSettingRecord>(Oid));
            }
            catch (Exception ex)
            {
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }

            MarkNew();
        }
Esempio n. 3
0
        internal void Update(SchemaSettings parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                ValidationRules.CheckRules();

                if (!IsValid)
                {
                    throw new iQValidationException(Resources.Messages.GENERIC_VALIDATION_ERROR);
                }

                SessionCode = parent.SessionCode;
                SchemaSettingRecord obj = Session().Get <SchemaSettingRecord>(Oid);
                obj.CopyValues(this._base.Record);

                Session().Update(obj);
            }
            catch (Exception ex)
            {
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }

            MarkOld();
        }
Esempio n. 4
0
        internal void Insert(SchemaSettings parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                ValidationRules.CheckRules();

                if (!IsValid)
                {
                    throw new iQValidationException(Resources.Messages.GENERIC_VALIDATION_ERROR);
                }

                parent.Session().Save(Base.Record);
            }
            catch (Exception ex)
            {
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }

            MarkOld();
        }
Esempio n. 5
0
 public void CloseSettings(User user)
 {
     if (_app_settings != null)
     {
         _app_settings = null;
     }
     if (_schema_settings != null)
     {
         _schema_settings = null;
     }
     if (_user_settings.ContainsKey(user.Name))
     {
         _user_settings.Remove(user.Name);
     }
 }
Esempio n. 6
0
        public void LoadSchemaSettings()
        {
            try
            {
                if (_schema_settings != null)
                {
                    return;
                }

                _schema_settings = Library.SchemaSettings.GetList();
                _schema_settings.CloseSession();
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }
        }