Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <SeoWebSite.Model.ForecastScripts> DataTableToList(DataTable dt)
        {
            List <SeoWebSite.Model.ForecastScripts> modelList = new List <SeoWebSite.Model.ForecastScripts>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                SeoWebSite.Model.ForecastScripts model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new SeoWebSite.Model.ForecastScripts();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.name    = dt.Rows[n]["name"].ToString();
                    model.content = dt.Rows[n]["content"].ToString();
                    model.remark  = dt.Rows[n]["remark"].ToString();
                    if (dt.Rows[n]["win"].ToString() != "")
                    {
                        model.win = int.Parse(dt.Rows[n]["win"].ToString());
                    }
                    if (dt.Rows[n]["lost"].ToString() != "")
                    {
                        model.lost = int.Parse(dt.Rows[n]["lost"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<SeoWebSite.Model.ForecastScripts> DataTableToList(DataTable dt)
 {
     List<SeoWebSite.Model.ForecastScripts> modelList = new List<SeoWebSite.Model.ForecastScripts>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         SeoWebSite.Model.ForecastScripts model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new SeoWebSite.Model.ForecastScripts();
             if (dt.Rows[n]["id"].ToString() != "")
             {
                 model.id = int.Parse(dt.Rows[n]["id"].ToString());
             }
             model.name = dt.Rows[n]["name"].ToString();
             model.content = dt.Rows[n]["content"].ToString();
             model.remark = dt.Rows[n]["remark"].ToString();
             if (dt.Rows[n]["win"].ToString() != "")
             {
                 model.win = int.Parse(dt.Rows[n]["win"].ToString());
             }
             if (dt.Rows[n]["lost"].ToString() != "")
             {
                 model.lost = int.Parse(dt.Rows[n]["lost"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(SeoWebSite.Model.ForecastScripts model)
 {
     dal.Update(model);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(SeoWebSite.Model.ForecastScripts model)
 {
     return(dal.Add(model));
 }