Beispiel #1
0
        private void DeleteUser_TI_Click(object sender, EventArgs e)
        {
            if (Datos.Current == null)
            {
                return;
            }

            if (((User)Datos.Current).Name == AppContext.User.Name)
            {
                PgMng.ShowInfoException(Resources.Messages.NO_DELETE_USER);
                return;
            }

            User item = (User)Datos.Current;

            if (item.Oid == 1)
            {
                PgMng.ShowInfoException(String.Format(moleQule.Library.Resources.Messages.DELETE_USER_NOT_ALLOWED, item.Name));
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
            {
                _usuarios.Remove(item.Oid);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public FormMngBase()
        {
            // Singleton
            _main = this;

            _pmg = Globals.Instance.ProgressInfoMng;
        }
Beispiel #3
0
 protected virtual void AcceptAction()
 {
     using (StatusBusy st = new StatusBusy(Resources.Messages.LOADING_DATA))
     {
         using (ProgressInfoMng bar = new ProgressInfoMng())
         {
             try
             {
                 PgMng.Grow();
                 PrintAction();
                 DialogResult = DialogResult.OK;
                 Close();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(iQExceptionHandler.GetAllMessages(ex),
                                 Labels.APP_TITLE,
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Exclamation);
             }
             finally
             {
                 PgMng.FillUp();
             }
         }
     }
 }
        public ProgressInfoMng()
        {
            if (MainBaseForm.Instance != null)
            {
                _singleton = this;

                Globals.Instance.Cursor = Cursors.WaitCursor;

                _pg_form = ProgressInfoForm.Instance;
                _pg_bar  = Globals.Instance.ProgressBar;
                _cursor  = Globals.Instance.Cursor;
#if TRACE
                _timer = Library.Timer.Instance;
#endif
                //
                // BkWorker
                //
                this.BkWorker.WorkerReportsProgress      = true;
                this.BkWorker.WorkerSupportsCancellation = true;
                this.BkWorker.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.BkWorker_DoWork);
                this.BkWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.BkWorker_RunWorkerCompleted);
                this.BkWorker.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.BkWorker_ProgressChanged);

                Init(100, 1);
            }
        }
Beispiel #5
0
        public BaseForm()
        {
            InitializeComponent();

            ViewMode = molView.Normal;
            Status   = EStatus.OK;

            if (Globals.Instance != null)
            {
                _pg_mng = Globals.Instance.ProgressInfoMng;
            }
        }
