protected string BatchRemoveStudent() { JsonData data = new JsonData(); string Group_id = MyRequest.GetString("GroupID"); string value = MyRequest.GetString("StudentID"); string msg = ""; if (Tools.CheckParams(Group_id + value)) { msg = "传输异常,存在非法字符!"; } else if (value == "") { msg = "参数异常!"; } else { try { value = Utils.DelLastComma(value); string[] list = value.Split(','); foreach (var tmp in list) { long userid = long.Parse(tmp); int groupid = int.Parse(Group_id); BLL.CCOM.Reply_student bll = new BLL.CCOM.Reply_student(); Model.CCOM.Reply_student model = bll.GetModel(" Group_id=" + groupid + " and User_id=" + userid); if (msg == "") { if (model == null) { continue; } else { if (!bll.Delete(model.Rs_id)) { msg = "移除失败"; } } } } } catch (Exception) { msg = "移除发生异常!"; } } if (msg == "") { data["msg"] = "移除成功"; data["code"] = 1; } else { data["msg"] = msg; data["code"] = 0; } return(data.ToJson()); }
protected string RemoveStudent() { JsonData data = new JsonData(); string Group_id = MyRequest.GetString("GroupID"); string User_id = MyRequest.GetString("StudentID"); string msg = ""; if (Tools.CheckParams(Group_id + User_id)) { msg = "传输异常,存在非法字符!"; } else { try { long userid = long.Parse(User_id); int groupid = int.Parse(Group_id); BLL.CCOM.Reply_student bll = new BLL.CCOM.Reply_student(); Model.CCOM.Reply_student model = bll.GetModel(" Group_id=" + groupid + " and User_id=" + userid); if (msg == "") { if (model == null) { msg = "学生不在该答辩组中"; } else { if (!bll.Delete(model.Rs_id)) { msg = "移除失败"; } } } } catch (Exception) { msg = "移除发生异常!"; } } if (msg == "") { data["msg"] = "移除成功"; data["code"] = 1; } else { data["msg"] = msg; data["code"] = 0; } return(data.ToJson()); }
protected string AddStudent() { JsonData data = new JsonData(); string Group_id = MyRequest.GetString("GroupID"); string User_id = MyRequest.GetString("StudentID"); string msg = ""; if (Tools.CheckParams(Group_id + User_id)) { msg = "传输异常,存在非法字符!"; } else { try { long userid = long.Parse(User_id); long groupid = long.Parse(Group_id); //判断学生是否已经选题 var topic_model = new BLL.CCOM.Topic_relation().GetModel(" Student_id=" + userid + " and Accept_state=1"); if (topic_model == null) { msg = "该同学尚未选择毕设题目!"; } BLL.CCOM.Reply_student bll = new BLL.CCOM.Reply_student(); Model.CCOM.Reply_student model = bll.GetModel(" Group_id=" + groupid + " and User_id=" + userid); if (msg == "") { if (model != null) { msg = "学生已在该答辩组中"; } else { bool isIn = true; var student_models = new BLL.CCOM.Reply_student().GetModelList(" User_id=" + User_id); var group_model = new BLL.CCOM.Reply_group().GetModel(long.Parse(Group_id)); Model.CCOM.Reply_group other_model = null;; foreach (Model.CCOM.Reply_student student_model in student_models) { if (new BLL.CCOM.Reply_group().GetModel(student_model.Group_id).Group_type.Equals(group_model.Group_type)) { isIn = false; other_model = new BLL.CCOM.Reply_group().GetModel(student_model.Group_id); break; } } if (isIn) { model = new Model.CCOM.Reply_student(); model.Group_id = groupid; model.User_id = userid; if (bll.Add(model) <= 0) { msg = "添加失败"; } } else { string name = new BLL.CCOM.User_information().GetModel(userid).User_realname; msg = "学生" + name + "已在" + other_model.Group_name + "答辩组中"; } } } } catch (Exception) { msg = "添加发生异常!"; } } if (msg == "") { data["msg"] = "添加成功"; data["code"] = 1; } else { data["msg"] = msg; data["code"] = 0; } return(data.ToJson()); }