Exemple #1
0
        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);
        }
Exemple #2
0
        public int Add(Agent aType)
        {
            int returnValue = -1;

            returnValue = new AgentDataHelper().Insert(aType);

            return(returnValue);
        }
Exemple #3
0
 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.");
     }
 }
Exemple #4
0
        public Agent Show(int searchByID)
        {
            var mySingleItem = new AgentDataHelper().SelectByID(searchByID);

            return(mySingleItem);
        }