示例#1
0
        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();
            }
        }
示例#2
0
        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);
            }
        }