/// <summary> /// 获得数据列表 /// </summary> public List <SeoWebSite.Model.BetExp> DataTableToList(DataTable dt) { List <SeoWebSite.Model.BetExp> modelList = new List <SeoWebSite.Model.BetExp>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.BetExp model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.BetExp(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.data = dt.Rows[n]["data"].ToString(); if (dt.Rows[n]["isexp"].ToString() != "") { if ((dt.Rows[n]["isexp"].ToString() == "1") || (dt.Rows[n]["isexp"].ToString().ToLower() == "true")) { model.isexp = true; } else { model.isexp = false; } } model.exp = dt.Rows[n]["exp"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// ��������б� /// </summary> public List<SeoWebSite.Model.BetExp> DataTableToList(DataTable dt) { List<SeoWebSite.Model.BetExp> modelList = new List<SeoWebSite.Model.BetExp>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.BetExp model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.BetExp(); if(dt.Rows[n]["id"].ToString()!="") { model.id=int.Parse(dt.Rows[n]["id"].ToString()); } model.data=dt.Rows[n]["data"].ToString(); if(dt.Rows[n]["isexp"].ToString()!="") { if((dt.Rows[n]["isexp"].ToString()=="1")||(dt.Rows[n]["isexp"].ToString().ToLower()=="true")) { model.isexp=true; } else { model.isexp=false; } } model.exp=dt.Rows[n]["exp"].ToString(); modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(SeoWebSite.Model.BetExp model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(SeoWebSite.Model.BetExp model) { dal.Add(model); }
private void ProcessSaveBetExp() { JObject result = new JObject(); JArray rowData = JArray.Parse(Request.Form["row"]); try { JArray errorResults = new JArray(); foreach (JObject row in rowData) { int matchid = int.Parse(row["match_0"].ToString()); if (bll.Exists(matchid)) { BetExp model = new BetExp(); model.id = matchid; model.isexp = true; model.exp = Request.Form["content"]; model.hometeam = (((Newtonsoft.Json.Linq.JValue)(row["match_4"]))).Value.ToString(); model.awayteam = (((Newtonsoft.Json.Linq.JValue)(row["match_7"]))).Value.ToString(); model.homescore = (int)row["match_13"]; model.awayscore = (int)row["match_14"]; int score = model.homescore - model.awayscore; model.asia = float.Parse((((Newtonsoft.Json.Linq.JValue)(row["match_25"]))).Value.ToString()); if (score > 0) { model.victory = 3; } else if (score == 0) { model.victory = 1; } else { model.victory = 0; } if (score > model.asia) { model.win = 3; } else if (score == model.asia) { model.win = 1; } else { model.win = 0; } bll.Update(model); } else { JObject o = new JObject(); o.Add("error" ,row["match_4"].ToString() + "-" + row["match_7"].ToString()); errorResults.Add(o); } } result.Add("success", true); result.Add("errorData", errorResults); } catch (Exception e) { result.Add("success", false); result.Add("error", e.ToString()); } JsonStr = result.ToString(); }