/// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            this.Datos.RaiseListChangedEvents = false;

            Payment temp = _entity.Clone();

            temp.ApplyEdit();

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

                return(true);
            }
            catch (Exception ex)
            {
                PgMng.ShowWarningException(ex.Message);
                return(false);
            }
            finally
            {
                this.Datos.RaiseListChangedEvents = true;
            }
        }
        private bool CheckStock()
        {
            ProductInfo producto = ProductInfo.Get(_entity.OidProducto);

            if (producto.AvisarStock)
            {
                BatchInfo partida = BatchInfo.Get(_entity.OidPartida, false);

                if (!partida.CheckStock(_entity, producto))
                {
                    DialogResult result = PgMng.ShowWarningException(Resources.Messages.AVISO_STOCK_MINIMO);

                    if (result == DialogResult.Yes)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                return(true);
            }
        }
Example #3
0
 protected override void SaveAction()
 {
     if (_entity.CheckPeriodoTipoInteres())
     {
         _action_result = SaveObject() ? DialogResult.OK : DialogResult.Ignore;
     }
     else
     {
         PgMng.ShowWarningException(Resources.Messages.TIPOS_INTERES_NO_VALIDOS);
     }
 }
        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();
                }
            }
        }
        protected override void GetFormSourceData(long oid, object[] parameters)
        {
            _entity = ExpedientInfo.Get(oid, false);
            PgMng.Grow();

            _entity.LoadChilds(typeof(Batch), true, true);
            PgMng.Grow(string.Empty, "Partidas");

            try
            {
                _entity.LoadChilds(typeof(Expense), true, true);
                PgMng.Grow(string.Empty, "Gastos");
            }
            catch
            {
                PgMng.ShowWarningException(Resources.Messages.DUPLICATED_EXPENSE_LINE);
            }
        }
        private bool GetSettings()
        {
            if (ContaWin_RB.Checked)
            {
                _config.TipoExportacion = ETipoExportacion.ContaWin;
                _config.RutaSalida      = RutaSalida_TB.Text;
                _config.AsientoInicial  = CW_AsientoInicial_TB.Text;
                _config.Diario          = CW_Diario_TB.Text;
            }
            if (A3_RB.Checked)
            {
                _config.TipoExportacion = ETipoExportacion.A3;
                _config.RutaSalida      = RutaSalida_TB.Text;
                _config.Empresa         = CodigoEmpresaA3_TB.Text;
            }
            else if (Tinfor_RB.Checked)
            {
                _config.TipoExportacion = ETipoExportacion.Tinfor;
                _config.RutaSalida      = RutaSalida_TB.Text;
                _config.AsientoInicial  = TF_AsientoInicial_TB.Text;
                _config.Diario          = TF_Diario_TB.Text;
                _config.Empresa         = TF_Empresa_TB.Text;
                _config.CentroTrabajo   = TF_Centro_TB.Text;

                if (_config.Empresa == string.Empty)
                {
                    PgMng.ShowWarningException(Resources.Messages.NO_COMPANY_SELECTED);

                    return(false);
                }


                if (_config.CentroTrabajo == string.Empty)
                {
                    PgMng.ShowWarningException(Resources.Messages.NO_CENTRO_SELECTED);

                    return(false);
                }
            }

            return(true);
        }
        private bool GetSettings()
        {
            if (SourceOutDelivery_RB.Checked)
            {
                _config.SourceEntityType = ETipoEntidad.OutputDelivery;
            }
            else if (SourceOutInvoice_RB.Checked)
            {
                _config.SourceEntityType = ETipoEntidad.FacturaEmitida;
            }

            if (_config.DestinationCompany == null)
            {
                PgMng.ShowWarningException(Resources.Messages.NO_COMPANY_SELECTED);
                return(false);
            }

            if (_config.DestinationHolder == null)
            {
                PgMng.ShowWarningException(Resources.Messages.NO_HOLDER_SELECTED);
                return(false);
            }

            if (DestinationInDelivery_RB.Checked)
            {
                _config.DestinationEntityType = ETipoEntidad.InputDelivery;
            }
            else if (DestinationInInvoice_RB.Checked)
            {
                _config.DestinationEntityType = ETipoEntidad.FacturaRecibida;
            }
            else if (DestinationOutDelivery_RB.Checked)
            {
                _config.DestinationEntityType = ETipoEntidad.OutputDelivery;
            }
            else if (DestinationOutInvoice_RB.Checked)
            {
                _config.DestinationEntityType = ETipoEntidad.FacturaEmitida;
            }

            return(true);
        }
Example #8
0
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            this.Datos.RaiseListChangedEvents = false;


            // do the save
            try
            {
                if (_holder != null)
                {
                    //IAcreedor temp = _acreedor.IClone();
                    //temp.ApplyEdit();
                    //_acreedor = temp.ISave(_entity);
                    //_acreedor.ApplyEdit();

                    _holder.ApplyEdit();
                    _holder.ISave(_entity);
                    _holder.BeginEdit();
                }
                else
                {
                    Payment temp = _entity.Clone();
                    temp.ApplyEdit();
                    _entity = temp.Save();
                    _entity.ApplyEdit();
                }

                return(true);
            }
            catch (Exception ex)
            {
                PgMng.ShowWarningException(ex.Message);
                return(false);
            }
            finally
            {
                this.Datos.RaiseListChangedEvents = true;
            }
        }
        protected override void SubmitAction()
        {
            PgMng.Reset(3, 1, Resources.Messages.UNIENDO_CLIENTES, this);

            try
            {
                if (_oid_source == 0)
                {
                    PgMng.ShowWarningException(Resources.Messages.NO_SOURCE_CLIENT_SELECTED);
                    _action_result = DialogResult.Ignore;

                    return;
                }
                PgMng.Grow();

                if (_oid_destiny == 0)
                {
                    PgMng.ShowWarningException(Resources.Messages.NO_DESTINY_CLIENT_SELECTED);
                    _action_result = DialogResult.Ignore;

                    return;
                }
                PgMng.Grow();

                Cliente.Merge(_oid_source, _oid_destiny);
                PgMng.FillUp();

                _action_result = DialogResult.OK;
            }
            catch (Exception ex)
            {
                PgMng.FillUp();
                PgMng.ShowInfoException(ex);

                _action_result = DialogResult.Ignore;
            }
        }