public static void RefreshTerminals() { //Load enterprise terminals try { Terminals.Clear(); IDictionary oDict = (IDictionary)ConfigurationManager.GetSection(KEY_TERMINALS + "s"); int terminals = Convert.ToInt32(oDict["Count"]); for (int i = 1; i <= terminals; i++) { oDict = (IDictionary)ConfigurationManager.GetSection(KEY_TERMINALS + i.ToString()); TerminalDS.DBATerminalTableRow row = new TerminalDS().DBATerminalTable.NewDBATerminalTableRow(); row.TerminalID = int.Parse(oDict["TerminalID"].ToString()); row.Description = oDict["Description"].ToString(); row.SQLConnection = oDict["SQLConnection"].ToString(); string ttype = oDict["TerminalType"].ToString(); EnterpriseTerminal terminal = null; switch (ttype) { case "Tsort": terminal = new TsortTerminal(row); break; case "Local": terminal = new LocalTerminal(row); break; } Terminals.Add(terminal.TerminalID, terminal); } } catch (Exception ex) { throw new ApplicationException("Unexpected error while refreshing enterprise terminals.", ex); } finally { if (TerminalsChanged != null) { TerminalsChanged(null, EventArgs.Empty); } } }
public void RefreshItems(DateTime start, DateTime end) { //Refresh sorted\scanned items try { this.mItemDS.Clear(); if (this.mTerminal.GetType().Name == "TsortTerminal") { TsortTerminal tterminal = (TsortTerminal)this.mTerminal; this.mItemDS.Merge(tterminal.GetSortedItems(this.mNumber, start, end)); } if (this.mTerminal.GetType().Name == "LocalTerminal") { LocalTerminal lterminal = (LocalTerminal)this.mTerminal; this.mItemDS.Merge(lterminal.GetSortedItems(this.mNumber, start, end)); this.mItemDS.Merge(lterminal.GetScannedItems(this.mNumber, start, end)); } } catch (Exception ex) { throw ex; } finally { if (this.ItemsRefreshed != null) { this.ItemsRefreshed(this, EventArgs.Empty); } } }