コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Model.channel_category> DataTableToList(DataTable dt)
        {
            List <Model.channel_category> modelList = new List <WechatBuilder.Model.channel_category>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Model.channel_category model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new WechatBuilder.Model.channel_category();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.title      = dt.Rows[n]["title"].ToString();
                    model.build_path = dt.Rows[n]["build_path"].ToString();
                    model.domain     = dt.Rows[n]["domain"].ToString();
                    if (dt.Rows[n]["is_default"].ToString() != "")
                    {
                        model.is_default = int.Parse(dt.Rows[n]["is_default"].ToString());
                    }
                    if (dt.Rows[n]["sort_id"].ToString() != "")
                    {
                        model.sort_id = int.Parse(dt.Rows[n]["sort_id"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Model.channel_category> DataTableToList(DataTable dt)
 {
     List<Model.channel_category> modelList = new List<WechatBuilder.Model.channel_category>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Model.channel_category model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new WechatBuilder.Model.channel_category();
             if (dt.Rows[n]["id"].ToString() != "")
             {
                 model.id = int.Parse(dt.Rows[n]["id"].ToString());
             }
             model.title = dt.Rows[n]["title"].ToString();
             model.build_path = dt.Rows[n]["build_path"].ToString();
             model.domain = dt.Rows[n]["domain"].ToString();
             if (dt.Rows[n]["is_default"].ToString() != "")
             {
                 model.is_default = int.Parse(dt.Rows[n]["is_default"].ToString());
             }
             if (dt.Rows[n]["sort_id"].ToString() != "")
             {
                 model.sort_id = int.Parse(dt.Rows[n]["sort_id"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }