protected override void DeleteAction()
        {
            if (CurrentDocumento == null)
            {
                return;
            }

            if (ProgressInfoMng.ShowQuestion(Resources.Messages.DELETE_CONFIRM) == DialogResult.No)
            {
                return;
            }

            _back_job = BackJob.Delete;
            PgMng.Reset(9, 1, Resources.Messages.CONNECTING_SERVER, this);
            //PgMng.StartBackJob(this);
            DoJob();

            PgMng.Grow();
            if (PgMng.Result == BGResult.OK)
            {
                _entity.ApplyEdit();
                _entity.Save();
            }

            RefreshSecondaryData();
            PgMng.FillUp();
        }
        protected override void ViewAction()
        {
            if (CurrentDocumento == null)
            {
                return;
            }

            _destination_path = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            _back_job = BackJob.Download;
            PgMng.Reset(6, 1, Resources.Messages.CONNECTING_SERVER, this);
            //PgMng.StartBackJob(this);
            DoJob();

            PgMng.Grow();
            if (PgMng.Result == BGResult.OK)
            {
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo.FileName = TempFile;
                process.Start();
                PgMng.FillUp();
                try
                {
                    process.WaitForExit();
                }
                catch { }

                File.Delete(TempFile);
            }
            else
            {
                PgMng.FillUp();
            }
        }
Exemple #3
0
        /// <summary>
        /// Asigna el objeto al origen de datos y los orígenes de datos
        /// auxiliares a los ComboBox
        /// <returns>void</returns>
        /// </summary>
        protected virtual void SetFormData()
        {
            try
            {
                //Por si se llama despues de un intento fallido de acceder a un registro
                if (_disposing)
                {
                    return;
                }

                if (PgMng != null)
                {
                    PgMng.Message = Resources.Messages.LOADING_DATA;
                }

                if (_parent != null)
                {
                    BkGetFormData(null);
                }
                else
                {
                    _back_job = BackJob.GetFormData;
                    if (PgMng != null)
                    {
                        PgMng.StartBackJob(this);
                    }
                }
            }
            catch (Exception ex)
            {
                if (null != iQExceptionHandler <iQLockException> .GetiQException(ex))
                {
                    PgMng.ShowInfoException(Resources.Messages.LOCK_ERROR);
                }
                else
                {
                    PgMng.ShowInfoException(ex);
                }

                _disposing = true;
                Close();
            }
            finally
            {
#if TRACE
                if (PgMng != null)
                {
                    PgMng.Record("ManagerForm::SetFormData()");
                }
#endif
            }
        }
Exemple #4
0
        protected override void SubmitAction()
        {
            _back_job = BackJob.Login;

            PgMng.Reset(4, 1, Library.Resources.Messages.VALIDATING_USER, this);

            //PgMng.StartBackJob(this);

            //Thread ActionThread = new Thread(LoginAction);
            //ActionThread.Start();

            LoginAction();
        }
Exemple #5
0
 public static BackgroundJobInfo ToInfo(this BackJob job)
 {
     return(new BackgroundJobInfo
     {
         CreationTime = job.CreationTime,
         CreatorUserId = job.CreatorUserId,
         Id = job.Id,
         IsAbandoned = job.IsAbandoned,
         JobArgs = job.JobArgs,
         JobType = job.JobType,
         LastTryTime = job.LastTryTime,
         NextTryTime = job.NextTryTime,
         Priority = job.Priority,
         TryCount = job.TryCount,
     });
 }
        protected override void DownloadAction()
        {
            if (CurrentDocumento == null)
            {
                return;
            }

            if (Browser.ShowDialog() == DialogResult.OK)
            {
                _destination_path = Browser.SelectedPath;
                _back_job         = BackJob.Download;
                PgMng.Reset(5, 1, Resources.Messages.CONNECTING_SERVER, this);
                //PgMng.StartBackJob(this);
                DoJob();
                PgMng.FillUp();
            }
        }
        protected override void SendEmailAction()
        {
            if (CurrentDocumento == null)
            {
                return;
            }

            _destination_path = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            _back_job = BackJob.Download;
            PgMng.Reset(6, 1, Resources.Messages.CONNECTING_SERVER, this);
            //PgMng.StartBackJob(this);
            DoJob();

            PgMng.Grow();
            if (PgMng.Result == BGResult.OK)
            {
                PgMng.Grow(Face.Resources.Messages.SENDING_EMAIL);

                System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

                //mail.To.Add(new MailAddress(cliente.Email, cliente.Nombre));
                mail.From    = new MailAddress(SettingsMng.Instance.GetSMTPMail(), AppContext.ActiveSchema.Name);
                mail.Body    = String.Format(Resources.Messages.EMAIL_ATTACHMENT_BODY, AppContext.ActiveSchema.Name);
                mail.Subject = Resources.Messages.EMAIL_SUBJECT;
                mail.Attachments.Add(new Attachment(TempFile));

                PgMng.FillUp();
                try
                {
                    EMailClient.Instance.SmtpCliente.Send(mail);
                    PgMng.ShowInfoException(Resources.Messages.EMAIL_SUCCESS);
                }
                catch { }

                File.Delete(TempFile);
            }
            else
            {
                PgMng.FillUp();
            }
        }
        protected override void SubmitAction()
        {
            if (_entity.Nombre == string.Empty || _entity.Ruta == string.Empty)
            {
                PgMng.ShowInfoException(Resources.Messages.MISSING_FILE);

                _action_result = DialogResult.Ignore;
                return;
            }

            if (Fecha_DTP.Checked == false)
            {
                PgMng.ShowInfoException(Resources.Messages.MISSING_FECHA);

                _action_result = DialogResult.Ignore;
                return;
            }

            if (FechaAlta_DTP.Checked == false)
            {
                PgMng.ShowInfoException(Resources.Messages.MISSING_FECHA_ALTA);

                _action_result = DialogResult.Ignore;
                return;
            }

            if (Tipo_CB.SelectedItem == null)
            {
                PgMng.ShowInfoException(Resources.Messages.MISSING_TIPO);

                _action_result = DialogResult.Ignore;
                return;
            }

            this.Enabled = false;

            PgMng.Reset(9, 1, Resources.Messages.CONNECTING_SERVER, this);
            _back_job = BackJob.Update;
            //Hide();
            DoJob();
            //PgMng.StartBackJob(this);

            if (PgMng.Result == BGResult.OK)
            {
                //Si es nuevo añadimos la entrada en la base de datos
                if (_doc == null)
                {
                    AgenteDocumento agente_documento = _agente.Documentos.NewItem(_agente);
                    agente_documento.OidDocumento = _entity.Oid;
                    PgMng.Grow();

                    _agente.ApplyEdit();
                    _agente.Save();
                }
            }
            PgMng.FillUp();

            this.Enabled = true;

            _entity.CloseSession();
            _action_result = DialogResult.OK;
        }