Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Sys.Model.OrderComment> DataTableToList(DataTable dt)
        {
            List <Sys.Model.OrderComment> modelList = new List <Sys.Model.OrderComment>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Sys.Model.OrderComment model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Sys.Model.OrderComment();
                    if (dt.Rows[n]["CommentId"] != null && dt.Rows[n]["CommentId"].ToString() != "")
                    {
                        model.CommentId = int.Parse(dt.Rows[n]["CommentId"].ToString());
                    }
                    if (dt.Rows[n]["OrderId"] != null && dt.Rows[n]["OrderId"].ToString() != "")
                    {
                        model.OrderId = int.Parse(dt.Rows[n]["OrderId"].ToString());
                    }
                    if (dt.Rows[n]["StarLevel"] != null && dt.Rows[n]["StarLevel"].ToString() != "")
                    {
                        model.StarLevel = dt.Rows[n]["StarLevel"].ToString();
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
                    if (dt.Rows[n]["CreateUserId"] != null && dt.Rows[n]["CreateUserId"].ToString() != "")
                    {
                        model.CreateUserId = dt.Rows[n]["CreateUserId"].ToString();
                    }
                    if (dt.Rows[n]["CreateDate"] != null && dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Sys.Model.OrderComment model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Sys.Model.OrderComment model)
 {
     return(dal.Add(model));
 }