public ActionResult <ClienteViewModel> Get(string identificacion)
        {
            var cliente = _clienteService.BuscarxIdentificacion(identificacion);

            if (cliente == null)
            {
                return(NotFound());
            }
            var clienteViewModel = new ClienteViewModel(cliente);

            return(clienteViewModel);
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            BusquedaClienteRespuesta respuesta = new BusquedaClienteRespuesta();
            string cliente_id = txtIdentificacion.Text;

            if (cliente_id != "")
            {
                respuesta = clienteService.BuscarxIdentificacion(cliente_id);

                if (respuesta.cliente != null)
                {
                    txtNombreCliente.Text = respuesta.cliente.PrimerNombre;
                    correo = respuesta.cliente.Email;
                    MessageBox.Show(respuesta.Mensaje, "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(respuesta.Mensaje, "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Por favor digite una identificación", "Datos", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public ActionResult <ClienteViewModel> Get(long identificacion)
        {
            //var clienteViewModel: ClienteViewModel();
            var cliente = _clienteService.BuscarxIdentificacion(identificacion);

            if (cliente == null)
            {
                var clienteViewModel = new ClienteViewModel();
                clienteViewModel = null;
                return(clienteViewModel);
            }
            else
            {
                var clienteViewModel = new ClienteViewModel(cliente);
                return(clienteViewModel);
            }
        }
示例#4
0
        private void butBuscar_Click(object sender, EventArgs e)
        {
            string tipo = comboTipo.Text;

            if (tipo == "Cliente")
            {
                BusquedaClienteRespuesta respuesta = new BusquedaClienteRespuesta();
                string cliente_id = txtIdentificacion.Text;
                if (cliente_id != "")
                {
                    respuesta = clienteService.BuscarxIdentificacion(cliente_id);

                    if (respuesta.cliente != null)
                    {
                        txtPrimerNombreText.Text   = respuesta.cliente.PrimerNombre;
                        txtSegundoNombreText.Text  = respuesta.cliente.SegundoNombre;
                        txtPrimerApellidoText.Text = respuesta.cliente.PrimerApellido;
                        txtSegundoApellido.Text    = respuesta.cliente.SegundoApellido;
                        txtCiudad.Text             = respuesta.cliente.Ciudad;
                        txtBarrio.Text             = respuesta.cliente.Barrio;
                        txtCasa.Text     = respuesta.cliente.N_Casa;
                        txtComuna.Text   = respuesta.cliente.Comuna;
                        txtTelefono.Text = respuesta.cliente.Telefono;
                        txtCorreo.Text   = respuesta.cliente.Email;
                        comboTipo.Text   = "Cliente";
                        MessageBox.Show(respuesta.Mensaje, "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(respuesta.Mensaje, "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Por favor digite una identificación", "Datos", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                BusquedaTrabajadorRespuesta respuesta = new BusquedaTrabajadorRespuesta();
                string trabajador_id = txtIdentificacion.Text;
                if (trabajador_id != "")
                {
                    respuesta = trabajadorService.BuscarxIdentificacionTrab(trabajador_id);

                    if (respuesta.trabajador != null)
                    {
                        txtPrimerNombreText.Text   = respuesta.trabajador.PrimerNombre;
                        txtSegundoNombreText.Text  = respuesta.trabajador.SegundoNombre;
                        txtPrimerApellidoText.Text = respuesta.trabajador.PrimerApellido;
                        txtSegundoApellido.Text    = respuesta.trabajador.SegundoApellido;
                        txtTelefono.Text           = respuesta.trabajador.Telefono;
                        comboCargo.Text            = respuesta.trabajador.Cargo;
                        txtCiudad.Text             = respuesta.trabajador.Ciudad;
                        txtBarrio.Text             = respuesta.trabajador.Barrio;
                        txtCasa.Text   = respuesta.trabajador.N_Casa;
                        txtComuna.Text = respuesta.trabajador.Comuna;
                        txtCorreo.Text = respuesta.trabajador.Email;
                        comboTipo.Text = "Trabajador";
                        MessageBox.Show(respuesta.Mensaje, "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(respuesta.Mensaje, "Busqueda", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Por favor digite una identificación", "Datos", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }