public async void MethodLoadMoneda()
 {
     await Task.Factory.StartNew(() =>
     {
         try
         {
             CollectionESGR_Moneda.Source = new BSGR_Moneda().GetCollectionMoneda();
             var FirstMoneda = CollectionESGR_Moneda.ToList().FirstOrDefault(x => x.Defecto == true);
             Application.Current.Dispatcher.Invoke(() =>
             {
                 CollectionESGR_Moneda.Remove(FirstMoneda);
             });
             if (ESGR_TipoCambio.Opcion == "I")
             {
                 SelectedESGR_Moneda = CollectionESGR_Moneda.ToList().FirstOrDefault();
             }
             else
             {
                 SelectedESGR_Moneda = CollectionESGR_Moneda.ToList().FirstOrDefault(x => x.CodMoneda == ESGR_TipoCambio.ESGR_Moneda.CodMoneda);
             }
         }
         catch (Exception ex)
         {
             CmpMessageBox.Show(SGRMessage.AdministratorTipoCambio, ex.Message, CmpButton.Aceptar);
         }
     });
 }
 private void MethodLoadHeader()
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         CollectionASSGR_ValueComboBox.Clear();
         CollectionASSGR_ValueComboBox.Add(new ASSGR_ValueComboBox()
         {
             Codigo = "ING", Value = "INGRESO"
         });
         CollectionASSGR_ValueComboBox.Add(new ASSGR_ValueComboBox()
         {
             Codigo = "SAL", Value = "SALIDA"
         });
     });
     CollectionESGR_Caja.Source            = new CmpObservableCollection <ESGR_Caja>(new BSGR_Caja().CollectionESGR_Caja().Where(x => x.ESGR_Estado.CodEstado == "APTCJ"));
     CollectionESGR_Moneda.Source          = new BSGR_Moneda().GetCollectionMoneda();
     CollectionESGR_Documento.Source       = new BSGR_Documento().GetCollectionDocumento();
     CollectionESGR_EmpresaSucursal.Source = new BSGR_EmpresaSucursal().GetCollectionEmpresaSucursal(SGRVariables.ESGR_Usuario.ESGR_Empresa);
     PropertyTipoCambio = 1;
     if (ESGR_MovimientoCaja.Opcion == "I")
     {
         Glosa = string.Empty;
         SelectedESGR_Moneda = CollectionESGR_Moneda.FirstOrDefault(x => x.Defecto);
         ESGR_MovimientoCaja.ESGR_Documento = (SelectedESGR_Documento = CollectionESGR_Documento.FirstOrDefault(x => x.CodDocumento == "CAJ"));
         SelectedFecha = DateTime.Now;
         SelectedESGR_EmpresaSucursal = CollectionESGR_EmpresaSucursal.FirstOrDefault();
         SelectedASSGR_ValueComboBox  = CollectionASSGR_ValueComboBox.FirstOrDefault();
         Application.Current.Dispatcher.Invoke(() =>
         {
             if (CollectionESGR_MovimientoCajaDetalle.Count > 0)
             {
                 CollectionESGR_MovimientoCajaDetalle.Clear();
             }
         });
     }
     else
     {
         Glosa = ESGR_MovimientoCaja.Glosa;
         SelectedESGR_Documento       = CollectionESGR_Documento.FirstOrDefault(x => x.CodDocumento == ESGR_MovimientoCaja.ESGR_Documento.CodDocumento);
         SelectedESGR_Moneda          = CollectionESGR_Moneda.FirstOrDefault(x => x.CodMoneda == ESGR_MovimientoCaja.ESGR_Moneda.CodMoneda);
         SelectedESGR_EmpresaSucursal = CollectionESGR_EmpresaSucursal.FirstOrDefault(x => x.IdEmpSucursal == ESGR_MovimientoCaja.ESGR_EmpresaSucursal.IdEmpSucursal);
         SelectedASSGR_ValueComboBox  = CollectionASSGR_ValueComboBox.FirstOrDefault(x => x.Codigo == ESGR_MovimientoCaja.CodOperacion);
         SelectedFecha = ESGR_MovimientoCaja.Fecha;
     }
 }
