private void AnalyseDataBai(List <IssueModel> data, int comparedIssueCount) { bool isdebug = System.Configuration.ConfigurationManager.AppSettings["isDebug"].ToLower() == "true"; bool isshowDetail = System.Configuration.ConfigurationManager.AppSettings["isShowDetail"].ToLower() == "true"; bool showCount0 = System.Configuration.ConfigurationManager.AppSettings["isShowCount0"].ToLower() == "true"; if (isshowDetail) { this.richTextBox100.Text += "\r\n"; this.richTextBox100.Text += string.Format("************************【百位{0}期分析】************************\r\n", comparedIssueCount); //this.richTextBox1.Text += " >>>计算中......\r\n"; } ReadyDataModel rm = GetDataAnalyse.GetModelsReadyBai(data, comparedIssueCount); if (data == null || data.Count == 0) { MessageBox.Show("从网上获取数据失败!", "错误", MessageBoxButtons.OK); return; } DataBeCompareModel baseModel = rm.BeCmpModel; int dxAppear = 0; int daCount = 0; int dsAppear = 0; int danCount = 0; int zzAppear = 0; int zhiCount = 0; int l3Appear = 0; int lu0Count = 0; int lu1Count = 0; int lu2Count = 0; List <int> zhishuList = new List <int> { 1, 2, 3, 5, 7 }; long baseIssue = baseModel.beginCompareIssue; long baseend = baseModel.endCompareIssue; foreach (DataCompareModel cmp in rm.CmpModels) { if (isdebug) { this.richTextBox100.Text += "==============\r\n"; this.richTextBox100.Text += "当前期号:" + baseModel.beginCompareIssue + "\r\n"; this.richTextBox100.Text += "历史期号:" + cmp.beginCompareIssue + "\r\n"; this.richTextBox100.Text += "当前大小:" + baseModel.daxiaoBase + "\r\n"; this.richTextBox100.Text += "历史大小:" + cmp.daxiaoCmp + "\r\n"; this.richTextBox100.Text += "当前单双:" + baseModel.danshuangBase + "\r\n"; this.richTextBox100.Text += "历史单双:" + cmp.danshuangCmp + "\r\n"; this.richTextBox100.Text += "当前质合:" + baseModel.zhiheBase + "\r\n"; this.richTextBox100.Text += "历史质合:" + cmp.zhiheCmp + "\r\n"; this.richTextBox100.Text += "当前3路:" + baseModel.lu3Base + "\r\n"; this.richTextBox100.Text += "历史3路:" + cmp.lu3Cmp + "\r\n"; } long cmpedIssue = cmp.beginCompareIssue; long nextIssue = cmp.nextIssueData.Issue; if (cmp.daxiaoCmp == baseModel.daxiaoBase) { dxAppear++; bool isDa = cmp.nextIssueData.Bai > 4; daCount += isDa ? 1 : 0; if (isshowDetail) { this.richTextBox100.Text += string.Format("大小:{0}与历史{1}后{2}期相同,{3}期出【{4}】\r\n", baseIssue, cmpedIssue, comparedIssueCount, nextIssue, isDa ? "大" : "小"); } } if (cmp.danshuangCmp == baseModel.danshuangBase) { dsAppear++; bool isDan = cmp.nextIssueData.Bai % 2 == 1; danCount += isDan ? 1 : 0; if (isshowDetail) { this.richTextBox100.Text += string.Format("单双:{0}与历史{1}后{2}期相同,{3}期出【{4}】\r\n", baseIssue, cmpedIssue, comparedIssueCount, nextIssue, isDan ? "单" : "双"); } } if (cmp.zhiheCmp == baseModel.zhiheBase) { zzAppear++; bool isZhi = zhishuList.Contains(cmp.nextIssueData.Bai); zhiCount += isZhi ? 1 : 0; if (isshowDetail) { this.richTextBox100.Text += string.Format("质合:{0}与历史{1}后{2}期相同,{3}期出【{4}】\r\n", baseIssue, cmpedIssue, comparedIssueCount, nextIssue, isZhi ? "质" : "合"); } } if (cmp.lu3Cmp == baseModel.lu3Base) { l3Appear++; int rest = cmp.nextIssueData.Bai % 3; if (rest == 0) { lu0Count++; } else if (rest == 1) { lu1Count++; } else { lu2Count++; } if (isshowDetail) { this.richTextBox100.Text += string.Format("路数:{0}与历史{1}后{2}期相同,{3}期出【{4}】\r\n", baseIssue, cmpedIssue, comparedIssueCount, nextIssue, rest); } } } this.richTextBox100.Text += "\r\n"; this.richTextBox100.Text += string.Format("------------******【百位{0}期汇总】******-------------\r\n", comparedIssueCount); if (showCount0) { this.richTextBox100.Text += string.Format("【{0}-{1}】共【{2}】期历史相同对比,共出现\r\n" + " - 大小:【{3}】次相同结果,其中下期出【大{4}次占{5}】;\r\n" + " - 单双:【{6}】次相同结果,其中下期出【单{7}次占{8}】;\r\n" + " - 质合:【{9}】次相同结果,其中下期出【质{10}次占{11}】;\r\n" + " - 路数:【{12}】次相同结果,其中下期出0【{13}次占{14}】,1【{15}次占{16}】,2【{17}次占{18}】;\r\n", baseIssue, baseend, comparedIssueCount, dxAppear, daCount, (daCount * 1.00 / dxAppear).ToString("0.00%"), dsAppear, danCount, (danCount * 1.00 / dsAppear).ToString("0.00%"), zzAppear, zhiCount, (zhiCount * 1.00 / zzAppear).ToString("0.00%"), l3Appear, lu0Count, (lu0Count * 1.00 / l3Appear).ToString("0.00%"), lu1Count, (lu1Count * 1.00 / l3Appear).ToString("0.00%"), lu2Count, (lu2Count * 1.00 / l3Appear).ToString("0.00%") ); } else { StringBuilder sb = new StringBuilder(); if ((dxAppear + dsAppear + zzAppear + l3Appear) > 0) { sb.AppendFormat("【{0}-{1}】共【{2}】期历史相同对比,共出现\r\n", baseIssue, baseend, comparedIssueCount); } if (dxAppear > 0) { sb.AppendFormat(" - 大小:【{0}】次相同结果,其中下期出【大{1}次占{2}】;\r\n", dxAppear, daCount, (daCount * 1.00 / dxAppear).ToString("0.00%")); } if (dsAppear > 0) { sb.AppendFormat(" - 单双:【{0}】次相同结果,其中下期出【单{1}次占{2}】;\r\n", dsAppear, danCount, (danCount * 1.00 / dsAppear).ToString("0.00%")); } if (zzAppear > 0) { sb.AppendFormat(" - 质合:【{0}】次相同结果,其中下期出【质{1}次占{2}】;\r\n", zzAppear, zhiCount, (zhiCount * 1.00 / zzAppear).ToString("0.00%")); } if (l3Appear > 0) { sb.AppendFormat(" - 路数:【{0}】次相同结果,其中下期出0【{1}次占{2}】,1【{3}次占{4}】,2【{5}次占{6}】;\r\n", l3Appear, lu0Count, (lu0Count * 1.00 / l3Appear).ToString("0.00%"), lu1Count, (lu1Count * 1.00 / l3Appear).ToString("0.00%"), lu2Count, (lu2Count * 1.00 / l3Appear).ToString("0.00%")); } this.richTextBox100.Text += sb.ToString(); } //this.richTextBox1.Text += "--------***********---------\r\n"; }
public static ReadyDataModel GetModelsReadyShi(List <IssueModel> data, int countNo) { ReadyDataModel result = new ReadyDataModel(); List <IssueModel> baseResult = new List <IssueModel>(); string daxiaoBase = ""; string danshuangBase = ""; string zhiheBase = ""; string lu3Base = ""; List <int> zhishuList = new List <int> { 1, 2, 3, 5, 7 }; for (int i = 0; i < countNo; i++) { IssueModel m = data[countNo - 1 - i]; baseResult.Add(m); daxiaoBase += m.Shi > 4 ? "1" : "0"; danshuangBase += m.Shi % 2 == 1 ? "1" : "0"; zhiheBase += zhishuList.Contains(m.Shi) ? "1" : "0"; lu3Base += (m.Shi % 3).ToString(); } DataBeCompareModel becmp = new DataBeCompareModel(); becmp.beginCompareIssue = data[countNo - 1].Issue; becmp.endCompareIssue = data[0].Issue; becmp.daxiaoBase = daxiaoBase; becmp.danshuangBase = danshuangBase; becmp.zhiheBase = zhiheBase; becmp.lu3Base = lu3Base; result.BeCmpModel = becmp; int beginIndex = data.Count - 1; string daxiaoCmp = ""; string danshuangCmp = ""; string zhiheCmp = ""; string lu3Cmp = ""; result.CmpModels = new List <DataCompareModel>(); while (beginIndex - countNo > 0) { daxiaoCmp = ""; danshuangCmp = ""; zhiheCmp = ""; lu3Cmp = ""; List <IssueModel> compareData = new List <IssueModel>(); for (int i = 0; i < countNo; i++) { IssueModel m = data[beginIndex - i]; compareData.Add(data[beginIndex - i]); daxiaoCmp += m.Shi > 4 ? "1" : "0"; danshuangCmp += m.Shi % 2 == 1 ? "1" : "0"; zhiheCmp += zhishuList.Contains(m.Shi) ? "1" : "0"; lu3Cmp += (m.Shi % 3).ToString(); } DataCompareModel cmp = new DataCompareModel(); cmp.beginCompareIssue = data[beginIndex].Issue; cmp.daxiaoCmp = daxiaoCmp; cmp.danshuangCmp = danshuangCmp; cmp.zhiheCmp = zhiheCmp; cmp.lu3Cmp = lu3Cmp; cmp.nextIssueData = data[beginIndex - countNo]; result.CmpModels.Add(cmp); beginIndex--; } //comparing return(result); //end }