/// <summary> /// Создание нового объекта MeterReading. /// </summary> /// <param name="id">Исходное значение свойства ID.</param> /// <param name="currentHeatMeterReader">Исходное значение свойства CurrentHeatMeterReader.</param> /// <param name="currentWaterHeatReader">Исходное значение свойства CurrentWaterHeatReader.</param> public static MeterReading CreateMeterReading(global::System.Int32 id, global::System.Double currentHeatMeterReader, global::System.Double currentWaterHeatReader) { MeterReading meterReading = new MeterReading(); meterReading.ID = id; meterReading.CurrentHeatMeterReader = currentHeatMeterReader; meterReading.CurrentWaterHeatReader = currentWaterHeatReader; return meterReading; }
/// <summary> /// Устаревший метод для добавления новых объектов в набор EntitySet MeterReadings. Взамен можно использовать метод .Add связанного свойства ObjectSet<T>. /// </summary> public void AddToMeterReadings(MeterReading meterReading) { base.AddObject("MeterReadings", meterReading); }
private void Calculate() { if (SelectedInterval == null || SelectedBuilding == null) return; var heatMeterReadings = Double.Parse(HeatMeterReadings); var waterMeterReadings = Double.Parse(WaterMeterReadings); var meterReadings = new MeterReading { CurrentHeatMeterReader = heatMeterReadings, CurrentWaterHeatReader = waterMeterReadings, DateTimeInterval = SelectedInterval, Building = SelectedBuilding }; clearingRepository.InsertMeterReading(meterReadings); var clearing = new Clearing { Requirements = Double.Parse(Requirements), CalculationByBughaltery = Double.Parse(WaterBuxgalter), DateTimeInterval = SelectedInterval, Building = SelectedBuilding, CalculationHot = totalCalculator.TotalHeatConsumption(Double.Parse(Requirements), Double.Parse(WaterBuxgalter)) }; /* var totalHeatConsumption = clearingRepository.GetContractConsumptions().Where(item => item.BuildingsId == SelectedBuilding.Id && item.DateTimeImtervals.Id == SelectedInterval.Id).Select(x => x.TotalHeatConsumption).Single(); clearing.CalculationHot = totalCalculator.TotalHeatConsumption(totalHeatConsumption, Double.Parse(WaterBuxgalter)); */ clearingRepository.InsertClearing(clearing); clearingRepository.Save(); Clearings.Add(clearing); }