Пример #1
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            ClienteBE cliente = new ClienteBE();


                cliente.Cedula = lblCedulaCli.Text;
                cliente.Nombres_Cliente = txtNombres.Text.ToUpper();
                cliente.Apellido_1 = txtPrApellido.Text.ToUpper();
                cliente.Apellido_2 = txtSgApellido.Text.ToUpper();

                UbicacionBE ubicacion = new UbicacionBE();
                ubicacion.Direccion = txtDir.Text.ToUpper();
                ubicacion.Barrio = txtBarrio.Text.ToUpper();
                ubicacion.Telefono_1 = txtTel.Text;
                CiudadBE ciudad = new CiudadBE();
                ciudad.Id_Ciudad = "231";
                ubicacion.Ciudad = ciudad;                          
                cliente.Ubicacion = ubicacion;

            
            servCliente.Registrar_ClienteAsync(cliente);
            servCliente.Registrar_ClienteCompleted += new EventHandler<Registrar_ClienteCompletedEventArgs>(RegistrarCliente);
            servCliente.CloseAsync();
        }
Пример #2
0
 private void btnConsultar_Click(object sender, RoutedEventArgs e)
 {
     ClienteServiceClient servCliente = new ClienteServiceClient();
     servCliente.Consultar_ClienteAsync(txtCedula.Text);
     servCliente.Consultar_ClienteCompleted += new EventHandler<Consultar_ClienteCompletedEventArgs>(PoblarCliente);
     servCliente.CloseAsync();
 }
Пример #3
0
        private void btnGuardarModif_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            ClienteBE cliente = new ClienteBE();

            cliente.Cedula          = lblCedulaCli2.Text;
            cliente.Nombres_Cliente = txtNombres2.Text.ToUpper();
            cliente.Apellido_1      = txtPrApellido2.Text.ToUpper();
            cliente.Apellido_2      = txtSgApellido2.Text.ToUpper();

            UbicacionBE ubi = new UbicacionBE();

            if (Convert.ToBoolean(lblDireccion.Visibility == System.Windows.Visibility.Visible))
            {
                ubi.Id_Ubicacion     = lblIdDir.Text;
                ubi.Direccion        = txtDir.Text.ToUpper();
                ubi.Barrio           = txtBarrio.Text.ToUpper();
                ubi.Telefono_1       = txtTel.Text.ToUpper();
                ubi.Ciudad.Id_Ciudad = "231";

                btnGuardarModif.Margin = new Thickness(19, 643, 0, 0);
                btnMenuConsul.Margin   = new Thickness(224, 643, 0, 0);

                servCliente.ModificarDirClienteAsync(ubi);
                servCliente.ModificarDirClienteCompleted += new EventHandler <ModificarDirClienteCompletedEventArgs>(ModificarUbicacion);
            }

            servCliente.ModificarNombreClienteAsync(cliente);
            servCliente.ModificarNombreClienteCompleted += new EventHandler <ModificarNombreClienteCompletedEventArgs>(ModificarCliente);

            servCliente.CloseAsync();
        }
Пример #4
0
        private void btnConsultar_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            servCliente.Consultar_ClienteAsync(txtCedula.Text);
            servCliente.Consultar_ClienteCompleted += new EventHandler <Consultar_ClienteCompletedEventArgs>(PoblarCliente);
            servCliente.CloseAsync();
        }
Пример #5
0
        private void hplModificarCliente_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            servCliente.Consultar_ClienteAsync(lblCedulaCli.Text);
            servCliente.Consultar_ClienteCompleted += new EventHandler <Consultar_ClienteCompletedEventArgs>(ModificarCli);
            servCliente.CloseAsync();
        }
Пример #6
0
        private void ConsultarCliente(object sender, Consultar_ClienteCompletedEventArgs e)
         {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            try
            {
                if (e.Result.Cedula != null)
                {
                    MessageBox.Show("El cliente ya se encuentra registrado");
                    NavigationService.Navigate(new Uri("/Clientes/frmRegistrarCliente.xaml", UriKind.Relative));
                }
                else
                {
                    
                    txtNombres.Focus();
                    lblCedulaCli.Text = txtCedula.Text;


                    txtNombres.Text = "";
                    txtPrApellido.Text = "";
                    txtSgApellido.Text = "";
                    txtDir.Text = "";
                    txtBarrio.Text = "";
                    txtTel.Text = "";
                    
                    ContentBusq.Visibility = System.Windows.Visibility.Collapsed;
                    ContentDatosP.Visibility = System.Windows.Visibility.Visible;
                    txtNombres.Focus();
                }
                txtCedula.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ha ocurrido un error en el sistema");
                
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));

            }
            finally
            {
                servCliente.CloseAsync();
            }
           
        }
Пример #7
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            ClienteBE cliente = new ClienteBE();

                cliente.Cedula = lblCedulaCli.Text;
                cliente.Nombres_Cliente = txtNombres.Text.ToUpper();
                cliente.Apellido_1 = txtPrApellido.Text.ToUpper();
                cliente.Apellido_2 = txtSgApellido.Text.ToUpper();

                UbicacionBE ubicacion = new UbicacionBE();
                ubicacion.Direccion = txtDir.Text.ToUpper();
                ubicacion.Barrio = txtBarrio.Text.ToUpper();
                ubicacion.Telefono_1 = txtTel.Text;
                CiudadBE ciudad = new CiudadBE();
                ciudad.Id_Ciudad = "231";
                ubicacion.Ciudad = ciudad;
                cliente.Ubicacion = ubicacion;

            servCliente.Registrar_ClienteAsync(cliente);
            servCliente.Registrar_ClienteCompleted += new EventHandler<Registrar_ClienteCompletedEventArgs>(RegistrarCliente);
            servCliente.CloseAsync();
        }
Пример #8
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            ClienteBE nuevadir = new ClienteBE();

            nuevadir.Cedula = lblCedulaCli2.Text;

            UbicacionBE ubicacion = new UbicacionBE();

            ubicacion.Direccion  = txtNuevaDir.Text.ToUpper();
            ubicacion.Barrio     = txtNuevoBarrio.Text.ToUpper();
            ubicacion.Telefono_1 = txtTelefono.Text.ToUpper();
            CiudadBE ciu = new CiudadBE();

            ciu.Nombre_Ciudad  = "231";
            ubicacion.Ciudad   = ciu;
            nuevadir.Ubicacion = ubicacion;


            servCliente.Agregar_UbicacionAsync(nuevadir);
            servCliente.Agregar_UbicacionCompleted += new EventHandler <Agregar_UbicacionCompletedEventArgs>(AgregarUbiNueva);
            servCliente.CloseAsync();
        }
Пример #9
0
        private void btnGuardarModif_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            ClienteBE cliente = new ClienteBE();

            cliente.Cedula = lblCedulaCli2.Text;
            cliente.Nombres_Cliente = txtNombres2.Text.ToUpper();
            cliente.Apellido_1 = txtPrApellido2.Text.ToUpper();
            cliente.Apellido_2 = txtSgApellido2.Text.ToUpper();

            UbicacionBE ubi = new UbicacionBE();

            if (Convert.ToBoolean(lblDireccion.Visibility == System.Windows.Visibility.Visible))
            {
                ubi.Id_Ubicacion = lblIdDir.Text;
                ubi.Direccion = txtDir.Text.ToUpper();
                ubi.Barrio = txtBarrio.Text.ToUpper();
                ubi.Telefono_1 = txtTel.Text.ToUpper();
                ubi.Ciudad.Id_Ciudad = "231";

                btnGuardarModif.Margin = new Thickness(19, 643, 0, 0);
                btnMenuConsul.Margin = new Thickness(224, 643, 0, 0);

                servCliente.ModificarDirClienteAsync(ubi);
                servCliente.ModificarDirClienteCompleted += new EventHandler<ModificarDirClienteCompletedEventArgs>(ModificarUbicacion);
            }

            servCliente.ModificarNombreClienteAsync(cliente);
            servCliente.ModificarNombreClienteCompleted += new EventHandler<ModificarNombreClienteCompletedEventArgs>(ModificarCliente);

            servCliente.CloseAsync();
        }
Пример #10
0
 private void hplModificarCliente_Click(object sender, RoutedEventArgs e)
 {
     ClienteServiceClient servCliente = new ClienteServiceClient();
     servCliente.Consultar_ClienteAsync(lblCedulaCli.Text);
     servCliente.Consultar_ClienteCompleted += new EventHandler<Consultar_ClienteCompletedEventArgs>(ModificarCli);
     servCliente.CloseAsync();
 }
Пример #11
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            ClienteBE nuevadir = new ClienteBE();
            nuevadir.Cedula = lblCedulaCli2.Text;

            UbicacionBE ubicacion = new UbicacionBE();
            ubicacion.Direccion = txtNuevaDir.Text.ToUpper();
            ubicacion.Barrio = txtNuevoBarrio.Text.ToUpper();
            ubicacion.Telefono_1 = txtTelefono.Text.ToUpper();
            CiudadBE ciu = new CiudadBE();
            ciu.Nombre_Ciudad = "231";
            ubicacion.Ciudad = ciu;
            nuevadir.Ubicacion = ubicacion;

            servCliente.Agregar_UbicacionAsync(nuevadir);
            servCliente.Agregar_UbicacionCompleted += new EventHandler<Agregar_UbicacionCompletedEventArgs>(AgregarUbiNueva);
            servCliente.CloseAsync();
        }
Пример #12
0
        private void ConsultarCliente(object sender, Consultar_ClienteCompletedEventArgs e)
        {
            ClienteServiceClient servCliente = new ClienteServiceClient();

            try
            {
                if (e.Result.Cedula != null)
                {
                    MessageBox.Show("El cliente ya se encuentra registrado");
                    NavigationService.Navigate(new Uri("/Clientes/frmRegistrarCliente.xaml", UriKind.Relative));
                }
                else
                {

                    txtNombres.Focus();
                    lblCedulaCli.Text = txtCedula.Text;

                    txtNombres.Text = "";
                    txtPrApellido.Text = "";
                    txtSgApellido.Text = "";
                    txtDir.Text = "";
                    txtBarrio.Text = "";
                    txtTel.Text = "";

                    ContentBusq.Visibility = System.Windows.Visibility.Collapsed;
                    ContentDatosP.Visibility = System.Windows.Visibility.Visible;
                    txtNombres.Focus();
                }
                txtCedula.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ha ocurrido un error en el sistema");

                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));

            }
            finally
            {
                servCliente.CloseAsync();
            }
        }