我的输出是峰值时间=早上7点到晚上9点非峰值时间=晚上9点到早上7点,我得到的每一种类型的图表。就像固定费率关税一样,我没有24小时但是峰值时间=早上7点到晚上9点非峰值时间=晚上9点到早上7点。我不明白为什么。
@{
web.....
open database.....
var timing="";
foreach( var PriceSlot in OtherPlanDetail){
var OtherPlanName=PriceSlot.PlanName;
if(OtherPlanName=="FlatRateTariff")
{
timing="24 Hours";
}
else if(OtherPlanName=="TOU_Scheme_1")
{
timing="Peak Timing = 7am to 9pm Non-Peak Timing = 9pm to 7am";
}
else if(OtherPlanName=="TOU_Scheme_2")
{
timing="Peak Timing = 7am to 9pm Non-Peak Timing = 9pm to 7am";
}
else if(OtherPlanName=="TOU_Scheme_3")
{
timing="Peak Timing = 7am to 9pm Non-Peak Timing = 9pm to 7am";
}
else if(OtherPlanName=="TOU_Scheme_4")
{
timing="Peak Timing = 7am to 9pm Non-Peak Timing = 9pm to 7am";
}
else
{
timing="invalid";
}
}
<form>
<div id="accordion">
@{
foreach( var PriceSlot in OtherPlanDetail){
var CostOtherPlan=Math.Round(Convert.ToDecimal((db.QueryValue(PlanCostQueryString,WebSecurity.CurrentUserId,PriceSlot.Slot1,PriceSlot.Slot2,PriceSlot.Slot3,PriceSlot.Slot4,PriceSlot.Slot5,PriceSlot.Slot6))),2);
var OtherPlanName=PriceSlot.PlanName;
<text>
<h3><a href="#">Cost S$@CostOtherPlan with Plan : @OtherPlanName </a></h3>
<div>
<p>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(Draw);
function Draw() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Year');
data.addColumn('number', 'SGD');
data.addRows([
['0AM', @PriceSlot.Slot1],
['1AM', @PriceSlot.Slot2],
['2AM', @PriceSlot.Slot3],
['3AM', @PriceSlot.Slot4],
['4AM', @PriceSlot.Slot5],
['5AM', @PriceSlot.Slot6],
['6AM', @PriceSlot.Slot7],
['7AM', @PriceSlot.Slot8],
['8AM', @PriceSlot.Slot9],
['9AM', @PriceSlot.Slot10],
['10AM', @PriceSlot.Slot11],
['11AM', @PriceSlot.Slot12],
['12AM', @PriceSlot.Slot13],
['1PM', @PriceSlot.Slot14],
['2PM', @PriceSlot.Slot15],
['3PM', @PriceSlot.Slot16],
['4PM', @PriceSlot.Slot17],
['5PM', @PriceSlot.Slot18],
['6PM', @PriceSlot.Slot19],
['7PM', @PriceSlot.Slot20],
['8PM', @PriceSlot.Slot21],
['9PM', @PriceSlot.Slot22],
['10PM', @PriceSlot.Slot23],
['11PM', @PriceSlot.Slot24]
]);
var options = {
width: 750, height: 240,
title: '@PriceSlot.PlanName',
hAxis: {slatedText:true, textPosition: 'none'}
//hAxis: {title: 'TIME OF THE DAY', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('@PriceSlot.PlanId'));
chart.draw(data, options);
}
</script>
<div id="@PriceSlot.PlanId"style="width: 200; height: 240;"></div>
@timing;
</p>
</div>
</text>
}
}
</div>
</form>
答案 0 :(得分:0)
在if的入口处设置一个断点,并检查你进入其他计划名称的内容。如果&#34; OtherPlanName&#34;的值不同于&#34; FlatRateTarrif&#34;那么它会导致如此。一旦检查了你进入的价值&#34; OtherPlanName&#34;变量