Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal void NewShiftEntry(Database db)
- {
- _db = db;
- Console.WriteLine("Creating A New Shift Entry");
- Console.WriteLine(
- """
- Formats:
- Date => mm/dd/yyy
- Start/End Time => hhmm <- Do not include the ':' between the hh and mm (see chart)
- Start/End Mileage => whole numbers only
- Pay => 00.00 <- do not include dollar sign ($)
- """
- );
- _hp.PrintMilitaryTimeChart();
- Console.Write("\nEnter Date (mm/dd/yyyy): ");
- string dateInput = Console.ReadLine();
- string date = _hp.CheckDateFormat(dateInput, "\nEnter Date (mm/dd/yyyy): ");
- Console.Write("\nEnter Start Time (hhmm): ");
- string startTimeInput = Console.ReadLine();
- string startTime = _hp.CheckTimeFormat(startTimeInput, "\nEnter Start Time (hhmm): ");
- Console.Write("\nEnter Start Mileage (whole number): ");
- string startMileageInput = Console.ReadLine();
- int startMileage = _hp.CheckIntegerInput(startMileageInput, "\nEnter Start Mileage (whole number): ");
- Console.Write("\nEnter End Time (hhmm): ");
- string endTimeInput = Console.ReadLine();
- string endTime = _hp.CheckTimeFormat(endTimeInput, "\nEnter End Time (hhmm): ");
- Console.Write("\nEnter End Mileage (whole number): ");
- string endMileageInput = Console.ReadLine();
- int endMileage = _hp.CheckIntegerInput(endMileageInput, "\nEnter End Mileage (whole number): ");
- Console.Write("\nEnter Pay (00.00): ");
- string payInput = Console.ReadLine();
- double pay = _hp.CheckDoubleInput(payInput, "\nEnter Pay (00.00): ");
- string totalTime = _hp.SumTime(startTime, endTime);
- int totalMileage = _hp.SumMileage(startMileage, endMileage);
- ShiftModel newShift = new()
- {
- Date = date,
- StartTime = startTime,
- StartMileage = startMileage,
- EndTime = endTime,
- EndMileage = endMileage,
- TotalTime = totalTime,
- TotalMileage = totalMileage,
- Pay = pay
- };
- bool saveCheck = _db.SaveNewShiftRecord(newShift);
- if (saveCheck)
- {
- Console.WriteLine("New Shift Entry Successfully Saved!");
- Console.WriteLine("Returning To Main Menu");
- Thread.Sleep(3000);
- Console.Clear();
- Program.ShowMainMenu();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment