using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MetLife.RMDashboard.BLL;
using MetLife.RMDashboard.BLL.Entity;
using MetLife.RMDashboard.Common;
namespace MetLife.RMDashboard.Web
{
public partial class Trend : BasePageResourceManagement
{
#region page event handler
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
btnView.Attributes.Add("onclick", "javascript:CheckDataValue('" + txtDateFrom.ClientID + "','" + txtDateTo.ClientID + "')");
DateTime endDate = DateTime.Now;
DateTime startDate = endDate.AddMonths(-5);
txtDateFrom.Text = startDate.ToShortDateString();
txtDateTo.Text = endDate.ToShortDateString();
buildTrendModel(startDate.ToString(), endDate.ToString());
}
string reportType = ApplicationHelper.GetReportType(this.Page);
Session[Constants.QUERY_STRING_REPORT_TYPE] = reportType;
string calscript = "$(function(){$('#" + txtDateFrom.ClientID + "').datepicker({yearRange: '1900:2099',showOn: 'both', buttonImage: 'Image/calendar.gif', buttonImageOnly: true,showButtonPanel: true});});";
Page.ClientScript.RegisterStartupScript(this.GetType(), txtDateFrom.ClientID, calscript, true);
string calscript2 = "$(function(){$('#" + txtDateTo.ClientID + "').datepicker({yearRange: '1900:2099',showOn: 'both', buttonImage: 'Image/calendar.gif', buttonImageOnly: true,showButtonPanel: true});});";
Page.ClientScript.RegisterStartupScript(this.GetType(), txtDateTo.ClientID, calscript2, true);
}
protected void btnView_Click(object sender, EventArgs e)
{
string startDate = txtDateFrom.Text;
string endDate = txtDateTo.Text;
buildTrendModel(startDate,endDate);
}
#endregion
#region page private method
protected void buildTrendModel(string startDate, string endDate)
{
string trendSessionIdentify = startDate + endDate+Session[Constants.QUERY_STRING_REPORT_TYPE].ToString();
List<TrendModel> utlOfTrend = null;
try
{
if (Session[trendSessionIdentify] != null)
{
utlOfTrend = Session[trendSessionIdentify] as List<TrendModel>;
BindToChart(utlOfTrend);
BindToGridView(utlOfTrend);
}
else
{
if (Session[Constants.QUERY_STRING_REPORT_TYPE] != null)
{
if (Session[Constants.QUERY_STRING_REPORT_TYPE].ToString() == Constants.QUERY_STRING_REPORT_TYPE_VALUE_ACTUAL)
{
utlOfTrend = BizTrend.GetActualTrendList(startDate, endDate);
}
else
{
utlOfTrend = BizTrend.GetPredictionTrendList(startDate, endDate);
}
}
else
{
utlOfTrend = BizTrend.GetActualTrendList(startDate, endDate);
}
Session[trendSessionIdentify] = utlOfTrend;
int count = utlOfTrend.Count;
if (count == 0)
{
Chart1.Visible = false;
}
BindToChart(utlOfTrend);
BindToGridView(utlOfTrend);
}
}
catch (Exception ex)
{
ExceptionProcesser.HandleExceptionWithRedirection(ex, Constants.LOAD_DATA_ERROR_MESSAGE);
}
}
protected void BindToChart(List<TrendModel> utlOfTrend)
{
Chart1.Series["Series1"].Points.DataBind(utlOfTrend, "DateFormat", "Utlization", "Label=UtilizationPercent,ToolTip=UtilizationPercent");
//Chart1.Series["Series1"].IsValueShownAsLabel = true;
//DataBindXY(utlOfTrend, "DateString", utlOfTrend, "Utlization");
}
protected void BindToGridView(List<TrendModel> utlOfTrend)
{
gvTrendOfMetLife.AutoGenerateColumns = false;
gvTrendOfMetLife.DataSource = utlOfTrend;
gvTrendOfMetLife.DataBind();
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MetLife.RMDashboard.BLL.Entity
{
public class TrendModel
{
public DateTime? Date { get; set; }
public string DateString
{
get
{
return Date.Value.Year.ToString()+ "-" + Date.Value.Month.ToString();
}
}
public double? SumBilledHrs { get; set; }
public double? SumAvailableHrs { get; set; }
public string Utlization
{
get
{
return double.Parse((SumBilledHrs / SumAvailableHrs * 100).ToString()).ToString("F2");
}
}
public string UtilizationPercent
{
get
{
return double.Parse((SumBilledHrs / SumAvailableHrs * 100).ToString()).ToString("F2") + "%";
}
}
public string DateFormat
{
get
{
int month = Date.Value.Month;
int year = Date.Value.Year;
EnglishShortMonth englishMonth = (EnglishShortMonth)month;
return englishMonth.ToString() + "-" + year.ToString();
}
}
public enum EnglishShortMonth
{
Jan = 1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
}
}
}
分享到:
相关推荐
黑群无更新NoteStation后显示一直加载,通过安装会旧版本可解决。 最近套件中心提示NoteStation要升级(版本 2.6.0-1407)升级完成后打开NoteStation一直显示 “正在加载” ,不过数据是都在的。 二、解决办法 1、...
NoteExpress参考文献管理软件简要教程 一.什么是NoteExpress 参考文献管理软件 二.NoteExpress软件安装 三.建立自己第一个NoteExpress 数据库 四.以参考文献为中心的个人知识管理 五. 研究时心得的记录---笔记...
华为Note10手机原厂维修图纸 原理图 电路图 元件图 手机故障维修图 华为Note10 位置图 位号图 元件图.exe 华为Note10 原理图 电路图.exe 华为Note10 注释图 故障标注 主板元器件位置图.exe 华为Note10 原厂图 维修...
红米Note4驱动是小米官方提供的红米note4手机usb的驱动程序,很多用户的手机初次连接到电脑的时候总是会提供未知设备接入,其实这就是驱动没安装的缘故,这里给大家提供的这款驱动可以解决手机连电脑的时候出现的...
java notejava notejava notejava notejava notejava notejava note
红米note移动版手机USB驱动程序是一款可以有效解决红米note移动版手机无法正常连接电脑的驱动工具,本站提供了红米note移动版手机USB驱动下载地址,有需要的朋友们可以前来下载使用。 本驱动是小米最新产品红米note...
红米note11t pro面具一键root资源 持续更新 1---手机必须解锁bl后才可以使用此资源 2---资源内一键刷写root脚本。方便操作。你只需要进入fast模式链接电脑运行即可 3---资源带操作步骤说明。 4----资源在网盘。下载...
红米note9 4G通病,无缘无故出现9008模式的,不开机,一关机就不能开机,充电无反应。 重做cpu-字库-电源 无效-返修,关机后又不开机的。 不是电源虚焊,不是cpu和字库虚焊,另有它病,最终秒杀方案,完美解决无返修...
红米note7刷写第三方rec资源+步骤 实测支持安卓多版本 1----请使用本人实测的资源来刷写你的机型 2----资源可以支持不同安卓版本刷写第三方rec 3-----内含多个不同安卓版本的刷写资源和详细刷写教程步骤 4-----...
红米note9_5G版刷写第三方rec资源+步骤 实测支持安卓多版本 1----请使用本人实测的资源来刷写你的机型 2----资源可以支持不同安卓版本刷写第三方rec 3-----内含多个不同安卓版本的刷写资源和详细刷写教程步骤 4-...
红米note7pro刷写第三方rec资源+步骤 实测支持安卓多版本 1----请使用本人实测的资源来刷写你的机型 2----资源可以支持不同安卓版本刷写第三方rec 3-----内含多个不同安卓版本的刷写资源和详细刷写教程步骤 4---...
红米note4x高通版刷写第三方rec资源+步骤 实测支持安卓多版本 1----请使用本人实测的资源来刷写你的机型 2----资源可以支持不同安卓版本刷写第三方rec 3-----内含多个不同安卓版本的刷写资源和详细刷写教程步骤 4...
解锁后刷入 红米Note7|lineage18.1| 安卓11.0|顶级流畅|唯美清新|全新手势|强力推荐
NoteExpress 参考文献
红米note10pro谷歌相机
NoteExpress.rar工具,包括软件,文档,以及简要的说明信息
红米note 4g电路原理图。可用于手机维修,可放大 无水印。
魅蓝note6解BL卡刷补丁 解锁bl专用文件 第三方twrp下刷入的