private void LimpiarControles()
        {
            txtBuscarProducto.Text = "";
            txtBusquedaCO.Text     = "";
            txtBusquedaPu.Text     = "";
            txtCodigoPA.Text       = "";
            txtCodigoPE.Text       = "";
            txtCodigoPM.Text       = "";
            txtDescOf.Text         = "";
            txtDescripcionPA.Text  = "";
            txtDescripcionPA.Text  = "";
            txtDescripcionPE.Text  = "";
            txtDescripcionPM.Text  = "";
            txtMaxProd.Text        = "";
            txtMinProd.Text        = "";
            txtNombre.Text         = "";
            txtNombrePA.Text       = "";
            txtNombrePE.Text       = "";
            txtNombrePEL.Text      = "";
            txtNombrePM.Text       = "";
            txtNombrePMO.Text      = "";
            txtPrecio.Text         = "";
            txtPrecioAntes.Text    = "";
            txtPrecioPA.Text       = "";
            txtPrecioPE.Text       = "";
            txtPrecioPM.Text       = "";
            dgProd.ItemsSource     = null;
            chPubOf.IsChecked      = false;
            dpFecha.SelectedDate   = DateTime.Now;
            imgFoto.Source         = null;
            ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
            string JSON = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail);
            SucursalCollections sucCol = new SucursalCollections(JSON);

            dgSuc.ItemsSource   = sucCol.ToList();
            dgSucCO.ItemsSource = sucCol.ToList();
            JSON = proxy.ReadAllCategoria();
            CategoriaCollections catCol = new CategoriaCollections(JSON);

            dgCat.ItemsSource = catCol.ToList();
            JSON = proxy.ReadAllCategoria();
            CategoriaCollections catColl = new CategoriaCollections(JSON);

            cbCatOf.DisplayMemberPath = "Nombre";
            cbCatOf.SelectedValuePath = "IdCategoria";
            cbCatOf.ItemsSource       = catColl.ToList();
            cbCatOf.SelectedIndex     = 0;
            cbPublicadasCO.IsChecked  = false;
            dgOfertasCO.ItemsSource   = null;
        }
        private void btnListar_Click(object sender, RoutedEventArgs e)
        {
            ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
            string json = proxy.ReadAllProductos();
            Core.Negocio.ProductoCollections collprod = new Core.Negocio.ProductoCollections(json);
            collprod.ToList();
            dgProd.ItemsSource = collprod;


            string JSON = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail);
            SucursalCollections sucCol = new SucursalCollections(JSON);
            dgSuc.ItemsSource = sucCol.ToList();


        }
        private void CargarCombobox()
        {

            ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
            string json = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail);
            SucursalCollections sucCol = new SucursalCollections(json);
            cbSucursal.DisplayMemberPath = "Nombre";
            cbSucursal.SelectedValuePath = "IdSucursal";
            cbSucursal.ItemsSource = sucCol.ToList();

            string jerson = proxy.ReadAllCategoria();
            CategoriaCollections catColl = new CategoriaCollections(jerson);
            cbCatOf.DisplayMemberPath = "Nombre";
            cbCatOf.SelectedValuePath = "IdCategoria";
            cbCatOf.ItemsSource = catColl.ToList();

            // Carga Nombre y Apellido del usuario actual
            lblUserAct.Content = "Bienvenido " + nombreCompleto;


        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
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();
        }