public PriceViewModel GetPriceViewModel(string buildId) { Price price = context.GetPrice(buildId); List <EnergyPrice> energyPrice = new List <EnergyPrice>(); EnergyPrice ePrice = new EnergyPrice(); ePrice.Name = "电"; ePrice.Code = "01000"; ePrice.Price = price.ElectriPrice; energyPrice.Add(ePrice); EnergyPrice wPrice = new EnergyPrice(); wPrice.Name = "水"; wPrice.Code = "02000"; wPrice.Price = price.WaterPrice; energyPrice.Add(wPrice); EnergyPrice gPrice = new EnergyPrice(); gPrice.Name = "水"; gPrice.Code = "03000"; gPrice.Price = price.GasPrice; energyPrice.Add(gPrice); PriceViewModel viewModel = new PriceViewModel(); viewModel.EnergyPrice = energyPrice; return(viewModel); }
public List <EnergyPrice> GetEnergyPrice(string buildId) { Price price = context.GetPrice(buildId); List <EnergyPrice> energyPrice = new List <EnergyPrice>(); if (price != null) { EnergyPrice ePrice = new EnergyPrice(); ePrice.Name = "电"; ePrice.Code = "01000"; ePrice.Price = price.ElectriPrice; energyPrice.Add(ePrice); EnergyPrice wPrice = new EnergyPrice(); wPrice.Name = "水"; wPrice.Code = "02000"; wPrice.Price = price.WaterPrice; energyPrice.Add(wPrice); EnergyPrice gPrice = new EnergyPrice(); gPrice.Name = "气"; gPrice.Code = "03000"; gPrice.Price = price.GasPrice; energyPrice.Add(gPrice); } return(energyPrice); }
// method for topsheet calculation public virtual decimal calculateFinalFuelRate() { if (AssemblyTable != null && EquipmentTable != null) { decimal fuelRate = BigDecimalMath.ZERO; if (EquipmentTable.FuelConsumption.CompareTo(BigDecimalMath.ZERO) > 0 && EnergyPrice.CompareTo(BigDecimalMath.ZERO) > 0) { fuelRate = BigDecimalMath.mult(EnergyPrice, EquipmentTable.FuelConsumption); } else { fuelRate = EquipmentTable.FuelRate; } fuelRate = fuelRate.setScale(10, decimal.ROUND_HALF_UP); FuelRate = fuelRate; finalFuelRate = fuelRate * Factor1; finalFuelRate = finalFuelRate * Factor2; finalFuelRate = finalFuelRate * Factor3; finalFuelRate = finalFuelRate * LocalFactor; finalFuelRate = finalFuelRate * ExchangeRate; if (AssemblyTable.ActivityBased != null && AssemblyTable.ActivityBased.Equals(false)) { finalRate = finalRate * QuantityPerUnit; finalRate = BigDecimalMath.div(finalRate, UnitHours); } else { try { decimal fDiv = BigDecimalMath.mult(AssemblyTable.Productivity, UnitHours); finalFuelRate = BigDecimalMath.div(finalFuelRate, fDiv); } catch (ArithmeticException) { finalFuelRate = BigDecimalMath.ZERO; } } finalFuelRate = finalFuelRate.setScale(10, decimal.ROUND_HALF_UP); } return(finalFuelRate); }