double? EenCalculate() { var tariffs = new TariffsManager().GetCurrentTariff(new ServiceManager().GetServiceId("ElectricPower")); int dif; if (!int.TryParse(DifferenceEEn.Text, out dif)) return null; if (dif <= 100) { return dif * tariffs.Price; } return (dif - 100) * tariffs.Overexpenditure + 100 * tariffs.Price; }
double? HovCalculate() { int difG, difH; var tariff = new TariffsManager().GetCurrentTariff(new ServiceManager().GetServiceId("ColdWater")); if (!int.TryParse(DifferenceGov.Text, out difG) || !int.TryParse(DifferenceHov.Text, out difH)) return null; return (difG + difH) * tariff.Price; }
double? KanCalculate() { int difG, difK; var tariff = new TariffsManager().GetCurrentTariff(new ServiceManager().GetServiceId("WateDrain")); if (!int.TryParse(DifferenceGov.Text, out difG) || !int.TryParse(DifferenceKan.Text, out difK)) return null; return (difG + difK) * tariff.Price; }
double? GovCalculate() { int dif; var tariff = new TariffsManager().GetCurrentTariff(new ServiceManager().GetServiceId("HotWater")); if (!int.TryParse(DifferenceGov.Text, out dif)) return null; return dif * tariff.Price; }