using System; using System.Collections.Generic; using System.Text; using CB.Common; using CB.Data; using CB.Entity; using CB.Interface; using CB.Interface.Infrastructure; namespace CB.TrendChart.LotteryTrendChart { /// /// 体彩P3、P5走势图生成工具 /// public class TCP3Trend { public static int Cid = 2;//Cid用于设置样式值 /// /// 生成走势图,生成当前term数据及以后数据 /// by JNswins 2015-06-10 /// /// 走势图ID /// 走势图类型 /// 需要生成走势图期数 /// 彩种开奖数据额外查询条件 /// public static Tuple CreateTrendChart(int chartId, TrendChartType chartType, long term, LotterySearchField fields = null) { //获取走势图项及配置数据 var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); if (null == trendChartItem || 0 >= trendChartItem.Count) return new Tuple(false, string.Format("未找到【ChartId={0}】走势图的项配置数据", chartId)); int count = trendChartItem.Count; IList> chartItem = new List>(count); IList cssConfig = new List(count); foreach (var item in trendChartItem) { //实例化项类型 chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); //获取项CSS配置信息 cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); } //各项初始化 for (int i = 0; i < count; i++) { trendChartItem[i].Cid = Cid; chartItem[i].Init(cssConfig[i], trendChartItem[i]); } //大于等于term开奖数据 IList ListToEnd = TCP3Service.GetListToEnd(term, fields); if (null == ListToEnd || 0 >= ListToEnd.Count) return new Tuple(false, "未找到有效开奖数据"); int j = 0; TrendChartData entity = null; var ResultEntity = new TrendChartData { ChartId = chartId, Term = term, ChartType = chartType, LocalMiss = new string[count], LastMiss = new string[count], AllMaxMiss = new string[count], AllAvgMiss = new string[count], AllTimes = new string[count] }; foreach (var currentData in ListToEnd) { //根据参数term期数获取近两期开奖信息TOP 2 [Term]<=term ORDER BY [Term] DESC IList list = TCP3Service.ToListForTrend(currentData.Term, fields); TCP3Info info = null,lastinfo=null; info = list[0]; //modified by zizi,at 2016-8-29,3d和排列三试机号10和22 //TODO:下面代码可以重构到Model基类中,以后再改 if (chartId == 22) { if (info.OpenCode1 == -1 || info.OpenCode2 == -1 || info.OpenCode3 == -1) { var sjh = info.ShiJiHao; if (!string.IsNullOrEmpty(sjh)) { var opArr = sjh.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); //info.OpenCode1 = int.Parse(opArr[0]); //info.OpenCode2 = int.Parse(opArr[1]); //info.OpenCode3 = int.Parse(opArr[2]); if (opArr.Length >= 3) { info.OpenCode[0] = int.Parse(opArr[0]); info.OpenCode[1] = int.Parse(opArr[1]); info.OpenCode[2] = int.Parse(opArr[2]); info.OpenCode[3] = 0; info.OpenCode[4] = 0; } else { info.OpenCode[0] = -1; info.OpenCode[1] = -1; info.OpenCode[2] = -1; info.OpenCode[3] = 0; info.OpenCode[4] = 0; } } } } if (2 == list.Count) { //取当前期数的上一期的走势图信息及遗漏数据 lastinfo = list[1]; entity = ResultEntity; if (0 == j) entity = TCP3TrendChartDataService.GetTrendChartDataByTerm(chartId, chartType, list[1].Term); } bool yes = true; var sp = new StringBuilder(20000); sp.Append(""); for (int i = 0; i < count; i++) { //初始化遗漏数据(根据上期结果集计算_entity) chartItem[i].MissDataInit(entity, i); //计算项值及遗漏计算 yes = yes && chartItem[i].SetItemValue(info,lastinfo); if (yes) { //结果集赋值 ResultEntity.LocalMiss[i] = chartItem[i].GetMissData(MissDataType.LocalMiss); ResultEntity.LastMiss[i] = chartItem[i].GetMissData(MissDataType.LastMiss); ResultEntity.AllMaxMiss[i] = chartItem[i].GetMissData(MissDataType.AllMaxMiss); ResultEntity.AllAvgMiss[i] = chartItem[i].GetMissData(MissDataType.AllAvgMiss); ResultEntity.AllTimes[i] = chartItem[i].GetMissData(MissDataType.AllTimes); //modified by zizi,at 2016-8-29,3d和排列三试机号10和22 if (i == 1 && chartId == 22 && info.OpenCode1 == -1) { var singleValueItem = chartItem[i] as SingleValueItem; if (singleValueItem != null) singleValueItem._itemValue = " "; } sp.Append(chartItem[i].GetFomartString("{1}")); } } sp.Append(""); if (null != entity) ResultEntity.RecordCount = entity.RecordCount + 1; else ResultEntity.RecordCount = 1; ResultEntity.Term = currentData.Term; ResultEntity.HtmlData = sp.ToString(); if (!yes) { return new Tuple(false, string.Format("无效开奖数据:数据生成截止期数为【term={0}】", ResultEntity.Term)); } yes = yes && DatabaseProvider.GetDbProvider().Save(ResultEntity); if (!yes) { return new Tuple(false, string.Format("数据保存出错:数据保存截止期数为【term={0}】", ResultEntity.Term)); } j++; } return new Tuple(true, string.Format("正常生成完毕,截止期数为:Term={0}", ListToEnd[ListToEnd.Count - 1].Term)); } /// /// 预览走势图,默认显示近30期数据 (实时计算生成) /// /// /// /// /// /// public static string PreViewTrendChart(int chartId, TrendChartType chartType, LotterySearchField fields = null) { var list = TCP3Service.GetListToEnd(0, fields); if (null == list || 0 >= list.Count) return ""; //获取走势图项及配置数据 var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); if (null == trendChartItem || 0 >= trendChartItem.Count) return ""; int count = trendChartItem.Count; IList> chartItem = new List>(count); IList cssConfig = new List(count); foreach (var item in trendChartItem) { //实例化项类型 chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); //获取项CSS配置信息 cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); } //项初始化 for (int i = 0; i < count; i++) { trendChartItem[i].Cid = Cid; chartItem[i].Init(cssConfig[i], trendChartItem[i]); } var sp = new StringBuilder(20000); int record = list.Count; int topSize = null == fields ? 30 : fields.TopSize; if (30 > topSize) topSize = 30; for (int i = 0; i < record; i++) { for (int j = count - 1; j >= 0; j--) { chartItem[j].SetItemValue(list[i]); } if (i >= record - topSize) { sp.Append(""); for (int j = 0; j < count; j++) { sp.Append(chartItem[j].GetFomartString("{1}")); } sp.Append(""); } } return sp.ToString(); } /// /// 预览(012路走势图4走势图),默认显示近30期数据 (实时计算生成) /// /// /// /// public static string PreViewTCP3_012_4_TrendChart(int chartId, TrendChartType chartType,LotterySearchField fields = null) { var list = TCP3Service.GetListToEnd(0,fields); if (null == list || 0 >= list.Count) return ""; //获取走势图项及配置数据 var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); if (null == trendChartItem || 0 >= trendChartItem.Count) return ""; int count = trendChartItem.Count; IList> chartItem = new List>(count); IList cssConfig = new List(count); foreach (var item in trendChartItem) { //实例化项类型 chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); //获取项CSS配置信息 cssConfig.Add(ChartCssConfigService.Get(item.FuntionType, item.ChartCssId)); } //项初始化 for (int i = 0; i < count; i++) { trendChartItem[i].Cid = Cid; chartItem[i].Init(cssConfig[i], trendChartItem[i]); } var sp = new StringBuilder(20000); int record = list.Count; int topSize = null == fields ? 30 : fields.TopSize; int row = 0;// 控制一行4个td sp.Append("
"); for (int i = record - topSize; i < record; i++) { for (int j = count - 1; j >= 0; j--) { chartItem[j].SetItemValue(list[i]); } if (i >= record - topSize) { if ((row % 4) == 0) { sp.Append(""); } for (int j = 0; j < count; j++) { sp.Append(chartItem[j].GetFomartString("{1}")); } if ((row % 4) == 3) { sp.Append(""); } row++; } } sp.Append("
"); return sp.ToString(); } /// /// 预览(012路走势图4走势图),默认显示近30期数据 (实时计算生成) /// /// /// /// /// /// public static string PreViewTCP3_012_4_TrendChart(int chartId, TrendChartType chartType,TrendChartSearchField fields) { var list = TCP3Service.GetListToEnd(0, fields); if (null == list || 0 >= list.Count) return ""; if (fields != null && fields.StartTerm == 0 && fields.EndTerm == 0) { fields.EndTerm = (int)list[0].Term; fields.StartTerm = (int)list[list.Count - 1].Term; } //获取走势图项及配置数据 var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); if (null == trendChartItem || 0 >= trendChartItem.Count) return ""; int count = trendChartItem.Count; IList> chartItem = new List>(count); IList cssConfig = new List(count); foreach (var item in trendChartItem) { //实例化项类型 chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); //获取项CSS配置信息 cssConfig.Add(ChartCssConfigService.Get(item.FuntionType, item.ChartCssId)); } //项初始化 for (int i = 0; i < count; i++) { trendChartItem[i].Cid = Cid; chartItem[i].Init(cssConfig[i], trendChartItem[i]); } var sp = new StringBuilder(20000); int record = list.Count; //int topSize = null == fields ? 30 : fields.TopSize; //if (30 > topSize) // topSize = 30; int row = 0;// 控制一行4个td sp.Append("
"); for (int i = 0; i < record; i++) { for (int j = count - 1; j >= 0; j--) { chartItem[j].SetItemValue(list[i]); } if ((row % 4) == 0) { sp.Append(""); } for (int j = 0; j < count; j++) { sp.Append(chartItem[j].GetFomartString("{1}")); } if ((row % 4) == 3) { sp.Append(""); } row++; } sp.Append("
"); return sp.ToString(); } #region 生成走势图 已注释 by JNswins 2015-06-11 ///// ///// 生成走势图 ///// ///// 走势图ID ///// 走势图类型 ///// 需要生成走势图期数 ///// true:生成term期数及以后期数的走势图及遗漏数据;false:仅生成当前期走势图及遗漏数据 ///// true:生成组三数据;false:全部数据 ///// //public static bool CreateTrendChart(int chartId, TrendChartType chartType, long term, int week, bool MultiTerm = false, bool IsZS = false) //{ // if (MultiTerm && IsZS) // return CreateCurrentToEndZSTrendChart(chartId, chartType, term); // if (MultiTerm && !IsZS) // return CreateCurrentToEndTrendChart(chartId, chartType, term); // if (!MultiTerm && IsZS) // return CreateCurrentZSTrendChart(chartId, chartType, term); // return CreateCurrentTrendChart(chartId, chartType, term); //} ///// ///// 生成当前期走势图 ///// ///// ///// ///// ///// //private static bool CreateCurrentTrendChart(int chartId, TrendChartType chartType, long term) //{ // //获取走势图项及配置数据 // var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); // if (null == trendChartItem || 0 >= trendChartItem.Count) // return false; // int count = trendChartItem.Count; // IList> chartItem = new List>(count); // IList cssConfig = new List(count); // foreach (var item in trendChartItem) // { // //实例化项类型 // chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); // //获取项CSS配置信息 // cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); // } // //根据参数term期数获取近两期开奖信息TOP 2 [Term]<=term ORDER BY [Term] DESC // var list = TCP3Service.ToListForTrend(term); // TCP3Info info = null; // TrendChartData entity = null; // if (null == list || 0 >= list.Count) // return false; // info = list[0]; // if (2 == list.Count) // { // //取当前期数的上一期的走势图信息及遗漏数据 // entity = TCP3TrendChartDataService.GetTrendChartDataByTerm(chartId, chartType, list[1].Term); // } // var ResultEntity = new TrendChartData // { // ChartId = chartId, // Term = term, // ChartType = chartType, // LocalMiss = new string[count], // LastMiss = new string[count], // AllMaxMiss = new string[count], // AllAvgMiss = new string[count], // AllTimes = new string[count] // }; // var sp = new StringBuilder(20000); // sp.Append(""); // for (int i = 0; i < count; i++) // { // //项初始化 // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // //初始化遗漏数据(根据上期结果集计算_entity) // chartItem[i].MissDataInit(entity, i); // //计算项值及遗漏计算 // chartItem[i].SetItemValue(info); // //结果集赋值 // ResultEntity.LocalMiss[i] = chartItem[i].GetMissData(MissDataType.LocalMiss); // ResultEntity.LastMiss[i] = chartItem[i].GetMissData(MissDataType.LastMiss); // ResultEntity.AllMaxMiss[i] = chartItem[i].GetMissData(MissDataType.AllMaxMiss); // ResultEntity.AllAvgMiss[i] = chartItem[i].GetMissData(MissDataType.AllAvgMiss); // ResultEntity.AllTimes[i] = chartItem[i].GetMissData(MissDataType.AllTimes); // sp.Append(chartItem[i].GetFomartString("{1}")); // } // sp.Append(""); // if (entity != null) // ResultEntity.RecordCount = entity.RecordCount + 1; // else // ResultEntity.RecordCount = 1; // ResultEntity.HtmlData = sp.ToString(); // return DatabaseProvider.GetDbProvider().Save(ResultEntity); //} ///// ///// 生成当前期(组三)走势图 ///// ///// ///// ///// ///// //private static bool CreateCurrentZSTrendChart(int chartId, TrendChartType chartType, long term) //{ // //获取走势图项及配置数据 // var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); // if (null == trendChartItem || 0 >= trendChartItem.Count) // return false; // int count = trendChartItem.Count; // IList> chartItem = new List>(count); // IList cssConfig = new List(count); // foreach (var item in trendChartItem) // { // //实例化项类型 // chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); // //获取项CSS配置信息 // cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); // } // //根据参数term期数获取近两期开奖信息TOP 2 [Term]<=term ORDER BY [Term] DESC // var list = TCP3Service.ToListForZSTrend(term); // TCP3Info info = null; // TrendChartData entity = null; // if (null == list || 0 >= list.Count) // return false; // info = list[0]; // //当前期不是组三走势图 // if (info.Term != term) // return false; // if (2 == list.Count) // { // //取当前期数的上一期的走势图信息及遗漏数据 // entity = TCP3TrendChartDataService.GetTrendChartDataByTerm(chartId, chartType, list[1].Term); // //将上一期数据初始化(方便用期号计算机组三遗漏值) // for (int i = 0; i < count; i++) // { // //项初始化 // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // //初始化遗漏数据(根据上期结果集计算_entity) // chartItem[i].MissDataInit(entity, i); // //计算项值及遗漏计算 // chartItem[i].SetItemValue(list[1]); // } // } // var ResultEntity = new TrendChartData // { // ChartId = chartId, // Term = term, // ChartType = chartType, // LocalMiss = new string[count], // LastMiss = new string[count], // AllMaxMiss = new string[count], // AllAvgMiss = new string[count], // AllTimes = new string[count] // }; // var sp = new StringBuilder(20000); // sp.Append(""); // for (int i = 0; i < count; i++) // { // //项初始化 // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // //初始化遗漏数据(根据上期结果集计算_entity) // chartItem[i].MissDataInit(entity, i); // //计算项值及遗漏计算 // chartItem[i].SetItemValue(info); // //结果集赋值 // ResultEntity.LocalMiss[i] = chartItem[i].GetMissData(MissDataType.LocalMiss); // ResultEntity.LastMiss[i] = chartItem[i].GetMissData(MissDataType.LastMiss); // ResultEntity.AllMaxMiss[i] = chartItem[i].GetMissData(MissDataType.AllMaxMiss); // ResultEntity.AllAvgMiss[i] = chartItem[i].GetMissData(MissDataType.AllAvgMiss); // ResultEntity.AllTimes[i] = chartItem[i].GetMissData(MissDataType.AllTimes); // sp.Append(chartItem[i].GetFomartString("{1}")); // } // sp.Append(""); // if (entity != null) // ResultEntity.RecordCount = entity.RecordCount + 1; // else // ResultEntity.RecordCount = 1; // ResultEntity.HtmlData = sp.ToString(); // return DatabaseProvider.GetDbProvider().Save(ResultEntity); //} ///// ///// 生成当期走势图以及后面走势图 ///// ///// ///// ///// ///// //private static bool CreateCurrentToEndTrendChart(int chartId, TrendChartType chartType, long term) //{ // //当期以及以后数据 // var ListToEnd = TCP3Service.GetListToEnd(term); // if (null == ListToEnd || ListToEnd.Count <= 0) // return false; // //获取走势图项及配置数据 // var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); // if (null == trendChartItem || 0 >= trendChartItem.Count) // return false; // int count = trendChartItem.Count; // IList> chartItem = new List>(count); // IList cssConfig = new List(count); // foreach (var item in trendChartItem) // { // //实例化项类型 // chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); // //获取项CSS配置信息 // cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); // } // //项初始化 // for (int i = 0; i < count; i++) // { // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // } // foreach (var currentData in ListToEnd) // { // //根据参数term期数获取近两期开奖信息TOP 2 [Term]<=term ORDER BY [Term] DESC // var list = TCP3Service.ToListForTrend(currentData.Term); // TCP3Info info = null; // TrendChartData entity = null; // if (null == list || 0 >= list.Count) // continue; // info = list[0]; // if (2 == list.Count) // { // //取当前期数的上一期的走势图信息及遗漏数据 // entity = TCP3TrendChartDataService.GetTrendChartDataByTerm(chartId, chartType, list[1].Term); // } // var ResultEntity = new TrendChartData // { // ChartId = chartId, // Term = currentData.Term, // ChartType = chartType, // LocalMiss = new string[count], // LastMiss = new string[count], // AllMaxMiss = new string[count], // AllAvgMiss = new string[count], // AllTimes = new string[count] // }; // var sp = new StringBuilder(20000); // sp.Append(""); // for (int i = 0; i < count; i++) // { // //初始化遗漏数据(根据上期结果集计算_entity) // chartItem[i].MissDataInit(entity, i); // //计算项值及遗漏计算 // chartItem[i].SetItemValue(info); // //结果集赋值 // ResultEntity.LocalMiss[i] = chartItem[i].GetMissData(MissDataType.LocalMiss); // ResultEntity.LastMiss[i] = chartItem[i].GetMissData(MissDataType.LastMiss); // ResultEntity.AllMaxMiss[i] = chartItem[i].GetMissData(MissDataType.AllMaxMiss); // ResultEntity.AllAvgMiss[i] = chartItem[i].GetMissData(MissDataType.AllAvgMiss); // ResultEntity.AllTimes[i] = chartItem[i].GetMissData(MissDataType.AllTimes); // sp.Append(chartItem[i].GetFomartString("{1}")); // } // sp.Append(""); // if (entity != null) // ResultEntity.RecordCount = entity.RecordCount + 1; // else // ResultEntity.RecordCount = 1; // ResultEntity.HtmlData = sp.ToString(); // DatabaseProvider.GetDbProvider().Save(ResultEntity); // } // return true; //} ///// ///// 生成当期(组三)走势图以及后面走势图 ///// ///// ///// ///// ///// //private static bool CreateCurrentToEndZSTrendChart(int chartId, TrendChartType chartType, long term) //{ // //当期以及以后数据 // var ListToEnd = TCP3Service.GetListToEnd(term); // if (null == ListToEnd || ListToEnd.Count <= 0) // return false; // //获取走势图项及配置数据 // var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); // if (null == trendChartItem || 0 >= trendChartItem.Count) // return false; // int count = trendChartItem.Count; // IList> chartItem = new List>(count); // IList cssConfig = new List(count); // foreach (var item in trendChartItem) // { // //实例化项类型 // chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); // //获取项CSS配置信息 // cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); // } // //项初始化 // for (int i = 0; i < count; i++) // { // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // } // for (int j = 0; j < ListToEnd.Count; j++) // { // //不是组三就不执行 // if (!(ListToEnd[j].OpenCode1 == ListToEnd[j].OpenCode2 || ListToEnd[j].OpenCode1 == ListToEnd[j].OpenCode3 || // ListToEnd[j].OpenCode2 == ListToEnd[j].OpenCode3 && // (ListToEnd[j].OpenCode1 != ListToEnd[j].OpenCode2 && ListToEnd[j].OpenCode1 != ListToEnd[j].OpenCode3))) // continue; // //根据参数term期数获取近两期(组三)开奖信息TOP 2 [Term]<=term ORDER BY [Term] DESC // var list = TCP3Service.ToListForZSTrend(ListToEnd[j].Term); // TCP3Info info = null; // TrendChartData entity = null; // if (null == list || 0 >= list.Count) // continue; // info = list[0]; // if (2 == list.Count) // { // //取当前期数的上一期的走势图信息及遗漏数据 // entity = TCP3TrendChartDataService.GetTrendChartDataByTerm(chartId, chartType, list[1].Term); // //将上一期数据初始化(方便用期号计算机组三遗漏值)--第一条记录才需要初始化上一期数据 // if (j == 0) // for (int i = 0; i < count; i++) // { // //项初始化 // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // //初始化遗漏数据(根据上期结果集计算_entity) // chartItem[i].MissDataInit(entity, i); // //计算项值及遗漏计算 // chartItem[i].SetItemValue(list[1]); // } // } // var ResultEntity = new TrendChartData // { // ChartId = chartId, // Term = ListToEnd[j].Term, // ChartType = chartType, // LocalMiss = new string[count], // LastMiss = new string[count], // AllMaxMiss = new string[count], // AllAvgMiss = new string[count], // AllTimes = new string[count] // }; // var sp = new StringBuilder(20000); // sp.Append(""); // for (int i = 0; i < count; i++) // { // //初始化遗漏数据(根据上期结果集计算_entity) // chartItem[i].MissDataInit(entity, i); // //计算项值及遗漏计算 // chartItem[i].SetItemValue(info); // //结果集赋值 // ResultEntity.LocalMiss[i] = chartItem[i].GetMissData(MissDataType.LocalMiss); // ResultEntity.LastMiss[i] = chartItem[i].GetMissData(MissDataType.LastMiss); // ResultEntity.AllMaxMiss[i] = chartItem[i].GetMissData(MissDataType.AllMaxMiss); // ResultEntity.AllAvgMiss[i] = chartItem[i].GetMissData(MissDataType.AllAvgMiss); // ResultEntity.AllTimes[i] = chartItem[i].GetMissData(MissDataType.AllTimes); // sp.Append(chartItem[i].GetFomartString("{1}")); // } // sp.Append(""); // if (entity != null) // ResultEntity.RecordCount = entity.RecordCount + 1; // else // ResultEntity.RecordCount = 1; // ResultEntity.HtmlData = sp.ToString(); // DatabaseProvider.GetDbProvider().Save(ResultEntity); // } // return true; //} #endregion #region 生成预览走势图 已注释 by JNswins 2015-06-11 ///// ///// 预览当期走势图以及后面走势图 ///// ///// ///// ///// ///// //public static string PreViewCurrentToEndTrendChart(int chartId, TrendChartType chartType) //{ // StringBuilder sp = new StringBuilder(20000); // //当期以及以后数据 // var ListToEnd = TCP3Service.GetListToEnd(-1); // if (null == ListToEnd || ListToEnd.Count <= 0) // return ""; // var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); // if (null == trendChartItem || 0 >= trendChartItem.Count) // return ""; // int count = trendChartItem.Count; // IList> chartItem = new List>(count); // IList cssConfig = new List(count); // foreach (var item in trendChartItem) // { // //实例化项类型 // chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); // //获取项CSS配置信息 // cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); // } // //项初始化 // for (int i = 0; i < count; i++) // { // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // } // for (int j = 0; j < ListToEnd.Count; j++) // { // if (j < ListToEnd.Count - 31) // { // for (int i = 0; i < count; i++) // { // //计算项值及遗漏计算 // chartItem[i].SetItemValue(ListToEnd[j]); // } // } // else // { // sp.Append(""); // for (int i = 0; i < count; i++) // { // //计算项值及遗漏计算 // chartItem[i].SetItemValue(ListToEnd[j]); // sp.Append(chartItem[i].GetFomartString("{1}")); // } // sp.Append(""); // } // } // return sp.ToString(); //} ///// ///// 预览当期(组三)走势图以及后面走势图 ///// ///// ///// ///// ///// //public static string PreViewCurrentToEndZSTrendChart(int chartId, TrendChartType chartType, long term) //{ // var sp = new StringBuilder(20000); // //当期以及以后数据 // var ListToEnd = TCP3Service.GetListToEnd(term); // if (null == ListToEnd || ListToEnd.Count <= 0) // return ""; // var List = new List(); // for (int j = 0; j < ListToEnd.Count; j++) // { // //不是组三就不执行 // if (!(ListToEnd[j].OpenCode1 == ListToEnd[j].OpenCode2 || ListToEnd[j].OpenCode1 == ListToEnd[j].OpenCode3 || // ListToEnd[j].OpenCode2 == ListToEnd[j].OpenCode3 && // (ListToEnd[j].OpenCode1 != ListToEnd[j].OpenCode2 && ListToEnd[j].OpenCode1 != ListToEnd[j].OpenCode3))) // continue; // List.Add(ListToEnd[j]); // } // ListToEnd = List; // //获取走势图项及配置数据 // var trendChartItem = TrendChartItemService.ToListByChartId(chartId, chartType); // if (null == trendChartItem || 0 >= trendChartItem.Count) // return ""; // int count = trendChartItem.Count; // IList> chartItem = new List>(count); // IList cssConfig = new List(count); // foreach (var item in trendChartItem) // { // //实例化项类型 // chartItem.Add(TrendChartUtils.GetTrendChartInterface(item.ClassName)); // //获取项CSS配置信息 // cssConfig.Add(ChartCssConfigService.Get(item.ChartCssId)); // } // //项初始化 // for (int i = 0; i < count; i++) // { // chartItem[i].Init(cssConfig[i], trendChartItem[i]); // } // for (int j = 0; j < ListToEnd.Count; j++) // { // if (j < ListToEnd.Count - 31) // { // for (int i = 0; i < count; i++) // { // //计算项值及遗漏计算 // chartItem[i].SetItemValue(ListToEnd[j]); // } // } // else // { // sp.Append(""); // for (int i = 0; i < count; i++) // { // //计算项值及遗漏计算 // chartItem[i].SetItemValue(ListToEnd[j]); // sp.Append(chartItem[i].GetFomartString("{1}")); // } // sp.Append(""); // } // } // return sp.ToString(); //} #endregion } }