Exemple #1
0
 /// <summary>
 /// Add new employee in end of list
 /// </summary>
 /// <param name="emp">New employee</param>
 public void AddEmployee(Employee emp)
 {
     if (numOfEmp < 100)
         StaffList[numOfEmp++] = emp;
     else
         throw new Exception("Too many employees");
 }
Exemple #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     DateTime bd = new DateTime(int.Parse(Year.Text), int.Parse(Month.Text), int.Parse(Day.Text));
     Employee newCollege = new Employee(Name.Text, int.Parse(EmpNo.Text), bd);
     staff.AddEmployee(newCollege);
     staff.StoreStaff();
     StaffList.Text += newCollege.ToString();
 }
Exemple #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     DateTime bd = new DateTime(int.Parse(Year.Text),int.Parse(MDR.Text),int.Parse(Day.Text));
     Employee newCollege =
         new Employee(textBox2.Text, int.Parse(textBox1.Text),bd);
     staff.AddEmployee(newCollege);
     staff.StoreStaff();
     textBox3.Text += newCollege.ToString();
 }
Exemple #4
0
 static void Main(string[] args)
 {
     EmployeeAdm.Staff staff = new Staff();
     Employee newEmp = new Employee("Hansen", 11, new DateTime(1990, 8, 27));
     staff.AddEmployee(newEmp);
     newEmp = new Employee("Jensen", 12, new DateTime(1988, 1, 20));
     staff.AddEmployee(newEmp);
     Console.Out.WriteLine(staff);
     Console.Read();
 }
Exemple #5
0
 static void Main(string[] args)
 {
     EmployeeAdm.Staff staff = new Staff();
     Employee newEmp = new Employee("Hansen", 11, new DateTime(1990, 8, 27));
     staff.AddEmployee(newEmp);
     newEmp = new Employee("Jensen", 12, new DateTime(1988, 1, 20));
     staff += newEmp; // + operator is overloaded
     staff.AddEmployee(newEmp);
     foreach(Employee emp in staff)
         Console.Out.WriteLine(emp);
     Console.Read();
 }