public BindingSource GetList(AgentType anAgentType) { AgentDataHelper DH = new AgentDataHelper(); BindingSource BS = new BindingSource(); Hashtable HT = new Hashtable(); List <Agent> myList = DH.SelectAll(); if (myList != null) { foreach (var item in myList) { if (item.State == EntityState.Enabled) { if (item.AgentType == anAgentType) { HT.Add(item.ID, item.Name); } } } } HT.Add(-1, "Select " + anAgentType.ToString()); BS.DataSource = HT; return(BS); }
public int Add(Agent aType) { int returnValue = -1; returnValue = new AgentDataHelper().Insert(aType); return(returnValue); }
public BindingList <Agent> Show(Agent aType) { try { var myList = new AgentDataHelper().SelectAll(); var bindingList = new BindingList <Agent>(myList); return(bindingList); } catch (ArgumentNullException) { throw new DataExistence("No Data Found! No Agents are yet added."); } }
public Agent Show(int searchByID) { var mySingleItem = new AgentDataHelper().SelectByID(searchByID); return(mySingleItem); }