public DF6_1_ZHZS_InfoCollection QueryDF6_1_ZHZS(int index) { DF6_1_ZHZS_InfoCollection Collection = new DF6_1_ZHZS_InfoCollection(); var list = this.QueryGameChart <DF6_1_ZHZS_Info>(string.Format("QueryDF6_1_ZHZS_{0}", index), () => { var infoList = new List <DF6_1_ZHZS_Info>(); var entityList = new DF6_1_ZHZSManager().QueryDF6_1_ZHZS(index); ObjectConvert.ConvertEntityListToInfoList <List <DF6_1_ZHZS>, DF6_1_ZHZS, List <DF6_1_ZHZS_Info>, DF6_1_ZHZS_Info>(entityList, ref infoList, () => { return(new DF6_1_ZHZS_Info()); }, (entity, info) => { //处理info里面有,页entity里面没有的属性 //info.WinNumber = entity.WinNumber; }); return(infoList); }); Collection.AddRange(list); return(Collection); }
private void AddDF6_1_ZHZS(string issuseNumber, string winNumber) { var manager = new DF6_1_ZHZSManager(); var issuse = manager.QueryDF6_1_ZHZSIssuseNumber(issuseNumber); if (issuse > 0) { return; } var winRed = winNumber.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string ZH_Proportion = string.Empty; int z = 0; int h = 0; foreach (var item in winRed) { if (Convert.ToInt32(item) == 1 || Convert.ToInt32(item) == 2 || Convert.ToInt32(item) == 3 || Convert.ToInt32(item) == 5 || Convert.ToInt32(item) == 7) { z++; } else { h++; } } ZH_Proportion = string.Format("{0}:{1}", z, h); var last = manager.QueryLastDF6_1_ZHZS(); var dic = new Dictionary <string, object>(); dic.Add("IssuseNumber", issuseNumber); dic.Add("WinNumber", winNumber); dic.Add("CreateTime", DateTime.Now); dic.Add("ZH_Proportion", ZH_Proportion); var entity = this.CreateNewEntity <DF6_1_ZHZS>(dic, (p) => { //取上一期的数据+1 var lastValue = (last == null ? 1 : int.Parse(p.GetValue(last, null).ToString()) + 1); //判断有没有开出此号 if (p.Name.StartsWith("O_ZH_")) { var order = p.Name.Replace("O_ZH_Proportion", string.Empty); lastValue = ZH_Proportion.Replace(":", "") == order ? 0 : lastValue; } if (p.Name == "ZH_Z") { lastValue = (Convert.ToInt32(winRed[0]) == 1 || Convert.ToInt32(winRed[0]) == 2 || Convert.ToInt32(winRed[0]) == 3 || Convert.ToInt32(winRed[0]) == 5 || Convert.ToInt32(winRed[0]) == 7) ? 0 : lastValue; } if (p.Name == "ZH_H") { lastValue = (Convert.ToInt32(winRed[0]) == 1 || Convert.ToInt32(winRed[0]) == 2 || Convert.ToInt32(winRed[0]) == 3 || Convert.ToInt32(winRed[0]) == 5 || Convert.ToInt32(winRed[0]) == 7) ? lastValue : 0; } if (p.Name == "ZH1_Z") { lastValue = (Convert.ToInt32(winRed[1]) == 1 || Convert.ToInt32(winRed[1]) == 2 || Convert.ToInt32(winRed[1]) == 3 || Convert.ToInt32(winRed[1]) == 5 || Convert.ToInt32(winRed[1]) == 7) ? 0 : lastValue; } if (p.Name == "ZH1_H") { lastValue = (Convert.ToInt32(winRed[1]) == 1 || Convert.ToInt32(winRed[1]) == 2 || Convert.ToInt32(winRed[1]) == 3 || Convert.ToInt32(winRed[1]) == 5 || Convert.ToInt32(winRed[1]) == 7) ? lastValue : 0; } if (p.Name == "ZH2_Z") { lastValue = (Convert.ToInt32(winRed[2]) == 1 || Convert.ToInt32(winRed[2]) == 2 || Convert.ToInt32(winRed[2]) == 3 || Convert.ToInt32(winRed[2]) == 5 || Convert.ToInt32(winRed[2]) == 7) ? 0 : lastValue; } if (p.Name == "ZH2_H") { lastValue = (Convert.ToInt32(winRed[2]) == 1 || Convert.ToInt32(winRed[2]) == 2 || Convert.ToInt32(winRed[2]) == 3 || Convert.ToInt32(winRed[2]) == 5 || Convert.ToInt32(winRed[2]) == 7) ? lastValue : 0; } if (p.Name == "ZH3_Z") { lastValue = (Convert.ToInt32(winRed[3]) == 1 || Convert.ToInt32(winRed[3]) == 2 || Convert.ToInt32(winRed[3]) == 3 || Convert.ToInt32(winRed[3]) == 5 || Convert.ToInt32(winRed[3]) == 7) ? 0 : lastValue; } if (p.Name == "ZH3_H") { lastValue = (Convert.ToInt32(winRed[3]) == 1 || Convert.ToInt32(winRed[3]) == 2 || Convert.ToInt32(winRed[3]) == 3 || Convert.ToInt32(winRed[3]) == 5 || Convert.ToInt32(winRed[3]) == 7) ? lastValue : 0; } if (p.Name == "ZH4_Z") { lastValue = (Convert.ToInt32(winRed[4]) == 1 || Convert.ToInt32(winRed[4]) == 2 || Convert.ToInt32(winRed[4]) == 3 || Convert.ToInt32(winRed[4]) == 5 || Convert.ToInt32(winRed[4]) == 7) ? 0 : lastValue; } if (p.Name == "ZH4_H") { lastValue = (Convert.ToInt32(winRed[4]) == 1 || Convert.ToInt32(winRed[4]) == 2 || Convert.ToInt32(winRed[4]) == 3 || Convert.ToInt32(winRed[4]) == 5 || Convert.ToInt32(winRed[4]) == 7) ? lastValue : 0; } if (p.Name == "ZH5_Z") { lastValue = (Convert.ToInt32(winRed[5]) == 1 || Convert.ToInt32(winRed[5]) == 2 || Convert.ToInt32(winRed[5]) == 3 || Convert.ToInt32(winRed[5]) == 5 || Convert.ToInt32(winRed[5]) == 7) ? 0 : lastValue; } if (p.Name == "ZH5_H") { lastValue = (Convert.ToInt32(winRed[5]) == 1 || Convert.ToInt32(winRed[5]) == 2 || Convert.ToInt32(winRed[5]) == 3 || Convert.ToInt32(winRed[5]) == 5 || Convert.ToInt32(winRed[5]) == 7) ? lastValue : 0; } return(lastValue); }); manager.AddDF6_1_ZHZS(entity); }