using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Framework;
using WebApp.Common;
using Contract.Domain;
using System.Collections;

namespace HraWeb
{
public partial class Report : JQEntityManage<MktPriceMarketData>
{
protected override void Page_Load(object sender, EventArgs e)
{
bool hasData = true;
string factorId = "";
string startTime, endTime;
startTime = endTime = string.Empty;
IList list = null;
if (Request["_method"] == "GetReport")
{

startTime = Request["txt_stratTime_"].ToString();
endTime = Request["txt_endTime_"].ToString();
factorId = Request["txt_select_"].ToString();
//if (string.IsNullOrEmpty(startTime) || string.IsNullOrEmpty(endTime))
//{
// hasData = false;
// string s =
// "<script>$.messager.alert('消息提示框','查询起止时间均不可为空')</script>";
// ClientScript.RegisterStartupScript(GetType(), "message", s);

//}
//if (string.IsNullOrEmpty(factorId))
//{
// hasData = false;
// string s =
// "<script>$.messager.alert('消息提示框','必须选择查询的价格因子')</script>";
// ClientScript.RegisterStartupScript(GetType(), "message", s);

//}

if (hasData != false)
{
Framework.QueryInfo info = new Framework.QueryInfo();

//info.QueryObject = "MktPriceMarketData";
//if(!string.IsNullOrEmpty(startTime))
//info.AddParam("CloseDate", DateTime.Parse(startTime), " and CloseDate>=:CloseDate");
//if(!string.IsNullOrEmpty(endTime))
//info.AddParam("CloseDate1", DateTime.Parse(endTime), " and CloseDate<=:CloseDate1");
//if (!string.IsNullOrEmpty(factorId))
//{
// info.AddParam("IndexPriceFactorId", factorId);
//}

//info.OrderBy.Add("CloseDate ASC");
//list = Dao.FindByQueryInfo(info).List;
//if (list == null || list.Count <= 0)
//{
// string s = "没有查找到相关数据";

// Response.Write(s);
// Response.End();
// //hasData = false;
// //string s =
// // "<script>$.messager.alert('消息提示框','当前报表查询不到数据请尝试换个时间段')</script>";
// //ClientScript.RegisterStartupScript(GetType(), "message", s);

//}
string outputtext = "<script language='javascript' type='text/javascript'>";
//outputtext += "var vChart = new Visifire2('SL.Visifire.Charts.xap', 800, 500);";
var dataXml = "";
dataXml += "<vc:Chart xmlns:vc='clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts' Width='800' Height='500' Theme='Theme1' BorderThickness='0.5' View3D='False' Watermark='False' ScrollingEnabled='False'>";
dataXml += "<vc:Chart.Titles><vc:Title Text='分析图1'/></vc:Chart.Titles>"; //图形名称
dataXml += "<vc:Chart.AxesX><vc:Axis Title='交易日期'></vc:Axis></vc:Chart.AxesX>";//x轴名称
dataXml += "<vc:Chart.AxesY><vc:Axis Title='中间价' /></vc:Chart.AxesY>";//y轴名称
dataXml += "<vc:Chart.Series>";
//Width='800' Height='500'
dataXml += "<vc:DataSeries LegendText='' RenderAs='Line' LabelEnabled='true' LabelStyle='OutSide' Cursor='Hand' LineThickness='3' LightingEnabled='False' >";//LineThickness:线的粗细
dataXml += "<vc:DataSeries.DataPoints>";
//to_date('2015/5/21','yyyy/mm/dd')
info=new QueryInfo();
info.CustomSQL = @"select SimulationNumber, VarResultValue from RskBookResult
where ComputeDate =:ComputeDate
and RiskBookId = 4518
and ConfidenceLevel = '95%'
order by SimulationNumber";
info.Parameters.Add("ComputeDate",new DateTime(2015,5,21));
IList lines = Dao.FindList(info);

Dictionary<decimal,decimal> lineDictionary=new Dictionary<decimal, decimal>();
foreach (var line in lines)
{
Object[] objs = line as Object[];
lineDictionary.Add(Decimal.Parse(objs[0].ToString()),Decimal.Parse(objs[1].ToString()));
}
foreach (var key in lineDictionary.Keys)
{
dataXml += string.Format("<vc:DataPoint AxisXLabel='{0}' YValue='{1}'/>",key, lineDictionary[key]);//循环每个点 触发鼠标停留在某个点上时显示x轴和y轴的值
}
//for (int i = 0; i < list.Count; i++)
//{
// MktPriceMarketData entity = list[i] as MktPriceMarketData;
// dataXml += "<vc:DataPoint AxisXLabel='" + ((DateTime)entity.CloseDate).ToString("yyyy-MM-dd") + "' YValue='" + entity.MiddlePriceValue.ToString() + "'/>";//循环每个点 触发鼠标停留在某个点上时显示x轴和y轴的值

//}
dataXml += "</vc:DataSeries.DataPoints>";
dataXml += "</vc:DataSeries>";

dataXml += "</vc:Chart.Series>";
dataXml += "</vc:Chart>";
Response.Write(dataXml);
Response.End();

//outputtext += "var dataXml = \"" + dataXml + "\";";
//outputtext += "</script>";
//json.InnerHtml = outputtext;

}
if (!string.IsNullOrEmpty(startTime))
{
txt_stratTime_.Value = startTime;
// txt_endTime_.Value = endTime;
// txt_select_.SelectedValue = factorId;
}
if (!string.IsNullOrEmpty(endTime))
{

txt_endTime_.Value = endTime;
// txt_select_.SelectedValue = factorId;
}
if (!string.IsNullOrEmpty(factorId))
{

txt_select_.SelectedValue = factorId;
}
}

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()
{
this.txt_stratTime_.Value = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
this.txt_endTime_.Value = DateTime.Now.ToString("yyyy-MM-dd");
base.InitPage();
BindDrop("Id", "IndexPriceFactorName", "MktIndexPriceFactor", txt_select_, "");
// BindDrop(drp_Unit, "SPSW", true);
}
//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;

// }
//}
}
}

最新文章

  1. onselectstart与onselect
  2. *HDU2852 树状数组(求第K小的数)
  3. 第六百零七八天 how can I 坚持
  4. hexo框架-next主题-github搭建个人博客
  5. iface eth0 inet dhcp
  6. Keil C51总线外设操作问题的深入分析
  7. 易宝网上支付平台的PHP接口代码
  8. 填坑实录 Android Studio 利用 ADB WIFI 插件实现真机无线调试
  9. [Swift]LeetCode885. 螺旋矩阵 III | Spiral Matrix III
  10. my题库
  11. 【译】Six Open Source Dashboards to Organize Your Data
  12. python设计模式第二十五天【访问者模式】
  13. 初识Python - Python的历史(转)
  14. VHDL 乐曲演奏电路设计
  15. ABAP 字符串函数
  16. 问题; No label views point to this text field with an android:labelFor=&quot;@+id/@+id/editTextNumber1&quot; attribute
  17. 【校招面试 之 C/C++】第32题 C++ 11新特性(三)之for关键字
  18. [Asp.net mvc]Html.ValidationSummary(bool)
  19. canvas移动端常用技巧图片loading
  20. unity, water cube

热门文章

  1. ambassador 学习八 流量拷贝说明
  2. vs2005 sp1 补丁的安装问题
  3. python把指定目录下的递归所有目录和文件名转换成小写或大写
  4. ffmpeg 从内存中读取数据(或将数据输出到内存)(转)
  5. Form中的keypress事件不能用
  6. nginx 点播mp4方法
  7. 使用JS获取当前地理位置方法汇总(如用谷歌接口,会出再以上报错,必须申请密钥并设置接受服务器IP!!!)
  8. 手工编写servlet
  9. ggplot2 texts : Add text annotations to a graph in R software
  10. uva-11044-水题