Beispiel #6
0
        private void Aceptar_Button_Click(object sender, EventArgs e)
        {
            string pattern = "[A-Z]+";

            if (!Regex.IsMatch(_pass, pattern))
            {
                PgMng.ShowInfoException(Resources.Messages.NOT_UCASE_PASS);
                return;
            }

            pattern = "[a-z]+";

            if (!Regex.IsMatch(_pass, pattern))
            {
                PgMng.ShowInfoException(Resources.Messages.NOT_LCASE_PASS);
                return;
            }

            pattern = "[0-9]+";

            if (!Regex.IsMatch(_pass, pattern))
            {
                PgMng.ShowInfoException(Resources.Messages.NOT_NUMBER_PASS);
                return;
            }

            if (_pass == _pass2)
            {
                if ((_pass != string.Empty) ||
                    ((_pass == string.Empty) && (DialogResult.Yes == ProgressInfoMng.ShowQuestion(Resources.Messages.PASSWORD_NULL))))
                {
                    DialogResult = DialogResult.OK;
                    //_pass = ClassMD5.getMd5Hash(_pass);
                    if (SaveAction())
                    {
                        Close();
                    }
                }
            }
            else
            {
                PgMng.ShowInfoException(Resources.Messages.NOT_EQUAL_PASS);
            }
        }
        /// <summary>
        /// Cambia el Culture de la aplicación al especificado
        /// </summary>
        /// <param name="culture_code">Codigo del Culture (es-EN, en, fr, ...)</param>
        public void SetCulture()
        {
            try
            {
                string culture;

                for (int i = 0; i < Idioma_GB.Controls.Count; i++)
                {
                    if (((RadioButton)Idioma_GB.Controls[i]).Checked)
                    {
                        culture = Idioma_GB.Controls[i].Tag.ToString();
                        SettingsMng.Instance.SetUserCulture(culture);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ProgressInfoMng.ShowError(ex);
            }
        }
        public virtual void DoLoadSchema()
        {
            // Cargar los datos de la empresa
            if ((_list_active_form.Count == 0) || (ProgressInfoMng.ShowQuestion(Resources.Messages.CURRENT_EDITION_CLOSE) == DialogResult.Yes))
            {
                //Cerrar todas las ventanas abiertas de la empresa actual
                FormMngBase.Instance.CloseAllChilds();

                PgMng.Grow();

                // Verificamos que el usuario actual tiene acceso a la empresa
                if (AppContext.User.CanAccessSchema(_schema.Oid))
                {
                    try
                    {
                        AppContext.Principal.ChangeUserSchema(_schema);
                        PgMng.Grow();

                        MainBaseForm.Instance.Reload();
                        PgMng.Grow();

                        MainBaseForm.Instance.SetFormSkin();
                        PgMng.FillUp();

                        this.Close();
                    }
                    catch (Exception ex)
                    {
                        PgMng.FillUp();
                        PgMng.ShowErrorException(ex);
                        MainBaseForm.Instance.Dispose();
                        Application.Exit();
                    }
                }
                else
                {
                    PgMng.ShowInfoException(Resources.Messages.SCHEMA_NOT_ALLOWED);
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// Abre un nuevo manager para la entidad. Si no está abierto, lo crea, y si
        /// lo está, lo muestra
        /// </summary>
        /// <param name="formID">Identificador del formulario que queremos abrir</param>
        /// <param name="param">Parámetro para el formulario</param>
        public virtual void OpenForm(string formID, object[] parameters, Form parent)
        {
            try
            {
                switch (formID)
                {
                case NewsBaseForm.ID:
                {
                    if (!BuscarFormulario(NewsBaseForm.Type))
                    {
                        NewsBaseForm em = new NewsBaseForm(parameters[1] as List <string>);
                        ShowFormulario(em);
                    }
                } break;

                case SchemaMngForm.ID:
                {
                    if (!BuscarFormulario(SchemaMngForm.Type))
                    {
                        SchemaMngForm em = new SchemaMngForm();
                        ShowFormulario(em);
                    }
                } break;

                case SettingsBaseForm.ID:
                {
                    if (!BuscarFormulario(SettingsBaseForm.Type))
                    {
                        CloseAllForms();
                        SettingsBaseForm em = new SettingsBaseForm();
                        ShowFormulario(em);
                    }
                } break;

                case UserMngForm.ID:
                {
                    if (!AppContext.User.IsAdmin)
                    {
                        iQExceptionHandler.TreatException(new iQAuthorizationException());
                    }

                    if (!BuscarFormulario(UserMngForm.Type))
                    {
                        UserMngForm em = new UserMngForm(parent);
                        ShowFormulario(em);
                    }
                } break;

                case UsersUIForm.ID:
                {
                    if (!AppContext.User.IsAdmin)
                    {
                        iQExceptionHandler.TreatException(new iQAuthorizationException());
                    }

                    if (!BuscarFormulario(UsersUIForm.Type))
                    {
                        UsersUIForm em = new UsersUIForm(AppContext.Principal.ActiveSchema, parent);
                        ShowFormulario(em);
                    }
                } break;

                case UserPasswordEditForm.ID:
                {
                    if (!BuscarFormulario(UserPasswordEditForm.Type))
                    {
                        UserPasswordEditForm em = new UserPasswordEditForm(AppContext.User, true);
                        ShowFormulario(em);
                    }
                } break;

                default:
                {
                    ProgressInfoMng.ShowException(String.Format(Messages.FORM_NOT_FOUND, formID));
                } break;
                }
            }
            catch (Exception ex)
            {
                if (Globals.Instance.ProgressInfoMng != null)
                {
                    Globals.Instance.ProgressInfoMng.ShowErrorException(ex);
                    Globals.Instance.ProgressInfoMng.FillUp();
                }
                else
                {
                    ProgressInfoMng.ShowException(ex);
                }
            }
        }
Beispiel #10
0
        public override void DoExecuteAction(molAction action)
        {
            switch (action)
            {
            case molAction.Cancel:

                if (CancelConfirmation)
                {
                    if (DialogResult.Yes == ProgressInfoMng.ShowQuestion(Resources.Messages.CANCEL_CONFIRM))
                    {
                        _action_result = DialogResult.Cancel;
                        CancelAction();
                    }
                    else
                    {
                        _action_result = DialogResult.Ignore;
                    }
                }
                else
                {
                    _action_result = DialogResult.Cancel;
                    CancelAction();
                }

                break;

            case molAction.Close:

                DialogResult = DialogResult.Cancel;
                Cerrar();
                break;

            case molAction.Print:

                _action_result = DialogResult.Ignore;
                PrintAction();
                break;

            case molAction.Save:

                ErrorMng_EP.Clear();
#if !TRACE
                PgMng.Reset(3, 1, Face.Resources.Messages.SAVING, this);
#endif
                //Se usa un atributo porque si uso el DialogResult el ShowDialog entiende que quiero cerrar el formulario
                _action_result = DialogResult.Ignore;

                SaveAction();

                switch (_action_result)
                {
                case DialogResult.OK:
                    _action_result = DialogResult.OK;
                    Close();
                    break;

                case DialogResult.Cancel:
                    _action_result = DialogResult.Cancel;
                    Close();
                    break;

                case DialogResult.Ignore:
                    break;
                }

                break;

            case molAction.ShowDocuments:

                _action_result = DialogResult.Ignore;
                DocumentsAction();
                break;

            default:
                base.DoExecuteAction(action);
                break;
            }
        }
Beispiel #11
0
 /// <summary>
 /// Guarda el objeto y sus entidades dependientes.
 /// Version para ejecutar en segundo plano.
 /// </summary>
 /// <returns></returns>
 protected virtual void BkSaveObject(ProgressInfoMng bar)
 {
     return;
 }