Example #3
0
        private async void MethodLoadHeader()
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    ESGR_Cliente vrESGR_Cliente = new ESGR_Cliente();
                    if (ESGR_VentaCuenta.Opcion != "I")
                    {
                        vrESGR_Cliente = ESGR_VentaCuenta.ESGR_Cliente;
                    }
                    ObservableCollection <ASSGR_ValueComboBox> GetCollectionValueComboBox = new ObservableCollection <ASSGR_ValueComboBox>()
                    {
                        #region ADD VALUES
                        new ASSGR_ValueComboBox()
                        {
                            Codigo = "PAG",
                            Value  = "PAGADO"
                        },
                        new ASSGR_ValueComboBox()
                        {
                            Codigo = "PED",
                            Value  = "PENDIENTE"
                        }
                        #endregion
                    };
                    CollectionESGR_MedioPago.Source            = new BSGR_MedioPago().GetCollectionMedioPago();
                    CollectionESGR_Estado.Source               = new CmpObservableCollection <ASSGR_ValueComboBox>(GetCollectionValueComboBox);
                    CollectionESGR_DocumentoSerieNumero.Source = new BSGR_Documento().GetCollectionDocumento();
                    CollectionESGR_Cliente.Source              = new BSGR_Cliente().GetCollectionCliente("%");
                    CollectionESGR_Documento.Source            = new CmpObservableCollection <ESGR_Documento>(new BSGR_Documento().GetCollectionDocumento().Where(x => x.ESGR_EmpresaSucursal.IdEmpSucursal == 1).AsEnumerable());
                    CollectionESGR_Moneda.Source               = new BSGR_Moneda().GetCollectionMoneda();

                    PropertyFiltroPedido = string.Empty;
                    if (ESGR_VentaCuenta.Opcion != "I")
                    {
                        SelectedESGR_Documento = CollectionESGR_Documento.FirstOrDefault(x => x.CodDocumento == ESGR_VentaCuenta.ESGR_Documento.CodDocumento);
                        SelectedESGR_MedioPago = CollectionESGR_MedioPago.FirstOrDefault(x => x.IdMedioPago == ESGR_VentaCuenta.ESGR_MedioPago.IdMedioPago);
                        SelectedESGR_Estado    = CollectionESGR_Estado.First(x => x.Codigo == "PAG");
                        SelectedESGR_Moneda    = CollectionESGR_Moneda.FirstOrDefault(x => x.CodMoneda == ESGR_VentaCuenta.ESGR_Moneda.CodMoneda);
                        if (vrESGR_Cliente.IdCliente != 0)
                        {
                            SelectedEGSR_Cliente = CollectionESGR_Cliente.FirstOrDefault(x => x.IdCliente == vrESGR_Cliente.IdCliente);
                        }
                        else
                        {
                            SelectedEGSR_Cliente = vrESGR_Cliente;
                            NroDocIdentidad      = vrESGR_Cliente.NroDocIdentidad;
                        }
                    }
                    else
                    {
                        SelectedESGR_Documento = CollectionESGR_Documento.ToList().FirstOrDefault();
                        SelectedESGR_MedioPago = CollectionESGR_MedioPago.FirstOrDefault();
                        SelectedESGR_Estado    = CollectionESGR_Estado.First(x => x.Codigo == "PED");
                        SelectedESGR_Moneda    = CollectionESGR_Moneda.FirstOrDefault(x => x.CodMoneda == "SOL");
                        SelectedEGSR_Cliente   = null;
                    }
                    MethodLoadPedido(ESGR_VentaCuenta.ESGR_Venta.ESGR_Pedido);
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar);
                }
            });
        }