v7.3.2018.0614   重构高性能资源池,减少GC压力,增加线程池,让异步任务得到平等竞争CPU的机会
大石头 编写于 2018-06-14 17:56:44
X
@using XCode.Statistics;
@{
    // 所有可用层级
    var vs = Model as StatLevels[];
    var ds = System.EnumHelper.GetDescriptions(typeof(StatLevels));
    var def = StatLevels.All;
    if (vs != null && vs.Length > 0)
    {
        ds = vs.ToDictionary(e => (Int32)e, e => e.GetDescription());
        def = vs[0];
    }

    var page = ViewBag.Page as Pager;

    var n = page["Level"].ToInt(-1);
    var level = n >= 0 ? (StatLevels)n : def;
    var formatStr = "";
    switch (level)
    {
        case StatLevels.Year: formatStr = "yyyy"; break;
        case StatLevels.Month: formatStr = "yyyy-MM"; break;
        case StatLevels.Day: formatStr = "yyyy-MM-dd"; break;
        case StatLevels.Hour: formatStr = "yyyy-MM-dd HH"; break;
        case StatLevels.Minute: formatStr = "yyyy-MM-dd HH:mm"; break;
    }
}
<div class="form-group">
    @Html.ForDropDownList("Level", ds, (Int32)level, null, true)
</div>
@if (level > StatLevels.All)
{
    <div class="form-group">
        <div class="input-group">
            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
            <input name="Time" id="Time" value="@page["Time"]" dateformat="@formatStr" class="form-control form_datetime" />
        </div>
    </div>
}