private void RefreshList() { try { if (db != null) { db.Dispose(); } db = new DEWSRMEntities(); List <Supplier> _Suppliers = db.Suppliers.OrderBy(s => s.Code).ToList(); if (_Suppliers != null) { grdCompany.DataSource = _Suppliers; lblTotal.Text = "Total :" + _Suppliers.Count().ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void RefreshList1111() { try { { if (db != null) { db.Dispose(); } db = new DEWSRMEntities(); List <Customer> _Customers = db.Customers.OrderBy(o => o.Code).ToList(); if (_Customers != null) { grdCustomer.DataSource = _Customers; lblTotal.Text = "Total :" + _Customers.Count().ToString(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }