private void RefreshItems(object sender, EventArgs e) { var biz = new DeliveryBiz(); dataGridView.DataSource = biz.LoadItems(); dataGridView.Refresh(); }
private void WorkAsyncCompleted(object sender, RunWorkerCompletedEventArgs e) { var biz = new DeliveryBiz(); dataGridView.DataSource = null; dataGridView.DataSource = biz.LoadItems(); dataGridView.Refresh(); }
public DeliveryView(User user) { InitializeComponent(); selectedRow = -1; dataGridView.AutoGenerateColumns = false; var biz = new DeliveryBiz(); dataGridView.DataSource = biz.LoadItems(); dataGridView.Refresh(); currentUser = user; flagSendMail = false; flagSendSms = false; backgroundWorker.DoWork += new DoWorkEventHandler(WorkAsync); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkAsyncCompleted); }
public DeliveryView(User user, bool isSendMail = false, bool isSendSms = false, int itemId = 0) { InitializeComponent(); selectedRow = -1; dataGridView.AutoGenerateColumns = false; var biz = new DeliveryBiz(); var list = biz.LoadItems(); dataGridView.DataSource = list; dataGridView.Refresh(); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { if (list[i].Id == itemId) { selectedRow = i; break; } } } currentUser = user; backgroundWorker.DoWork += new DoWorkEventHandler(WorkAsync); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkAsyncCompleted); this.flagSendMail = isSendMail; this.flagSendSms = isSendSms; if (isSendMail || isSendSms) { backgroundWorker.RunWorkerAsync(itemId); } }
public DeliveryView(User user, bool isSendMail = false, bool isSendSms = false, int itemId = 0) { InitializeComponent(); selectedRow = -1; dataGridView.AutoGenerateColumns = false; var biz = new DeliveryBiz(); var list = biz.LoadItems(); dataGridView.DataSource = list; dataGridView.Refresh(); if(list != null && list.Count > 0) { for(int i=0;i<list.Count;i++) { if (list[i].Id == itemId) { selectedRow = i; break; } } } currentUser = user; backgroundWorker.DoWork += new DoWorkEventHandler(WorkAsync); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkAsyncCompleted); this.flagSendMail = isSendMail; this.flagSendSms = isSendSms; if (isSendMail || isSendSms) { backgroundWorker.RunWorkerAsync(itemId); } }