Пример #1
0
        public void NuevoReducido()
        {
            try
            {
                if (!isMViewShow)
                {
                    MViewReducido           = new CAJ005TransferenciasMViewSmall();
                    MViewReducido.Presenter = this;
                    MViewReducido.LoadView();
                }

                MViewReducido.ClearItem();
                this.Item                     = new Transferencia();
                this.Item.TRAN_Tipo           = "R";
                this.Item.ListEgresos         = new ObservableCollection <Movimiento>();
                this.Item.ListIngresos        = new ObservableCollection <Movimiento>();
                this.Item.ListGastosBancarios = new ObservableCollection <GastosBancarios>();

                this.Item.ListEgresosEliminados         = new ObservableCollection <Movimiento>();
                this.Item.ListIngresosEliminados        = new ObservableCollection <Movimiento>();
                this.Item.ListGastosBancariosEliminados = new ObservableCollection <GastosBancarios>();

                this.MOVI_Egresos          = new Entities.Movimiento();
                this.MOVI_Egresos.Instance = InstanceEntity.Added;

                this.MOVI_GBancarios          = new Entities.GastosBancarios();
                this.MOVI_GBancarios.Instance = InstanceEntity.Added;

                this.MOVI_Ingresos          = new Entities.Movimiento();
                this.MOVI_Ingresos.Instance = InstanceEntity.Added;

                this.Item.EMPR_Codigo  = Controls.Entorno.ItemEmpresa.EMPR_Codigo;
                this.Item.AUDI_UsrCrea = Session.UserName;
                this.Item.AUDI_FecCrea = Session.Fecha;
                this.Item.SetEstado(Transferencia.Estado.Ingresado);
                this.Item.Instance = Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added;
                MViewReducido.SetItem();

                isMViewShow = true;
                if (LView != null)
                {
                    ((CAJ005TransferenciasMViewSmall)MViewReducido).Icon = System.Drawing.Icon.FromHandle(((System.Drawing.Bitmap)LView.IconView).GetHicon());
                }
                ((CAJ005TransferenciasMViewSmall)MViewReducido).StartPosition = FormStartPosition.CenterScreen;
                ((CAJ005TransferenciasMViewSmall)MViewReducido).ShowDialog();
                ((CAJ005TransferenciasMViewSmall)MViewReducido).BringToFront();
            }
            catch (Exception ex)
            { Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Title, Infrastructure.Aspect.Constants.Mensajes.NewPresenter, ex); }
        }
Пример #2
0
        public bool GuardarReducido(Boolean ShowMessage)
        {
            try
            {
                MViewReducido.GetItem();


                Item.ListIngresos = new ObservableCollection <Movimiento>();
                Item.ListIngresos.Add(MOVI_Ingresos);

                Item.ListEgresos = new ObservableCollection <Movimiento>();
                Item.ListEgresos.Add(MOVI_Egresos);

                if (MOVI_GBancarios.GBAN_MontoDebe + MOVI_GBancarios.GBAN_MontoHaber > 0)
                {
                    if (Item.Instance == InstanceEntity.Added)
                    {
                        MOVI_GBancarios.Instance = InstanceEntity.Added;
                    }
                    else
                    {
                        if (Item.ListGastosBancarios.Count > 0)
                        {
                            MOVI_GBancarios.Instance = InstanceEntity.Modified;
                        }
                        if (Item.ListGastosBancarios.Count == 0)
                        {
                            MOVI_GBancarios.Instance = InstanceEntity.Added;
                        }
                    }

                    Item.ListGastosBancarios = new ObservableCollection <GastosBancarios>();
                    Item.ListGastosBancarios.Add(MOVI_GBancarios);
                }
                else
                {
                    Item.ListGastosBancariosEliminados.Add(MOVI_GBancarios); Item.ListGastosBancarios = new ObservableCollection <GastosBancarios>();
                }

                if (Item.Validar())
                {
                    Entities.Transferencia _item = Item;
                    if (Client.SaveTransferencia(ref _item))
                    {
                        if (ShowMessage)
                        {
                            Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeSatisfactorio(Title, "Se ha guardado satisfactoriamente");
                        }
                        return(true);
                    }
                    else
                    {
                        MViewReducido.ShowValidation();
                        return(false);
                    }
                }
                else
                {
                    MViewReducido.ShowValidation();
                    return(false);
                }
                return(false);
            }
            catch (Exception ex)
            {
                Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Title, Infrastructure.Aspect.Constants.Mensajes.SavePresenter, ex);
                return(false);
            }
        }
Пример #3
0
        public void EditarReducido()
        {
            try
            {
                if (!isMViewShow)
                {
                    MViewReducido           = new CAJ005TransferenciasMViewSmall();
                    MViewReducido.Presenter = this;
                    MViewReducido.LoadView();
                }

                if (Item.TRAN_Estado.Equals(Item.GetEstado(Transferencia.Estado.Anulado)))
                {
                    if (Infrastructure.WinForms.Controls.Dialogos.MostrarMensajePregunta(Title, "El registro se encuentra anulado, ¿Desea abrir el registro en solo lectura?", Infrastructure.WinForms.Controls.Dialogos.LabelBoton.Si_No) == System.Windows.Forms.DialogResult.Yes)
                    {
                        MViewReducido.EnabledItem(false);
                    }
                    else
                    {
                        return;
                    }
                }
                if (Item.TRAN_Tipo.Equals("N"))
                {
                    Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeInformacion(Title, "El registro seleccionado fue editado desde el módulo detallado, y no puede ser editado con el modo reducido.");
                    return;
                }

                Item = Client.GetOneTransferencia(Delfin.Controls.Entorno.ItemEmpresa.EMPR_Codigo, Item.TRAN_Codigo);

                if (Item != null)
                {
                    MViewReducido.ClearItem();
                    this.Item.AUDI_UsrMod = Session.UserName;
                    this.Item.AUDI_FecMod = Session.Fecha;

                    this.Item.ListEgresosEliminados         = new ObservableCollection <Movimiento>();
                    this.Item.ListIngresosEliminados        = new ObservableCollection <Movimiento>();
                    this.Item.ListGastosBancariosEliminados = new ObservableCollection <GastosBancarios>();

                    if (Item.ListEgresos != null && Item.ListEgresos.Count > 0)
                    {
                        MOVI_Egresos = Item.ListEgresos[0];
                    }
                    else
                    {
                        MOVI_Egresos = new Movimiento();
                    }
                    if (Item.ListIngresos != null && Item.ListIngresos.Count > 0)
                    {
                        MOVI_Ingresos = Item.ListIngresos[0];
                    }
                    else
                    {
                        MOVI_Ingresos = new Movimiento();
                    }
                    if (Item.ListGastosBancarios != null && Item.ListGastosBancarios.Count > 0)
                    {
                        MOVI_GBancarios = Item.ListGastosBancarios[0];
                    }
                    else
                    {
                        MOVI_GBancarios = new GastosBancarios();
                    }

                    MViewReducido.SetItem();

                    isMViewShow = true;
                    if (LView != null)
                    {
                        ((CAJ005TransferenciasMViewSmall)MViewReducido).Icon = System.Drawing.Icon.FromHandle(((System.Drawing.Bitmap)LView.IconView).GetHicon());
                    }
                    ((CAJ005TransferenciasMViewSmall)MViewReducido).StartPosition = FormStartPosition.CenterScreen;
                    ((CAJ005TransferenciasMViewSmall)MViewReducido).ShowDialog();
                    ((CAJ005TransferenciasMViewSmall)MViewReducido).BringToFront();
                }
                else
                {
                    Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeInformacion(Title, "Debe seleccionar un elemento de la grilla");
                }
            }
            catch (Exception ex)
            { Infrastructure.WinForms.Controls.Dialogos.MostrarMensajeError(Title, Infrastructure.Aspect.Constants.Mensajes.EditPresenter, ex); }
        }