mekasu0124

Untitled

Nov 13th, 2023
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.28 KB | None | 0 0
  1. internal void NewShiftEntry(Database db)
  2. {
  3.     _db = db;
  4.  
  5.     Console.WriteLine("Creating A New Shift Entry");
  6.     Console.WriteLine(
  7.         """
  8.        Formats:
  9.  
  10.        Date => mm/dd/yyy
  11.        Start/End Time => hhmm <- Do not include the ':' between the hh and mm (see chart)
  12.        Start/End Mileage => whole numbers only
  13.        Pay => 00.00 <- do not include dollar sign ($)
  14.        """
  15.     );
  16.  
  17.     _hp.PrintMilitaryTimeChart();
  18.  
  19.     Console.Write("\nEnter Date (mm/dd/yyyy): ");
  20.     string dateInput = Console.ReadLine();
  21.     string date = _hp.CheckDateFormat(dateInput, "\nEnter Date (mm/dd/yyyy): ");
  22.  
  23.     Console.Write("\nEnter Start Time (hhmm): ");
  24.     string startTimeInput = Console.ReadLine();
  25.     string startTime = _hp.CheckTimeFormat(startTimeInput, "\nEnter Start Time (hhmm): ");
  26.  
  27.     Console.Write("\nEnter Start Mileage (whole number): ");
  28.     string startMileageInput = Console.ReadLine();
  29.     int startMileage = _hp.CheckIntegerInput(startMileageInput, "\nEnter Start Mileage (whole number): ");
  30.  
  31.     Console.Write("\nEnter End Time (hhmm): ");
  32.     string endTimeInput = Console.ReadLine();
  33.     string endTime = _hp.CheckTimeFormat(endTimeInput, "\nEnter End Time (hhmm): ");
  34.  
  35.     Console.Write("\nEnter End Mileage (whole number): ");
  36.     string endMileageInput = Console.ReadLine();
  37.     int endMileage = _hp.CheckIntegerInput(endMileageInput, "\nEnter End Mileage (whole number): ");
  38.  
  39.     Console.Write("\nEnter Pay (00.00): ");
  40.     string payInput = Console.ReadLine();
  41.     double pay = _hp.CheckDoubleInput(payInput, "\nEnter Pay (00.00): ");
  42.  
  43.     string totalTime = _hp.SumTime(startTime, endTime);
  44.     int totalMileage = _hp.SumMileage(startMileage, endMileage);
  45.  
  46.     ShiftModel newShift = new()
  47.     {
  48.         Date = date,
  49.         StartTime = startTime,
  50.         StartMileage = startMileage,
  51.         EndTime = endTime,
  52.         EndMileage = endMileage,
  53.         TotalTime = totalTime,
  54.         TotalMileage = totalMileage,
  55.         Pay = pay
  56.     };
  57.  
  58.     bool saveCheck = _db.SaveNewShiftRecord(newShift);
  59.  
  60.     if (saveCheck)
  61.     {
  62.         Console.WriteLine("New Shift Entry Successfully Saved!");
  63.         Console.WriteLine("Returning To Main Menu");
  64.         Thread.Sleep(3000);
  65.         Console.Clear();
  66.         Program.ShowMainMenu();
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment