private void MethodLoadHeader()
 {
     CollectionESGR_EmpresaSucursal.Source = new BSGR_EmpresaSucursal().GetCollectionEmpresaSucursal(SGRVariables.ESGR_Usuario.ESGR_Empresa);
     Application.Current.Dispatcher.Invoke(() =>
     {
         SelectESGR_EmpresaSucursal = CollectionESGR_EmpresaSucursal.FirstOrDefault();
     });
 }
 public async void MethodLoadHeader()
 {
     await Task.Factory.StartNew(() =>
     {
         CollectionESGR_EmpresaSucursal.Source = new BSGR_EmpresaSucursal().GetCollectionEmpresaSucursal(SGRVariables.ESGR_Usuario.ESGR_Empresa);
         if (ESGR_Documento.Opcion == "I")
         {
             SelectedESGR_EmpresaSucursal = CollectionESGR_EmpresaSucursal.FirstOrDefault();
         }
         else
         {
             SelectedESGR_EmpresaSucursal = CollectionESGR_EmpresaSucursal.FirstOrDefault(x => x.IdEmpSucursal == ESGR_Documento.ESGR_EmpresaSucursal.IdEmpSucursal);
         }
     });
 }
 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;
     }
 }
示例#4
0
        private async void MethodLoadDetail()
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    CmpObservableCollection <ESGR_UsuarioEmpresaSucursal> vrCollectionUsuarioEmpresaSucursal = new CmpObservableCollection <ESGR_UsuarioEmpresaSucursal>(new BSGR_UsuarioEmpresaSucursal().GetCollectionUsuarioEmpresaSucursal().Where(x => x.ESGR_Usuario.IdUsuario == ESGR_Usuario.IdUsuario));
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        CollectionDataGridESGR_EmpresaSucursal.Clear();
                        vrCollectionUsuarioEmpresaSucursal.ToList().ForEach(x =>
                        {
                            if (CollectionESGR_EmpresaSucursal.ToList().Exists(y => y.IdEmpSucursal == x.ESGR_EmpresaSucursal.IdEmpSucursal))
                            {
                                ESGR_EmpresaSucursal Aux = CollectionESGR_EmpresaSucursal.FirstOrDefault(y => y.IdEmpSucursal == x.ESGR_EmpresaSucursal.IdEmpSucursal);
                                CollectionDataGridESGR_EmpresaSucursal.Add(Aux);
                                CollectionESGR_EmpresaSucursal.Remove(Aux);
                            }
                        });
                    });

                    CmpObservableCollection <ESGR_UsuarioArea> vrCollectionUsuarioArea = new CmpObservableCollection <ESGR_UsuarioArea>(new BSGR_UsuarioArea().GetCollectionUsuarioArea().Where(x => x.ESGR_Usuario.IdUsuario == ESGR_Usuario.IdUsuario));
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        CollectionDataGridESGR_Area.Clear();
                        vrCollectionUsuarioArea.ToList().ForEach(x =>
                        {
                            if (CollectionESGR_Area.ToList().Exists(y => y.IdArea == x.ESGR_Area.IdArea))
                            {
                                ESGR_Area Aux = CollectionESGR_Area.FirstOrDefault(y => y.IdArea == x.ESGR_Area.IdArea);
                                CollectionDataGridESGR_Area.Add(Aux);
                                CollectionESGR_Area.Remove(Aux);
                            }
                        });
                    });
                }
                catch (Exception ex)
                {
                    CmpMessageBox.Show(SGRMessage.AdministratorUsuario, ex.Message, CmpButton.Aceptar);
                }
            });
        }