Пример #1
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<SeoWebSite.Model.ScheduleClass> DataTableToList(DataTable dt)
 {
     List<SeoWebSite.Model.ScheduleClass> modelList = new List<SeoWebSite.Model.ScheduleClass>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         SeoWebSite.Model.ScheduleClass model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new SeoWebSite.Model.ScheduleClass();
             if(dt.Rows[n]["id"].ToString()!="")
             {
                 model.id=int.Parse(dt.Rows[n]["id"].ToString());
             }
             model.name=dt.Rows[n]["name"].ToString();
             model.data=dt.Rows[n]["data"].ToString();
             modelList.Add(model);
         }
     }
     return modelList;
 }
Пример #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <SeoWebSite.Model.ScheduleClass> DataTableToList(DataTable dt)
        {
            List <SeoWebSite.Model.ScheduleClass> modelList = new List <SeoWebSite.Model.ScheduleClass>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                SeoWebSite.Model.ScheduleClass model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new SeoWebSite.Model.ScheduleClass();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.name = dt.Rows[n]["name"].ToString();
                    model.data = dt.Rows[n]["data"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #3
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 + "\"}";
     }
 }
Пример #4
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 + "\"}";
     }
 }
Пример #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(SeoWebSite.Model.ScheduleClass model)
 {
     return(dal.Update(model));
 }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(SeoWebSite.Model.ScheduleClass model)
 {
     dal.Add(model);
 }