Пример #1
0
        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());
        }
Пример #2
0
        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());
        }