Esempio n. 1
0
 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 + "\"}";
     }
 }
Esempio n. 2
0
 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 + "\"}";
     }
 }