コード例 #1
0
ファイル: Schedule.cs プロジェクト: grayingram/Scheduler
 public void UpdateVacations()
 {
     do
     {
         Employee employee = GetEmployee();
         //int employeeid = Reader.GetEmployeeId(employee.FirstName, employee.LastName);
         if (Lawyer.GetYesNo("Do you want to add vacations?"))
         {
             int days = Lawyer.GetInt("How many days do you want to add?");
             if (Lawyer.GetYesNo("Are you sure you want to set vacations from " + Reader.GetNumberOfVacations(employee.ID) + " to be " + (Reader.GetNumberOfVacations(employee.ID) + days) + "?"))
             {
                 Updater.AddVacationsByEmployeeID(employee.ID, days);
                 Console.Clear();
             }
         }
         else if (Lawyer.GetYesNo("Do you want to take off vacations?"))
         {
             int days = Lawyer.GetInt("How may days  do you want to subtract?");
             if (Lawyer.GetYesNo("Are you sure you want to set vacations from " + Reader.GetNumberOfVacations(employee.ID) + " to be " + (Reader.GetNumberOfVacations(employee.ID) - days) + "?"))
             {
                 Updater.RemoveVacationsByEmployeeID(employee.ID, days);
                 Console.Clear();
             }
         }
     } while (Lawyer.GetYesNo("Do you want to update another employees number of vacation days?"));
 }
コード例 #2
0
ファイル: Schedule.cs プロジェクト: grayingram/Scheduler
 public void AddEmployee()
 {
     do
     {
         if (Lawyer.GetYesNo("Do you want to see all existing employees?"))
         {
             ReadEmployees();
         }
         string firstname = Lawyer.GetResponse("What is the first name of this employee?");
         string lastname  = Lawyer.GetResponse("What is the last name of this employee?");
         while (Reader.DoesEmployeeExist(firstname, lastname))
         {
             Console.WriteLine("Sorry but that employee already exists, try again");
             firstname = Lawyer.GetResponse("What is the first name of this employee?");
             lastname  = Lawyer.GetResponse("What is the last name of this employee?");
         }
         int vacations = Lawyer.GetInt("How many vacation days does this employee have for the year?");
         if (Lawyer.GetYesNo("Are you sure you want to add " + firstname + " " + lastname + " to the employees"))
         {
             Creator.AddEmployee(firstname, lastname, vacations);
             NumberOfEmployees++;
             Console.Clear();
         }
         Console.Clear();
     } while (Lawyer.GetYesNo("Do you want to add another employee?"));
 }