private void CargarCombobox() { //Perfiles ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client(); string jsonP = proxy.ReadAllPerfil(); PerfilCollections perCol = new PerfilCollections(jsonP); cbPerfil.DisplayMemberPath = "Tipo"; cbPerfil.SelectedValuePath = "IdPerfil"; cbPerfil.ItemsSource = perCol.ToList(); cbPerfil.SelectedIndex = 0; //Sucursales string jsonS = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail); SucursalCollections suCol = new SucursalCollections(jsonS); Sucursal s = new Sucursal(); cbSucursal.DisplayMemberPath = "Nombre"; cbSucursal.SelectedValuePath = "IdSucursal"; cbSucursal.ItemsSource = suCol.ToList(); cbSucursal.SelectedIndex = 0; }
private void dgUsuario_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dgUsuario.SelectedItem != null) { cbPerfil.ItemsSource = null; cbSucursal.ItemsSource = null; Usuario u = (Usuario)dgUsuario.SelectedItem; Perfil p = new Perfil(); txtNombre.Text = u.Nombre; txtApellido.Text = u.Apellido; txtRut.Text = u.Rut; txtEmail.Text = u.Email; txtCelular.Text = u.NumeroCelular.ToString(); txtUsuario.Text = u.NombreUsuario; dpFecha.SelectedDate = u.FechaNacimiento; pbContraseña.Password = u.Password; pbContraseña2.Password = u.Password; ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client(); string jsonS = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail); SucursalCollections suCol = new SucursalCollections(jsonS); cbSucursal.DisplayMemberPath = "Nombre"; cbSucursal.SelectedValuePath = "IdSucursal"; cbSucursal.ItemsSource = suCol.ToList(); for (int i = 0; i < cbSucursal.Items.Count; i++) { Sucursal s = (Sucursal)cbSucursal.Items[i]; if (s.IdSucursal == u.IdSucursal) { cbSucursal.SelectedIndex = i; } } string jsonP = proxy.ReadAllPerfil(); PerfilCollections perCol = new PerfilCollections(jsonP); cbPerfil.DisplayMemberPath = "Tipo"; cbPerfil.SelectedValuePath = "IdPerfil"; cbPerfil.ItemsSource = perCol.ToList(); for (int i = 0; i < cbPerfil.Items.Count; i++) { Perfil pe = (Perfil)cbPerfil.Items[i]; if (pe.IdPerfil == u.IdPerfil) { cbPerfil.SelectedIndex = i; } } if (u.Activo == '1') { chActivar.IsChecked = true; } else { chActivar.IsChecked = false; } if (u.Sexo == 'm' || u.Sexo == 'M') { rbMas.IsChecked = true; } else { rbFem.IsChecked = true; } } }
private void CargarCombobox() { // Productos ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client(); string json = proxy.ReadAllRubros(); RubroCollections reCol = new RubroCollections(json); cbRubroPA.DisplayMemberPath = "TipoRubro"; cbRubroPA.SelectedValuePath = "IdRubro"; cbRubroPA.ItemsSource = reCol.ToList(); cbRubroPE.DisplayMemberPath = "TipoRubro"; cbRubroPE.SelectedValuePath = "IdRubro"; cbRubroPE.ItemsSource = reCol.ToList(); cbRubroPEL.DisplayMemberPath = "TipoRubro"; cbRubroPEL.SelectedValuePath = "IdRubro"; cbRubroPEL.ItemsSource = reCol.ToList(); cbRubroPM.DisplayMemberPath = "TipoRubro"; cbRubroPM.SelectedValuePath = "IdRubro"; cbRubroPM.ItemsSource = reCol.ToList(); cbRubroPMO.DisplayMemberPath = "TipoRubro"; cbRubroPMO.SelectedValuePath = "IdRubro"; cbRubroPMO.ItemsSource = reCol.ToList(); //usuarios //Perfiles string jsonP = proxy.ReadAllPerfil(); PerfilCollections perCol = new PerfilCollections(jsonP); cbPerfilUA.DisplayMemberPath = "Tipo"; cbPerfilUA.SelectedValuePath = "IdPerfil"; cbPerfilUA.ItemsSource = perCol.ToList(); cbPerfilUE.DisplayMemberPath = "Tipo"; cbPerfilUE.SelectedValuePath = "IdPerfil"; cbPerfilUE.ItemsSource = perCol.ToList(); cbPerfilUEB.DisplayMemberPath = "Tipo"; cbPerfilUEB.SelectedValuePath = "IdPerfil"; cbPerfilUEB.ItemsSource = perCol.ToList(); cbPerfilUM.DisplayMemberPath = "Tipo"; cbPerfilUM.SelectedValuePath = "IdPerfil"; cbPerfilUM.ItemsSource = perCol.ToList(); cbPerfilUMB.DisplayMemberPath = "Tipo"; cbPerfilUMB.SelectedValuePath = "IdPerfil"; cbPerfilUMB.ItemsSource = perCol.ToList(); //Sucursales string jsonS = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail); SucursalCollections suCol = new SucursalCollections(jsonS); Sucursal s = new Sucursal(); cbSucursalUA.DisplayMemberPath = "Nombre"; cbSucursalUA.SelectedValuePath = "IdSucursal"; cbSucursalUA.ItemsSource = suCol.ToList(); cbSucursalUE.DisplayMemberPath = "Nombre"; cbSucursalUE.SelectedValuePath = "IdSucursal"; cbSucursalUE.ItemsSource = suCol.ToList(); cbSucursalUM.DisplayMemberPath = "Nombre"; cbSucursalUM.SelectedValuePath = "IdSucursal"; cbSucursalUM.ItemsSource = suCol.ToList(); cbRetailUEB.DisplayMemberPath = "Nombre"; cbRetailUEB.SelectedValuePath = "IdSucursal"; cbRetailUEB.ItemsSource = suCol.ToList(); cbRetailUMB.DisplayMemberPath = "Nombre"; cbRetailUMB.SelectedValuePath = "IdSucursal"; cbRetailUMB.ItemsSource = suCol.ToList(); }