Esempio n. 1
0
        // Search by Department
        public DataCollection search(EnumDepartment dept)
        {
            DataCollection templist = new DataCollection();

            foreach (Employee curr in empList)
            {
                if (curr.getDepartment() == dept)
                {
                    templist.add(curr);
                }
            }

            if (templist.getSize() == 0)
            {
                return(null);
            }
            else
            {
                return(templist);
            }
        }
Esempio n. 2
0
        // Search by Name
        public DataCollection search(String name, int type)
        {
            DataCollection templist = new DataCollection();

            switch (type)
            {
            case 1:
                foreach (Employee curr in empList)
                {
                    if (curr.getFname() == name)
                    {
                        templist.add(curr);
                    }
                }

                break;

            case 2:
                foreach (Employee curr in empList)
                {
                    if (curr.getLname() == name)
                    {
                        templist.add(curr);
                    }
                }

                break;
            }
            if (templist.getSize() == 0)
            {
                return(null);
            }
            else
            {
                return(templist);
            }
        }