/// <summary> /// 取得用户口头答辩成绩 /// 返回-1表示没有该生对应的口头答辩成绩 /// </summary> public float GetUser_CommentScore(long userid) { var relation_model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + userid + " and Accept_state=1"); if (relation_model == null) { return(-1); } var comment_model = new BLL.CCOM.Comment().GetModel(" Topic_relation_id=" + relation_model.Topic_relation_id); if (comment_model == null) { return(-1); } if (comment_model.Reply_score == null) { return(-1); } int score = (int)comment_model.Reply_score; int number = 1; var reply_students = new BLL.CCOM.Reply_student().GetModelList(" User_id=" + userid); foreach (var reply_student in reply_students) { long group_id = reply_student.Group_id; if (new BLL.CCOM.Reply_group().GetModel(group_id).Group_type == 0)//筛选出口头答辩组 { var mark_scores = new BLL.CCOM.Mark_table().GetModelList(" Rs_id=" + reply_student.Rs_id); foreach (var mark_score in mark_scores) { if (mark_score.Score != null) { score += (int)mark_score.Score; number++; } } } } return(score / number); }
private string DoAction() { var group_model = new BLL.CCOM.Reply_group().GetModel(" Group_id=" + Group_id); //var leader_model = new BLL.CCOM.View_User().GetModel(" User_id=" + group_model.User_id); string score = this.txtScore.Value; if (GetAdminInfo_CCOM().User_id != group_model.User_id) { if (score == "") { return("请添加给定的成绩"); } int sc = int.Parse(score); var student_model = new BLL.CCOM.Reply_student().GetModel(" Group_id=" + Group_id + "and User_id=" + UserID); var comment_model = new BLL.CCOM.Reply_commission().GetModel(" Group_id=" + Group_id + "and User_id=" + GetAdminInfo_CCOM().User_id); var mark_model = new BLL.CCOM.Mark_table().GetModel(" Rs_id=" + student_model.Rs_id + " and Rc_id=" + comment_model.Rc_id); if (mark_model != null) { mark_model.Score = sc; mark_model.Mark_date = DateTime.Now; if (!new BLL.CCOM.Mark_table().Update(mark_model)) { return("更新成绩异常"); } } else { Model.CCOM.Mark_table mk_model = new Model.CCOM.Mark_table(); mk_model.Rc_id = comment_model.Rc_id; mk_model.Rs_id = student_model.Rs_id; mk_model.Score = sc; mk_model.Mark_date = DateTime.Now; if (new BLL.CCOM.Mark_table().Add(mk_model) == 0) { return("添加成绩异常"); } } } else { string problem = this.txtProblem.InnerText; string comment = this.txtReviewComment.InnerText; if (problem == "") { return("请添加答辩中提出的主要问题及回答的简要情况"); } if (comment == "") { return("请添加答辩委员会(小组)的评语"); } if (score == "") { return("请添加给定的成绩"); } int sc = int.Parse(score); long Topic_relation_id = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + UserID).Topic_relation_id; var comment_model = new BLL.CCOM.Comment().GetModel(" Topic_relation_id=" + Topic_relation_id); if (comment_model != null) { comment_model.problem = problem; comment_model.Comment_content = comment; comment_model.Reply_score = sc; if (!new BLL.CCOM.Comment().Update(comment_model)) { return("更新评语异常"); } } else { Model.CCOM.Comment com_model = new Model.CCOM.Comment(); com_model.problem = problem; com_model.Comment_content = comment; com_model.Reply_score = sc; com_model.Topic_relation_id = Topic_relation_id; if (new BLL.CCOM.Comment().Add(com_model) == 0) { return("添加评语异常"); } } } return(""); }