/// <summary> /// ��������б� /// </summary> public List<SeoWebSite.Model.Schedule> DataTableToList(DataTable dt) { List<SeoWebSite.Model.Schedule> modelList = new List<SeoWebSite.Model.Schedule>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.Schedule model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.Schedule(); if(dt.Rows[n]["id"].ToString()!="") { model.id=int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["sclassid"].ToString() != "") { model.sclassid = int.Parse(dt.Rows[n]["sclassid"].ToString()); } model.data=dt.Rows[n]["Data"].ToString(); if(dt.Rows[n]["Date"].ToString()!="") { model.date=DateTime.Parse(dt.Rows[n]["Date"].ToString()); } modelList.Add(model); } } return modelList; }
/// <summary> /// 获得数据列表 /// </summary> public List <SeoWebSite.Model.Schedule> DataTableToList(DataTable dt) { List <SeoWebSite.Model.Schedule> modelList = new List <SeoWebSite.Model.Schedule>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.Schedule model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.Schedule(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["sclassid"].ToString() != "") { model.sclassid = int.Parse(dt.Rows[n]["sclassid"].ToString()); } model.data = dt.Rows[n]["Data"].ToString(); if (dt.Rows[n]["Date"].ToString() != "") { model.date = DateTime.Parse(dt.Rows[n]["Date"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 获得数据列表 /// </summary> public List <SeoWebSite.Model.Schedule> DataTableToList(DataTable dt) { List <SeoWebSite.Model.Schedule> modelList = new List <SeoWebSite.Model.Schedule>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.Schedule model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.Schedule(); 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]["updated"].ToString() != "") { if ((dt.Rows[n]["updated"].ToString() == "1") || (dt.Rows[n]["updated"].ToString().ToLower() == "true")) { model.updated = true; } else { model.updated = false; } } if (dt.Rows[n]["date"].ToString() != "") { model.date = DateTime.Parse(dt.Rows[n]["date"].ToString()); } if (dt.Rows[n]["home"].ToString() != "") { model.home = int.Parse(dt.Rows[n]["home"].ToString()); } if (dt.Rows[n]["away"].ToString() != "") { model.away = int.Parse(dt.Rows[n]["away"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// ��������б� /// </summary> public List<SeoWebSite.Model.Schedule> DataTableToList(DataTable dt) { List<SeoWebSite.Model.Schedule> modelList = new List<SeoWebSite.Model.Schedule>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { SeoWebSite.Model.Schedule model; for (int n = 0; n < rowsCount; n++) { model = new SeoWebSite.Model.Schedule(); 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]["updated"].ToString()!="") { if((dt.Rows[n]["updated"].ToString()=="1")||(dt.Rows[n]["updated"].ToString().ToLower()=="true")) { model.updated=true; } else { model.updated=false; } } if(dt.Rows[n]["date"].ToString()!="") { model.date=DateTime.Parse(dt.Rows[n]["date"].ToString()); } if(dt.Rows[n]["home"].ToString()!="") { model.home=int.Parse(dt.Rows[n]["home"].ToString()); } if(dt.Rows[n]["away"].ToString()!="") { model.away=int.Parse(dt.Rows[n]["away"].ToString()); } modelList.Add(model); } } return modelList; }
private void updateSchedules() { SeoWebSite.BLL.ScheduleClassBLL scheduleClassBLL = new SeoWebSite.BLL.ScheduleClassBLL(); SeoWebSite.BLL.CountryClassBLL countryClassBLL = new SeoWebSite.BLL.CountryClassBLL(); try { if (Request["schedulelist"] != null && Request["sclasslist"] != null && Request["cclasslist"] != null && Request["date"] != null) { string[] scheduleList = HttpUtility.HtmlDecode(Request.Form["schedulelist"]).Split('^'); string[] sclasslist = HttpUtility.HtmlDecode(Request.Form["sclasslist"]).Split('^'); string[] cclasslist = HttpUtility.HtmlDecode(Request.Form["cclasslist"]).Split('^'); string date = Request.Form["date"]; foreach (string item in scheduleList) { string[] schedule = item.Split(','); if (schedule.Length > 1 && !scheduleBLL.Exists(int.Parse(schedule[0])) && schedule[12] == "-1") { SeoWebSite.Model.Schedule model = new SeoWebSite.Model.Schedule(); model.id = int.Parse(schedule[0]); model.data = item; model.date = DateTime.Parse(date); model.updated = false; model.h_teamid = int.Parse(schedule[2]); model.g_teamid = int.Parse(schedule[3]); if (string.IsNullOrEmpty(schedule[13]) || string.IsNullOrEmpty(schedule[14]) || string.IsNullOrEmpty(schedule[15]) || string.IsNullOrEmpty(schedule[16]) || string.IsNullOrEmpty(schedule[1])) { continue; } model.home = int.Parse(schedule[13]); model.away = int.Parse(schedule[14]); model.halfhome = int.Parse(schedule[15]); model.halfaway = int.Parse(schedule[16]); model.sclassid = int.Parse(sclasslist[int.Parse(schedule[1])].Split(',')[0]); scheduleBLL.Add(model); } } foreach (string item in sclasslist) { string[] sclass = item.Split(','); if (sclass.Length > 1 && !scheduleClassBLL.Exists(int.Parse(sclass[0]))) { SeoWebSite.Model.ScheduleClass model = new SeoWebSite.Model.ScheduleClass(); model.id = int.Parse(sclass[0]); model.name = sclass[1]; model.data = item; model.cclassid = Convert.ToInt32(sclass[9]); scheduleClassBLL.Add(model); } } foreach (string item in cclasslist) { string[] cclass = item.Split(','); if (cclass.Length > 1 && !countryClassBLL.Exists(int.Parse(cclass[0]))) { SeoWebSite.Model.CountryClass model = new SeoWebSite.Model.CountryClass(); model.id = int.Parse(cclass[0]); model.data = item; countryClassBLL.Add(model); } } JsonStr = "{success:true }"; } else { JsonStr = "{success:false,error:'更新失败!'}"; } } catch (Exception e) { JsonStr = "{success:false,message:\"" + e.Message + "\"}"; } }
private void updateSchedules() { SeoWebSite.BLL.ScheduleClassBLL scheduleClassBLL = new SeoWebSite.BLL.ScheduleClassBLL(); SeoWebSite.BLL.CountryClassBLL countryClassBLL = new SeoWebSite.BLL.CountryClassBLL(); try { if (Request["schedulelist"] != null && Request["sclasslist"] != null && Request["cclasslist"] != null && Request["date"] != null) { string[] scheduleList = HttpUtility.HtmlDecode(Request.Form["schedulelist"]).Split('^'); string[] sclasslist = HttpUtility.HtmlDecode(Request.Form["sclasslist"]).Split('^'); string[] cclasslist = HttpUtility.HtmlDecode(Request.Form["cclasslist"]).Split('^'); string date = Request.Form["date"]; foreach (string item in scheduleList) { string[] schedule = item.Split(','); if (schedule.Length>1 && !scheduleBLL.Exists(int.Parse(schedule[0])) && schedule[12] == "-1") { SeoWebSite.Model.Schedule model = new SeoWebSite.Model.Schedule(); model.id = int.Parse(schedule[0]); model.data = item; model.date = DateTime.Parse(date); model.updated = false; model.h_teamid = int.Parse(schedule[2]); model.g_teamid = int.Parse(schedule[3]); if (string.IsNullOrEmpty(schedule[13]) || string.IsNullOrEmpty(schedule[14]) || string.IsNullOrEmpty(schedule[15]) || string.IsNullOrEmpty(schedule[16]) || string.IsNullOrEmpty(schedule[1])) { continue; } model.home = int.Parse(schedule[13]); model.away = int.Parse(schedule[14]); model.halfhome = int.Parse(schedule[15]); model.halfaway = int.Parse(schedule[16]); model.sclassid = int.Parse(sclasslist[int.Parse(schedule[1])].Split(',')[0]); scheduleBLL.Add(model); } } foreach (string item in sclasslist) { string[] sclass = item.Split(','); if (sclass.Length > 1 && !scheduleClassBLL.Exists(int.Parse(sclass[0]))) { SeoWebSite.Model.ScheduleClass model = new SeoWebSite.Model.ScheduleClass(); model.id = int.Parse(sclass[0]); model.name = sclass[1]; model.data = item; model.cclassid = Convert.ToInt32(sclass[9]); scheduleClassBLL.Add(model); } } foreach (string item in cclasslist) { string[] cclass = item.Split(','); if (cclass.Length > 1 && !countryClassBLL.Exists(int.Parse(cclass[0]))) { SeoWebSite.Model.CountryClass model = new SeoWebSite.Model.CountryClass(); model.id = int.Parse(cclass[0]); model.data = item; countryClassBLL.Add(model); } } JsonStr = "{success:true }"; } else { JsonStr = "{success:false,error:'更新失败!'}"; } } catch (Exception e) { JsonStr = "{success:false,message:\"" + e.Message + "\"}"; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SeoWebSite.Model.Schedule model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(SeoWebSite.Model.Schedule model) { dal.Add(model); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(SeoWebSite.Model.Schedule model) { dal.Update(model); }