示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ROYcms.Sys.Model.ROYcms_Goods_Brand> DataTableToList(DataTable dt)
        {
            List <ROYcms.Sys.Model.ROYcms_Goods_Brand> modelList = new List <ROYcms.Sys.Model.ROYcms_Goods_Brand>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_Goods_Brand model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_Goods_Brand();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[n]["Name"].ToString();
                    }
                    if (dt.Rows[n]["Logo"] != null && dt.Rows[n]["Logo"].ToString() != "")
                    {
                        model.Logo = dt.Rows[n]["Logo"].ToString();
                    }
                    if (dt.Rows[n]["brand_desc"] != null && dt.Rows[n]["brand_desc"].ToString() != "")
                    {
                        model.brand_desc = dt.Rows[n]["brand_desc"].ToString();
                    }
                    if (dt.Rows[n]["site_url"] != null && dt.Rows[n]["site_url"].ToString() != "")
                    {
                        model.site_url = dt.Rows[n]["site_url"].ToString();
                    }
                    if (dt.Rows[n]["sort_order"] != null && dt.Rows[n]["sort_order"].ToString() != "")
                    {
                        model.sort_order = int.Parse(dt.Rows[n]["sort_order"].ToString());
                    }
                    if (dt.Rows[n]["is_show"] != null && dt.Rows[n]["is_show"].ToString() != "")
                    {
                        model.is_show = int.Parse(dt.Rows[n]["is_show"].ToString());
                    }
                    if (dt.Rows[n]["TIME"] != null && dt.Rows[n]["TIME"].ToString() != "")
                    {
                        model.TIME = DateTime.Parse(dt.Rows[n]["TIME"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ROYcms.Sys.Model.ROYcms_Goods_Brand model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ROYcms.Sys.Model.ROYcms_Goods_Brand model)
 {
     return(dal.Add(model));
 }