private void OnAutoRefresh(object sender, DoWorkEventArgs e) { //Event handler for background worker thread DoWork event; runs on worker thread try { ShipScheduleDataset ds = new ShipScheduleDataset(); ds.Merge(ShipScheduleGateway.GetShipSchedule(this.mSortCenterID, this.mScheduleDate)); ds.Merge(ShipScheduleGateway.GetShipScheduleTemplates(this.mSortCenterID, this.mScheduleDate)); e.Result = ds; } catch { } }
public void Refresh() { //Update a collection (dataset) of all ship schedule trips for the terminal and schedule date try { //Clear and update trips for this schedule this.mTrips.Clear(); this.mTemplates.Clear(); this.mTrips.Merge(ShipScheduleGateway.GetShipSchedule(this.mSortCenterID, this.mScheduleDate)); this.mTemplates.Merge(ShipScheduleGateway.GetShipScheduleTemplates(this.mSortCenterID, this.mScheduleDate)); foreach (ShipScheduleDataset.TemplateViewTableRow row in this.mTemplates.TemplateViewTable.Rows) { row.Selected = (row.IsMandatory == 1); } this.mTemplates.AcceptChanges(); } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } finally { if (this.Changed != null) { this.Changed(this, EventArgs.Empty); } } }