public ReturnState RemoveComment(CourseCommentView model)
        {
            ReturnState result;

            courseCommentClient.RemoveComment(model, out result, out specify);
            return(result);
        }
Exemple #2
0
        public static List <CourseCommentView> GetCourseCommentListByCode(string code)
        {
            var ret = new List <CourseCommentView>();

            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();
                var cmdText = string.Format("select Code, Email, cDate, Content, CmtFloor, Id from CourseCommentSets where Code = N'{0}' order by CmtFloor DESC", code);
                using (var cmd = new SqlCommand(cmdText, conn))
                {
                    var reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        var comment = new CourseCommentView()
                        {
                            Code    = Convert.ToString(reader.GetValue(0)),
                            Email   = Convert.ToString(reader.GetValue(1)),
                            PubDate = Convert.ToDateTime(reader.GetValue(2)),
                            Content = Convert.ToString(reader.GetValue(3)),
                            Floor   = Convert.ToInt32(reader.GetValue(4)),
                            Id      = Convert.ToInt32(reader.GetValue(5))
                        };
                        ret.Add(comment);
                    }
                }
            }

            return(ret);
        }
Exemple #3
0
        public ReturnState AddComment(CourseCommentView model)
        {
            var filters = new UtilityService().GetFilterLisst();

            model.Content = Utilities.Filter(model.Content, filters);
            return(CourseCommentOperator.AddCourseComment(model) ? ReturnState.ReturnOK : ReturnState.ReturnError);
        }
Exemple #4
0
        public static bool AddCourseComment(CourseCommentView model)
        {
            var result = false;

            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();
                var cmdText = string.Format("insert into CourseCommentSets values (N'{0}', N'{1}' , '{2}', N'{3}', {4})", model.Code, model.Email, DateTime.Now, model.Content, model.Floor);
                using (var cmd = new SqlCommand(cmdText, conn))
                {
                    result = cmd.ExecuteNonQuery() > 0;
                    conn.Close();
                }
            }
            return(result);
        }
Exemple #5
0
        public static bool RemoveCourseComment(CourseCommentView model)
        {
            var result = false;

            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();
                var cmdText = string.Format("delete from CourseCommentSets where Code = N'{0}' and Email = N'{1}' and cDate = '{2}'", model.Code, model.Email, model.PubDate);
                using (var cmd = new SqlCommand(cmdText, conn))
                {
                    result = cmd.ExecuteNonQuery() > 0;
                    conn.Close();
                }
            }

            return(result);
        }
Exemple #6
0
 public ReturnState RemoveComment(CourseCommentView model)
 {
     return(CourseCommentOperator.RemoveCourseComment(model) ? ReturnState.ReturnOK : ReturnState.ReturnError);
 }