Esempio n. 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);
        }
Esempio n. 2
0
 public void AddCustomer(Customer customer)
 {
     Clients.All.RefreshData(customer);
 }
Esempio n. 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);
        }
Esempio n. 4
0
 private void RefreshData(Customer customer)
 {
     lvwCustomer.Invoke(new MethodInvoker(() => FillToListView(customer)));
 }