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

            if (rowsCount > 0)
            {
                ClassLibrary.Model.SaleAdvertise model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ClassLibrary.Model.SaleAdvertise();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.Title        = dt.Rows[n]["Title"].ToString();
                    model.LinkUrl      = dt.Rows[n]["LinkUrl"].ToString();
                    model.Img          = dt.Rows[n]["Img"].ToString();
                    model.RouteClassId = dt.Rows[n]["RouteClassId"].ToString();
                    if (dt.Rows[n]["CreatedTime"].ToString() != "")
                    {
                        model.CreatedTime = DateTime.Parse(dt.Rows[n]["CreatedTime"].ToString());
                    }
                    if (dt.Rows[n]["SaleOrder"].ToString() != "")
                    {
                        model.SaleOrder = int.Parse(dt.Rows[n]["SaleOrder"].ToString());
                    }
                    if (dt.Rows[n]["ExpiredTime"].ToString() != "")
                    {
                        model.ExpiredTime = DateTime.Parse(dt.Rows[n]["ExpiredTime"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ClassLibrary.Model.SaleAdvertise model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ClassLibrary.Model.SaleAdvertise model)
 {
     return(dal.Add(model));
 }