Esempio n. 1
0
 static void Main()
 {
     ConsoleApp.ClrScr();
       IdentifyApplication();
       OpenFiles();
       employeeList1.Fill(fileIn);
       employeeList1.SelectionSort(Employee.CompareIDs);        employeeList1.AppendReport(fileOut, "All Employees in List One - ID Order");
       employeeList1.SelectionSort(Employee.CompareNames);      employeeList1.AppendReport(fileOut, "All Employees in List One - Name Order");
       employeeList1.SelectionSort(Employee.CompareHireDates);  employeeList1.AppendReport(fileOut, "All Employees in List One - Hire Date Order");
       employeeList1.SelectionSort(Employee.CompareEarnings);   employeeList1.AppendReport(fileOut, "All Employees in List One - Earnings Order");
       employeeList1.SelectionSort(Employee.CompareTypes);      employeeList1.AppendReport(fileOut, "All Employees in List One - Type Order");
       foreach (Employee employee in employeeList1)
     if (employee is Supervisor)
       employeeSublist.Add(((Supervisor) employee).Clone());
       employeeSublist.AppendReport(fileOut, "Supervisor Employees in List One - Name Order");
       employeeSublist.Clear();
       foreach (Employee employee in employeeList1)
     if (employee is Hourly)
       employeeSublist.Add(employee);
       employeeSublist.AppendReport(fileOut, "Hourly Employees in List One - Name Order");
       employeeSublist.Clear();
       foreach (Employee employee in employeeList1)
     if (employee is Commission)
       employeeSublist.Add(employee);
       employeeSublist.AppendReport(fileOut, "Commission Employees in List One - Name Order");
       employeeSublist.Clear();
       foreach (Employee employee in employeeList1)
     if (employee is Piece)
       employeeSublist.Add(employee);
       employeeSublist.AppendReport(fileOut, "Piece Employees in List One - Name Order");
       employeeList1.SelectionSort(Employee.CompareNames);
       //employeeList1.SelectionSort(EmployeeList.OrderEnum.NameOrder);
       employee1 = new Supervisor(employeeList1.AssignID(), "Lawson, LeAnn", "Jun 15, 1989", 1500.00);
       index = ~employeeList1.BinarySearch(employee1, Employee.CompareNames);
       //index = ~employeeList1.BinarySearch(employee1, EmployeeList.OrderEnum.NameOrder);
       employeeList1.InsertAt(index, employee1);
       employeeList1.AppendReport(fileOut, "All Employees in List One - Name Order");
       employeeList2 = employeeList1.Clone();
       employeeList2.RemoveAt(index);
       employeeList2.AppendReport(fileOut, "All Employees in List Two - Name Order");
       CloseFiles();
 }
Esempio n. 2
0
 // Copy constructor
 public EmployeeList(EmployeeList sourceList)
 {
     this.Copy(sourceList);
 }
Esempio n. 3
0
 public void Copy(EmployeeList sourceList)
 {
     this.Clear();
       foreach (Employee employee in sourceList)
     this.Add(employee.Clone());
 }
Esempio n. 4
0
        private void IncreaseCapacity()
        {
            EmployeeList tempList;

              tempList = new EmployeeList(2 * this.capacity);
              foreach (Employee employee in this)
            tempList.Add(employee);
              this.capacity = tempList.capacity;
              this.count = tempList.count;
              this.items = tempList.items;
        }