/// <summary> /// 同步最新赛事和胜平负赔率 /// </summary> public void SysnWinOrLose() { ISearch search = new WinOrLoseSearch(); var winOrLose = (WinOrLoseDate)search.Process(); if (winOrLose != null && winOrLose.data.Count > 0) { foreach (Data.FootballGameModel.data item in winOrLose.data) { var tt = new FootballMatchBLL().GetMatchInfo(item.id); var tt1 = new BaseBLL <tblWinOrLosehad>().FirstOrDefault(x => x.id.Equals(item.id)); if (tt != null) { tt.num = item.num; tt.date = item.date; tt.time = item.time; tt.h_cn_abbr = item.h_cn_abbr; tt.a_cn_abbr = item.a_cn_abbr; tt.h_order = item.h_order; tt.a_order = item.a_order; tt.weather = item.weather; tt.temperature = item.temperature; tt.weather_pic = item.weather_pic; tt.l_cn = item.l_cn; tt.l_cn_abbr = item.l_cn; new BaseBLL <tblFootballMatch>().UpdateEntity(tt); } else { new BaseBLL <tblFootballMatch>().AddEntity(new tblFootballMatch { id = item.id, num = item.num, date = item.date, time = item.time, h_cn_abbr = item.h_cn_abbr, a_cn_abbr = item.a_cn_abbr, h_order = item.h_order, a_order = item.a_order, weather = item.weather, temperature = item.temperature, weather_pic = item.weather_pic, l_cn = item.l_cn, l_cn_abbr = item.l_cn_abbr }); } if (tt1 != null) { tt1.a = item.had.a; tt1.d = item.had.d; tt1.h = item.had.h; tt1.o_type = item.had.o_type; tt1.single = item.had.single; tt1.fixedodds = item.had.fixedodds; tt1.b = item.hhad.a; tt1.e = item.hhad.d; tt1.i = item.hhad.h; tt1.ro_type = item.hhad.o_type; tt1.rsingle = item.hhad.single; tt1.rfixedodds = item.hhad.fixedodds; new BaseBLL <tblWinOrLosehad>().UpdateEntity(tt1); } else { new BaseBLL <tblWinOrLosehad>().AddEntity(new tblWinOrLosehad { id = item.id, a = item.had != null ?item.had.a:"", d = item.had != null ? item.had.d : "", h = item.had != null ? item.had.h : "", o_type = item.had != null ? item.had.o_type : "", single = item.had != null ? item.had.single : "", fixedodds = item.had != null ? item.had.fixedodds : "", b = item.hhad.a, e = item.hhad.d, i = item.hhad.h, ro_type = item.hhad.o_type, rsingle = item.hhad.single, rfixedodds = item.hhad.fixedodds }); } } } }
public void WinOrLoseTest() { ISearch search = new WinOrLoseSearch(); var winOrLose = (WinOrLoseDate)search.Process(); if (winOrLose != null && winOrLose.data.Count > 0) { foreach (Data.FootballGameModel.data item in winOrLose.data) { var tt = new FootballMatchBLL().GetMatchInfo(item.id); var tt1 = new BaseBLL <tblWinOrLosehad>().FirstOrDefault(x => x.id.Equals(item.id)); var tt2 = new BaseBLL <tblWinOrLosehhad>().FirstOrDefault(x => x.id.Equals(item.id)); if (tt != null) { tt.num = item.num; tt.date = item.date; tt.time = item.time; tt.h_cn_abbr = item.h_cn_abbr; tt.a_cn_abbr = item.a_cn_abbr; tt.h_order = item.h_order; tt.a_order = item.a_order; tt.weather = item.weather; tt.temperature = item.temperature; tt.weather_pic = item.weather_pic; new BaseBLL <tblFootballMatch>().UpdateEntity(tt); } else { new BaseBLL <tblFootballMatch>().AddEntity(new tblFootballMatch { id = item.id, num = item.num, date = item.date, time = item.time, h_cn_abbr = item.h_cn_abbr, a_cn_abbr = item.a_cn_abbr, h_order = item.h_order, a_order = item.a_order, weather = item.weather, temperature = item.temperature, weather_pic = item.weather_pic }); } if (tt1 != null) { tt1.a = item.had.a; tt1.d = item.had.d; tt1.h = item.had.h; new BaseBLL <tblWinOrLosehad>().UpdateEntity(tt1); } else { new BaseBLL <tblWinOrLosehad>().AddEntity(new tblWinOrLosehad { id = item.id, a = item.had.a, d = item.had.d, h = item.had.h }); } if (tt2 != null) { tt2.id = item.id; tt2.a = item.hhad.a; tt2.d = item.hhad.d; tt2.h = item.hhad.h; new BaseBLL <tblWinOrLosehhad>().UpdateEntity(tt2); } else { new BaseBLL <tblWinOrLosehhad>().AddEntity(new tblWinOrLosehhad { id = item.id, a = item.hhad.a, d = item.hhad.d, h = item.hhad.h }); } } } }