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

            if (rowsCount > 0)
            {
                ClassLibrary.Model.RouteComment model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ClassLibrary.Model.RouteComment();
                    if (dt.Rows[n]["ID"] != DBNull.Value)
                    {
                        model.ID = Convert.ToInt32(dt.Rows[n]["ID"]);
                    }
                    if (dt.Rows[n]["UserName"] != DBNull.Value)
                    {
                        model.UserName = Convert.ToString(dt.Rows[n]["UserName"]);
                    }
                    if (dt.Rows[n]["Nickname"] != DBNull.Value)
                    {
                        model.Nickname = Convert.ToString(dt.Rows[n]["Nickname"]);
                    }
                    if (dt.Rows[n]["Anonymous"] != DBNull.Value)
                    {
                        model.Anonymous = Convert.ToBoolean(dt.Rows[n]["Anonymous"]);
                    }
                    if (dt.Rows[n]["routeID"] != DBNull.Value)
                    {
                        model.routeID = Convert.ToInt32(dt.Rows[n]["routeID"]);
                    }
                    if (dt.Rows[n]["Grade"] != DBNull.Value)
                    {
                        model.Grade = Convert.ToByte(dt.Rows[n]["Grade"]);
                    }
                    if (dt.Rows[n]["Email"] != DBNull.Value)
                    {
                        model.Email = Convert.ToString(dt.Rows[n]["Email"]);
                    }
                    if (dt.Rows[n]["Content"] != DBNull.Value)
                    {
                        model.Content = Convert.ToString(dt.Rows[n]["Content"]);
                    }
                    if (dt.Rows[n]["Checked"] != DBNull.Value)
                    {
                        model.Checked = Convert.ToBoolean(dt.Rows[n]["Checked"]);
                    }
                    if (dt.Rows[n]["CreatedTime"] != DBNull.Value)
                    {
                        model.CreatedTime = Convert.ToDateTime(dt.Rows[n]["CreatedTime"]);
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 public int Add(ClassLibrary.Model.RouteComment model)
 {
     return(dal.Add(model));
 }
Beispiel #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">model对象</param>
 /// <returns>影响行数</returns>
 public int Update(ClassLibrary.Model.RouteComment model)
 {
     return(dal.Update(model));
 }