public override void DeleteObject(long oid)
        {
            LoanInfo    prestamo = LoanInfo.Get(ActiveOID, false);
            PaymentList pagos    = PaymentList.GetListByPrestamo(prestamo, false);

            PaymentInfo p = pagos.FirstOrDefault(x => x.EEstado != moleQule.Base.EEstado.Anulado);

            if (pagos != null && (pagos.FirstOrDefault(x => x.EEstado != moleQule.Base.EEstado.Anulado) != default(PaymentInfo)))
            {
                PgMng.ShowErrorException(Resources.Messages.PRESTAMO_CON_PAGOS_ASOCIADOS);
                _action_result = DialogResult.Cancel;
            }
            else
            {
                if (prestamo.OidPago != 0)
                {
                    PgMng.ShowErrorException(Resources.Messages.PRESTAMO_ASOCIADO_PAGO_FACTURA);
                    _action_result = DialogResult.Cancel;
                }
                else
                {
                    Loan.Delete(oid);
                    _action_result = DialogResult.OK;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            this.Datos.RaiseListChangedEvents = false;

            Ayuda temp = _entity.Clone();

            temp.ApplyEdit();

            // do the save
            try
            {
                _entity = temp.Save();
                _entity.ApplyEdit();

                return(true);
            }
            catch (iQValidationException ex)
            {
                PgMng.ShowInfoException(ex);
                return(false);
            }
            catch (Exception ex)
            {
                PgMng.ShowErrorException(ex);
                return(false);
            }
            finally
            {
                this.Datos.RaiseListChangedEvents = true;
            }
        }
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected bool SaveObject()
        {
            PgMng.Reset(3, 1, Resources.Messages.SAVING);

            User temp = _entity.Clone();

            temp.SessionCode = User.OpenSession();
            temp.BeginTransaction();
            PgMng.Grow();

            // do the save
            try
            {
                _entity = temp.Save();
                PgMng.Grow(string.Empty, "temp.Save()");

                return(true);
            }
            catch (iQValidationException ex)
            {
                PgMng.ShowInfoException(ex);
                return(false);
            }
            catch (Exception ex)
            {
                PgMng.ShowErrorException(ex);
                return(false);
            }
            finally
            {
                PgMng.FillUp();
                temp.CloseSession();
            }
        }
Esempio n. 4
0
        public override void ExecuteAction(molAction action, bool nested)
        {
            try
            {
#if TRACE
                PgMng.Record(String.Format("ItemMngBaseForm::ExecuteAction {0} INI", action.ToString()));
#endif
                if (!nested)
                {
                    if (Status == EStatus.Working)
                    {
                        return;
                    }

                    Status = EStatus.Working;

                    _current_action = action;

                    //Se usa un atributo porque si uso el DialogResult el ShowDialog entiende que quiero cerrar el formulario
                    _action_result = DialogResult.Ignore;
                }

                DoExecuteAction(action);
#if TRACE
                PgMng.Record(String.Format("ItemMngBaseForm::ExecuteAction {0} END", action.ToString()));
#endif
            }
            catch (iQValidationException ex)
            {
                Control control = ControlsMng.GetControlByProperty(Controls, ex.Field);

                if (control != null)
                {
                    MarkError(control, ex.Message);
                }
                else
                {
                    PgMng.ShowWarningException(ex);
                }
            }
            catch (Exception ex)
            {
                PgMng.ShowErrorException(ex);
            }
            finally
            {
                Status = EStatus.OK;
                if (PgMng != null)
                {
                    PgMng.FillUp();
                }
            }
        }
Esempio n. 5
0
        private void Temas_Grid_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            Tema current = ((Tema)e.Row.DataBoundItem);

            if (current != null)
            {
                PreguntaList preguntas = PreguntaList.GetPreguntasTema(current.OidModulo, current.Oid);

                if (preguntas.Count > 0)
                {
                    PgMng.ShowErrorException(Resources.Messages.TEMA_CON_PREGUNTAS);
                    e.Cancel = true;
                }
            }
        }
        public void DoJob()
        {
            PgMng.Result = BGResult.OK;

            try
            {
                switch (_back_job)
                {
                case BackJob.Update:
                    DoUpdate();
                    break;
                }
            }
            catch (Exception ex)
            {
                PgMng.Result = BGResult.Error;
                PgMng.ShowErrorException(ex);
            }
        }
Esempio n. 7
0
        public virtual void ExecuteAction(molAction action, bool nested)
        {
            try
            {
#if TRACE
                PgMng.Record(String.Format("ChildForm::ExecuteAction {0} INI", action.ToString()));
#endif
                if (!nested)
                {
                    if (Status == EStatus.Working)
                    {
                        return;
                    }

                    Status = EStatus.Working;

                    _current_action = action;

                    //Se usa un atributo porque si uso el DialogResult el ShowDialog entiende que quiero cerrar el formulario
                    _action_result = DialogResult.Ignore;
                }

                DoExecuteAction(action);
#if TRACE
                PgMng.Record(String.Format("ChildForm::ExecuteAction {0} END", action.ToString()));
#endif
            }
            catch (iQImplementationException ex)
            {
                PgMng.ShowInfoException(ex);
            }
            catch (Exception ex)
            {
                PgMng.ShowErrorException(ex);
            }
            finally
            {
                Status = EStatus.OK;
                //EnableForm(true);
                PgMng.FillUp();
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Implementa Save_button_Click
        /// </summary>
        protected override void SaveAction()
        {
            if (_entity.FechaInicio == DateTime.MinValue)
            {
                _entity.FechaInicio = DateTime.Today;
            }

            foreach (Sesion_Promocion item in _entity.Sesiones)
            {
                item.HoraInicio = DateTime.Parse(item.Hora);
            }

            if (_entity.Sesiones.Count > 0 && !_entity.CompruebaConfiguracion())
            {
                PgMng.ShowErrorException(Resources.Messages.CONFIGURACION_NO_VALIDA);
                _action_result = DialogResult.Ignore;
                return;
            }
            _action_result = SaveObject() ? DialogResult.OK : DialogResult.Ignore;
        }
        protected override void SelectLineExpedientAction()
        {
            if (_entity.EHolderType == ETipoEntidad.WorkReport)
            {
                return;
            }

            if (Lines_BS.Current == null)
            {
                return;
            }

            OutputDeliveryLine item = Lines_BS.Current as OutputDeliveryLine;

            if (item.OidPartida != 0)
            {
                ProgressInfoMng.ShowInfo(Resources.Messages.DELIVERY_LINE_EXPEDIENT_WARNING);
                return;
            }

            ExpedienteList expedientes = ExpedienteList.GetListByStockProducto(item.GetInfo(false));

            ExpedienteSelectForm form = new ExpedienteSelectForm(this, expedientes);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ExpedientInfo source = (ExpedientInfo)form.Selected;

                if (source.StockKilos < item.CantidadKilos)
                {
                    PgMng.ShowErrorException(Resources.Messages.STOCK_INSUFICIENTE + " " + source.StockKilos.ToString());
                    return;
                }

                item.OidExpediente = source.Oid;
                item.Expediente    = source.Codigo;

                AddCacheItem(source);
            }
        }
Esempio n. 10
0
        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);
                }
            }
        }
        /// <summary>
        /// La llama el backgroundworker para ejecutar codigo en segundo plano
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public new void BackGroundJob(BackgroundWorker bk)
        {
            try
            {
                switch (_back_job)
                {
                case BackJob.Update:
                    DoUpdate();
                    break;

                default:
                    base.BackGroundJob(bk);
                    return;
                }
            }
            catch (Exception ex)
            {
                PgMng.Result = BGResult.Error;
                CancelBackGroundJob();
                PgMng.ShowErrorException(ex);
            }
        }
Esempio n. 12
0
        protected bool SaveObject()
        {
            this.Datos.RaiseListChangedEvents = false;

            // do the save
            try
            {
                _holder.ApplyEdit();
                _holder.ISave(_entity);
                _holder.BeginEdit();

                return(true);
            }
            catch (Exception ex)
            {
                PgMng.ShowErrorException(ex);
                return(false);
            }
            finally
            {
                this.Datos.RaiseListChangedEvents = true;
            }
        }