Example #1
0
        // method untuk menampilkan data customer ke listview
        private void FillToListView(Customer customer)
        {
            int noUrut = lvwCustomer.Items.Count + 1;

            ListViewItem item = new ListViewItem(noUrut.ToString());
            item.SubItems.Add(customer.CustomerId);
            item.SubItems.Add(customer.CompanyName);
            item.SubItems.Add(customer.ContactName);

            lvwCustomer.Items.Add(item);
        }
Example #2
0
 public void AddCustomer(Customer customer)
 {
     Clients.All.RefreshData(customer);
 }
Example #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var customer = new Customer
            {
                CustomerId = txtCustomerId.Text,
                CompanyName = txtCompanyName.Text,
                ContactName = txtContactName.Text
            };

            // panggil method server
            hubProxy.Invoke("AddCustomer", customer);
        }
Example #4
0
 private void RefreshData(Customer customer)
 {
     lvwCustomer.Invoke(new MethodInvoker(() => FillToListView(customer)));
 }