private void btnGetAll_Click(object sender, EventArgs e) { ContactService.ContactServiceClient client = new ContactService.ContactServiceClient(); client.ClientCredentials.UserName.UserName = "******"; client.ClientCredentials.UserName.Password = "******"; try { grdAllContact.DataSource = client.GetAll(); client.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //client.Close(); } }
private void btnGetInfo_Click(object sender, EventArgs e) { ContactService.ContactServiceClient client = new ContactService.ContactServiceClient(); client.ClientCredentials.UserName.UserName = "******"; client.ClientCredentials.UserName.Password = "******"; try { ContactService.Person person = client.GetPerson(Convert.ToInt32(txtPersonId.Text)); client.Close(); if (person != null) { PersonDetails frm = new PersonDetails(person); frm.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }