private void RefreshProgress() { try { _putAwayRack = RackSelection.Text; _putAwayShelf = ShelfSelection.Text; if (string.IsNullOrEmpty(_putAwayShelf)) { ShelfSelection.Focus(); return; } _putAwayPosition = PositionSelection.Text; if (string.IsNullOrEmpty(_putAwayPosition)) { PositionSelection.Focus(); return; } using (var ppTA = new PhysicalProgressTableAdapter()) { uxGridProgress.DataSource = ppTA.GetCycleCountProgressByAddress(Plant, _putAwayRack, _putAwayShelf, _putAwayPosition); } using (var ppsTA = new PhysicalProgressSummaryTableAdapter()) { var ppsDT = ppsTA.GetCycleCountProgressSummary(Plant, _putAwayRack, _putAwayShelf, _putAwayPosition); switch (ppsDT.Rows.Count) { case 1: uxLabelProgress.Text = ppsDT[0].FoundCount + " Found, " + ppsDT[0].MissingCount + " Missing, " + ppsDT[0].TotalCount + " Total"; break; default: throw new Exception("Unable to retrieve summary."); } } } catch (SqlException ex) { foreach (SqlError sqlErr in ex.Errors) { MessageBox.Show(sqlErr.Message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }