64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using System;
|
|
using su.divan2000.SalaryApp.Models;
|
|
using su.divan2000.SalaryApp.Services;
|
|
using su.divan2000.SalaryApp.Utils;
|
|
|
|
namespace su.divan2000.SalaryApp
|
|
{
|
|
internal class Program
|
|
{
|
|
static SalaryHistory history = new SalaryHistory();
|
|
|
|
static void Main()
|
|
{
|
|
var menu = new Menu("=== Калькулятор зарплаты охранника ===");
|
|
|
|
menu.AddOption("Новый расчёт", NewCalculation);
|
|
menu.AddOption("История расчётов", ShowHistory);
|
|
menu.AddOption("Сравнить расчёты", CompareCalculations);
|
|
menu.AddOption("Статистика", ShowStatistics);
|
|
menu.AddOption("Выход", () => Environment.Exit(0));
|
|
|
|
while (true)
|
|
{
|
|
menu.RunMenu();
|
|
}
|
|
}
|
|
|
|
static void NewCalculation()
|
|
{
|
|
SalaryData data = InputHelper.CreateSalaryData();
|
|
|
|
data.CalculateSalary();
|
|
history.Add(data);
|
|
|
|
OutputHelper.PrintSalaryData(data);
|
|
OutputHelper.WaitForKey();
|
|
}
|
|
|
|
static void ShowHistory()
|
|
{
|
|
history.ShowHistory();
|
|
OutputHelper.WaitForKey();
|
|
}
|
|
|
|
static void CompareCalculations()
|
|
{
|
|
history.ShowHistory();
|
|
|
|
Console.Write('\n');
|
|
|
|
int first = InputHelper.AskInt("Введите номер первого расчёта: ");
|
|
int second = InputHelper.AskInt("Введите номер второго расчёта: ");
|
|
|
|
history.Compare(first, second);
|
|
OutputHelper.WaitForKey();
|
|
}
|
|
|
|
static void ShowStatistics()
|
|
{
|
|
history.ShowStatistics();
|
|
OutputHelper.WaitForKey();
|
|
}
|
|
}
|
|
} |