Esempio n. 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <returns>Advertise集合</returns>
        public List <ClassLibrary.Model.Advertise> GetModelList(string strWhere)
        {
            DataTable dt = GetData(strWhere);
            List <ClassLibrary.Model.Advertise> modelList = new List <ClassLibrary.Model.Advertise>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ClassLibrary.Model.Advertise model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ClassLibrary.Model.Advertise();
                    if (dt.Rows[n]["ID"] != DBNull.Value)
                    {
                        model.ID = Convert.ToInt32(dt.Rows[n]["ID"]);
                    }
                    if (dt.Rows[n]["positionID"] != DBNull.Value)
                    {
                        model.positionID = Convert.ToInt32(dt.Rows[n]["positionID"]);
                    }
                    if (dt.Rows[n]["Img"] != DBNull.Value)
                    {
                        model.Img = Convert.ToString(dt.Rows[n]["Img"]);
                    }
                    if (dt.Rows[n]["Title"] != DBNull.Value)
                    {
                        model.Title = Convert.ToString(dt.Rows[n]["Title"]);
                    }
                    if (dt.Rows[n]["LinkURL"] != DBNull.Value)
                    {
                        model.LinkURL = Convert.ToString(dt.Rows[n]["LinkURL"]);
                    }
                    if (dt.Rows[n]["CreatedTime"] != DBNull.Value)
                    {
                        model.CreatedTime = Convert.ToDateTime(dt.Rows[n]["CreatedTime"]);
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 public int Add(ClassLibrary.Model.Advertise model)
 {
     return(dal.Add(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 /// <returns>影响行数</returns>
 public int Update(ClassLibrary.Model.Advertise model)
 {
     return(dal.Update(model));
 }