public List<Model.CComment> getCCommentList() { List<Model.CComment> lst = new List<Model.CComment>(); DataTable dt = DBUtility.SqlHelper.executeTable("select * from CComments", CommandType.Text, null); foreach (DataRow item in dt.Rows) { Model.CComment emp = new Model.CComment() { CCommentID = int.Parse(item[0].ToString()), CinemaID = int.Parse(item[1].ToString()), CommTime = DateTime.Parse(item[4].ToString()), Grade = float.Parse(item[5].ToString()), Comment = item[3].ToString(), UserName = item[2].ToString() }; lst.Add(emp); } return lst; }
/// <summary> /// 增加一条评论 /// </summary> /// <param name="cinemaID">电影院ID</param> /// <param name="userName">用户名</param> /// <param name="comment">评论内容</param> /// <param name="grade">评分</param> /// <returns>成功返回true,否则false</returns> public bool addCComment(int cinemaID, string userName, string comment, float grade) { Model.CComment CComment = new Model.CComment() { CinemaID = cinemaID, UserName = userName, Comment = comment, Grade = grade }; IDAL.ICComment Comment = DALFactory.DataAccess.createDalCComment(); return Comment.addCComment(CComment); }