using System;
using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using WebApp.Common;using Contract.Domain;using System.Collections;using System.Data;namespace HraWeb
{ public partial class Report3 : JQEntityManage<MktPriceMarketData> { protected override void Page_Load(object sender, EventArgs e) { //给基类服务接口复制,可不付 //base.svc = Psvc; if (!IsPostBack) { if (Request["_method"] == "GetReport") { string riskBookId = Request["txt_select_"].ToString(); string startTime = Request["txt_startTime_"].ToString(); string endTime = Request["txt_endTime_"].ToString(); string simulationNumber = Request["txt_simulationNumber_"].ToString(); string confidenceLevel = Request["txt_select_confidence_"].ToString(); string viewType = Request["viewtype"].ToString(); //riskBookId = "10002"; //confidenceLevel = "1404"; //txt_startTime_.Value = startTime; //txt_endTime_.Value = endTime; if (string.IsNullOrEmpty(riskBookId) || string.IsNullOrEmpty(startTime) || string.IsNullOrEmpty(endTime) || string.IsNullOrEmpty(simulationNumber) || string.IsNullOrEmpty(confidenceLevel)) { string s = "查询参数均不可为空"; Response.Write("查询参数均不可为空"); Response.End(); //throw new Exception("查询参数均不可为空!");}
//if (!string.IsNullOrEmpty(startTimeParam))
//{ // stratTime = startTimeParam; //} //Newtonsoft.Json.JsonConvert.SerializeObject(GetReportJson(stratTime, endTime)); Framework.QueryInfo info = new Framework.QueryInfo(); info.QueryObject = "RskBookBacktest";//info.AddParam("ComputeDate", computeDate);
//info.AddParam("SimulationNumber", simulationNumber); //info.AddParam("RiskBookId", riskBookId); info.CustomSQL = string.Format("select to_char(Compute_Date,'yyyy-mm-dd') as Compute_Date,Change_Inmtm_Value,Upper_Bound_Value,Lower_Bound_Value from Rsk_Book_Backtest where to_char(Compute_Date,'yyyy-mm-dd')>='" + startTime + "' and to_char(Compute_Date,'yyyy-mm-dd')<='" + endTime + "' and Risk_Book_Id=" + riskBookId + " and Simulation_Number=" + simulationNumber + " and Confidence_Level='{0}'",confidenceLevel) ;//info.CustomSQL = string.Format("select ResetDate,MiddlePriceValue,IndexPriceFactorId,IndexPriceFactorName from {0} where to_char(ResetDate,'yyyy-mm-dd')>='{1}' and to_char(ResetDate,'yyyy-mm-dd')<='{2}' and IndexPriceFactorId={3} order by ResetDate ASC", "MktPriceMarketData", startTime, endTime, factorId);
//IList list = Dao.FindByQueryInfo(info).List;
DataSet dt = Dao.ExcuteDataSet(info); //Response.End(); string outputtext = "<script language='javascript' type='text/javascript'>"; //outputtext += "var vChart = new Visifire2('SL.Visifire.Charts.xap', 800, 500);"; var dataXml = ""; if (viewType == "3d") dataXml += "<vc:Chart xmlns:vc='clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts' Width='800' Height='500' Theme='Theme1' BorderThickness='0' View3D='True' Watermark='False' ScrollingEnabled='False'>"; else if (viewType == "2d") dataXml += "<vc:Chart xmlns:vc='clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts' Width='800' Height='500' Theme='Theme1' BorderThickness='0' View3D='False' Watermark='False' ScrollingEnabled='False'>"; dataXml += "<vc:Chart.Titles><vc:Title Text='分析图2'/></vc:Chart.Titles>"; dataXml += "<vc:Chart.AxesX><vc:Axis Title='计算日期'></vc:Axis></vc:Chart.AxesX>"; dataXml += "<vc:Chart.AxesY><vc:Axis Title='频数值' /></vc:Chart.AxesY>"; dataXml += "<vc:Chart.Series>"; string column = string.Empty; string line1 = string.Empty; string line2 = string.Empty;foreach (DataRow row in dt.Tables[0].Rows) { column += "<vc:DataPoint BorderThickness='0' AxisXLabel='" + row["Compute_Date"].ToString() + "' YValue='" + row["Change_Inmtm_Value"].ToString() + "'/>"; line1 += "<vc:DataPoint BorderThickness='80' AxisXLabel='" + row["Compute_Date"].ToString() + "' YValue='" + row["Upper_Bound_Value"].ToString() + "'/>"; line2 += "<vc:DataPoint BorderThickness='0' AxisXLabel='" + row["Compute_Date"].ToString() + "' YValue='" + row["Lower_Bound_Value"].ToString() + "'/>"; } //MarkerSize 控制数据点半径大小 LineThickness 控制点与点之间直线的厚度 dataXml += "<vc:DataSeries LegendText='' RenderAs='Column' MarkerSize='0' LabelEnabled='False' LabelStyle='OutSide' Cursor='Hand' LineThickness='3'>"; dataXml += "<vc:DataSeries.DataPoints>"; dataXml += column; dataXml += "</vc:DataSeries.DataPoints>"; dataXml += "</vc:DataSeries>";dataXml += "<vc:DataSeries LegendText='' RenderAs='Line' LightingEnabled='False' FontSize='2' MarkerSize='8' LabelEnabled='False' LabelStyle='OutSide' Cursor='Hand' LineThickness='3'>";
dataXml += "<vc:DataSeries.DataPoints>"; dataXml += line1; dataXml += "</vc:DataSeries.DataPoints>"; dataXml += "</vc:DataSeries>";dataXml += "<vc:DataSeries LegendText='' RenderAs='Line' LightingEnabled='False' MarkerSize='8' LabelEnabled='False' LabelStyle='OutSide' Cursor='Hand' LineThickness='3'>";
dataXml += "<vc:DataSeries.DataPoints>"; dataXml += line2; dataXml += "</vc:DataSeries.DataPoints>"; dataXml += "</vc:DataSeries>"; dataXml += "</vc:Chart.Series>"; dataXml += "</vc:Chart>"; Response.Write(dataXml); Response.End(); //dataXml += "";//outputtext += "var dataXml = \"" + dataXml + "\";";
//outputtext += "</script>"; //json.InnerHtml = outputtext; } } base.Page_Load(sender, e); }public IList GetReportJson(string stratTime, string endTime)
{ Framework.QueryInfo info = new Framework.QueryInfo(); info.CustomSQL = string.Format("select ResetDate,MiddlePriceValue from {0} where to_char(ResetDate,'yyyy-mm-dd')>='{1}' and to_char(ResetDate,'yyyy-mm-dd')<='{2}'", typeof(MktPriceMarketData).Name, stratTime, endTime); IList list = Dao.FindByQueryInfo(info).List; return list; }/// <summary>
/// 设置查询条件或者语句 /// </summary> /// <returns></returns> protected override Framework.QueryInfo SetInfo() { info = base.SetInfo(); return info; } /// <summary> /// 初始化页面控件 /// </summary> protected override void InitPage() { BindDrop(this.txt_select_confidence_, "CONFIDENCE_LEVEL", true); base.InitPage(); Framework.QueryInfo info = new Framework.QueryInfo(); info.CustomSQL = "select distinct simulation_number from Rsk_Book_Backtest"; DataSet dt = Dao.ExcuteDataSet(info); txt_simulationNumber_.DataSource = dt.Tables[0]; txt_simulationNumber_.DataTextField = "simulation_number"; txt_simulationNumber_.DataValueField = "simulation_number"; txt_simulationNumber_.DataBind();info = new Framework.QueryInfo();
info.CustomSQL = "select Risk_Book_Id,Risk_Book_Name from Rsk_Book"; dt = Dao.ExcuteDataSet(info); this.txt_select_.DataSource = dt.Tables[0]; this.txt_select_.DataTextField = "Risk_Book_Name"; this.txt_select_.DataValueField = "Risk_Book_Id"; this.txt_select_.DataBind(); //BindDrop("RiskBookId", "RiskBookName", "RiskBook", txt_select_, ""); } //private Contract.IService.IMktPriceMarketDataService psvc; / <summary> / 初始化 / </summary> //Contract.IService.IMktPriceMarketDataService Psvc //{ // get // { // if (psvc == null) // { // psvc = ctx.GetObject("MktPriceMarketDataService") as Contract.IService.IMktPriceMarketDataService; // } // return psvc;// }
//} }}