Exemplo n.º 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            string id      = txtIdCustomer.Text;
            string Company = txtCompany.Text;
            string Contact = txtContact.Text;
            string Title   = txtTitle.Text;
            string Address = txtAddress.Text;
            string City    = txtCity.Text;
            string Region  = txtRegion.Text;
            string postal  = txtPostal.Text;
            string country = txtCountry.Text;
            string Phone   = txtPhone.Text;
            string Fax     = txtPhone.Text;


            try
            {
                WSservicio.ClienteIServiceClient cliente = new WSservicio.ClienteIServiceClient();
                cliente.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
                cliente.ClientCredentials.UserName.UserName = "******";
                cliente.ClientCredentials.UserName.Password = "******";

                if (cliente.nuevoCliente(id, Company, Contact, Title, Address, City, Region, postal, country, Phone, Fax) == 1)
                {
                    MessageBox.Show("Se ha registrado el cliente" + Company + " exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 2
0
        private void btnBuscarId_Click(object sender, EventArgs e)
        {
            try
            {
                WSservicio.ClienteIServiceClient cliente = new WSservicio.ClienteIServiceClient();
                cliente.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
                //cliente.ClientCredentials.UserName.UserName = "******";
                //cliente.ClientCredentials.UserName.Password = "******";

                string ide = txtBuscarId.Text;

                object lista = cliente.BuscarCliente(ide);

                int vari = ((ClienteWS.WSservicio.Cliente[])(lista)).Length;

                for (int i = 0; i < vari; i++)
                {
                    string texto0 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].id;
                    string texto1 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].contacto;
                    string texto2 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].company;
                    string texto3 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].pais;


                    string texto4 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].ciudad;
                    string texto5 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].direccion;
                    string texto6 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].tlf;

                    dataGridView1.Rows.Add(texto0, texto0, texto2, texto3, texto4, texto5, texto6);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 3
0
        private void FrmListar_Load(object sender, EventArgs e)
        {
            try
            {
                WSservicio.ClienteIServiceClient cliente = new WSservicio.ClienteIServiceClient();
                cliente.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
                cliente.ClientCredentials.UserName.UserName = "******";
                cliente.ClientCredentials.UserName.Password = "******";

                object lista = cliente.listarCliente();

                int vari = ((ClienteWS.WSservicio.Cliente[])(lista)).Length;

                for (int i = 0; i < vari; i++)
                {
                    txtPrueba.Text = i.ToString();


                    string texto0 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].id;
                    string texto1 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].contacto;
                    string texto2 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].company;
                    string texto3 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].pais;
                    string texto4 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].ciudad;
                    string texto5 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].direccion;
                    string texto6 = ((ClienteWS.WSservicio.Cliente[])(lista))[i].tlf;

                    dataGridView.Rows.Add(texto0, texto0, texto2, texto3, texto4, texto5, texto6);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                // throw new Exception();
            }
        }
Exemplo n.º 4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                string id = txtIdEliminar.Text;

                WSservicio.ClienteIServiceClient cliente = new WSservicio.ClienteIServiceClient();
                //cliente.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
                cliente.ClientCredentials.UserName.UserName = "******";
                cliente.ClientCredentials.UserName.Password = "******";

                cliente.eliminarCliente(id);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }