コード例 #1
0
        public void PostClassComment(string classId, string accountId, string content)
        {
            ClassComment comment = EntityFactory.CreateClassComment(classId, accountId, content);

            m_classCommentRepository.Insert(comment);
            m_classCommentRepository.SaveChanges();
        }
コード例 #2
0
 public override String GetText()
 {
     //imports
     if (Imports.Any())
     {
         Template = Template.Replace(importToken, Imports.Select(x => x.GetText()).Aggregate((a, b) => a + "\r\n" + b));
     }
     //comments
     if (HeaderComment != null)
     {
         Template = Template.Replace(headerCommentToken, HeaderComment.GetText());
     }
     if (ClassComment != null)
     {
         Template = Template.Replace(classCommentToken, ClassComment.GetText());
     }
     if (HttpHeaderFunctionComment != null)
     {
         Template = Template.Replace(httpHeaderFunctionCommentToken, HttpHeaderFunctionComment.GetText());
     }
     if (ConstructorComment != null)
     {
         Template = Template.Replace(constructorCommentToken, ConstructorComment.GetText());
     }
     if (Extends != null)
     {
         Template = Template.Replace(extendsToken, $" extends {Extends}");
     }
     if (ConstructorParamters.Any())
     {
         Template = Template.Replace(ConstructorParamterTag, ConstructorParamters.Aggregate((a, b) => a + "," + b));
     }
     //class name
     Template = Template.Replace(classNameToken, Name);
     //Properties
     if (jsProperties.Any())
     {
         Template = Template.Replace(PropertiesToken, jsProperties.Select(x => x.GetText()).Aggregate((a, b) => a + "\r\n" + b));
     }
     //Methods
     if (Methods.Any())
     {
         Template = Template.Replace(MethodToken, Methods.Select(x => x.GetText()).Aggregate((a, b) => a + "\r\n" + b));
     }
     //Exports
     if (this.Export != null)
     {
         Template = Template.Replace(ExportToken, this.Export.GetText());
     }
     //remove unusedTokens
     CleanTemplateUp();
     return(Template);
 }
コード例 #3
0
        /// <summary>
        /// 添加评价
        /// </summary>
        /// <param name="classComment"></param>
        /// <returns></returns>
        public ActionResult CreateClassComment(ClassComment classComment)
        {
            classComment.MemberId   = member.Id.ToString();
            classComment.CreateTime = DateTime.Now;
            bool isPublicCourse = classComment.CommentType >= 100;

            try
            {
                if (member.Type != 1)
                {
                    classComment.TeacherId = memberService.GetTeacherByMemberId(member.Id).TeacherId;
                }
            }
            catch (Exception ex)
            {
            }
            classComment.CommentType = member.Type == 1 ? 0 : 1;
            return(Json(memberService.CreateClassComment(classComment, isPublicCourse)));
        }
コード例 #4
0
        public Response <bool> CreateClassComment(ClassComment classComment, bool isPublicCourse)
        {
            var res = new Response <bool>();

            try
            {
                if (isPublicCourse)
                {
                    classComment.CplId     = 0;
                    classComment.TeacherId = classDao.GetClassModels("SELECT TeacherId FROM OpenClass WHERE OpenClassId=@0", classComment.ClassId).First().TeacherId;
                }
                else if (classComment.CommentType == 0)
                {
                    classComment.TeacherId = classDao.GetClassModels("SELECT TeacherId FROM ClassPlanLesson WHERE CplId=@0", classComment.CplId).First().TeacherId;
                }
                classCommentDao.Insert(classComment, "TeacherId", "CommentType", "Content", "ClassId", "CplId", "Rate1", "Rate2", "Rate3", "MemberId", "CreateTime");
            }
            catch (Exception ex)
            {
                res.ErrMsg = "添加评价失败!";
            }
            return(res);
        }