Example #1
0
        //批量撤回
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Model.manager model = GetAdminInfo();
            if (model.role_id == 3)
            {
                ChkAdminLevel("student", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            }
            int sucCount   = 0;                                                 //成功数量
            int errorCount = 0;                                                 //失败数量

            BLL.student bll     = new BLL.student();
            Repeater    rptList = new Repeater();

            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    BLL.teacher teacherBll = new BLL.teacher();
                    var         students   = teacherBll.GetStudents().Tables[0];
                    var         exsitIds   = new List <string>();
                    foreach (DataRow item in students.Rows)
                    {
                        if (item["students"].ToString().Contains(id.ToString()))
                        {
                            exsitIds.Add(id.ToString());
                        }
                    }
                    if (exsitIds.Contains(id.ToString()))
                    {
                        continue;
                    }
                    if (bll.Cancel(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "撤回导师选择成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("撤回导师选择成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("student_list.aspx", "keywords={0}&property={1}",
                                                                                            this.keywords, this.property));
        }
Example #2
0
        //撤回选择导师
        protected void Cancel(int id)
        {
            BLL.student bll = new BLL.student();

            BLL.teacher teacherBll = new BLL.teacher();
            var         students   = teacherBll.GetStudents().Tables[0];
            var         exsitIds   = new List <string>();

            foreach (DataRow item in students.Rows)
            {
                if (item["students"].ToString().Contains(id.ToString()))
                {
                    JscriptMsg("您已被导师选择,无法撤回!", "back");
                    return;
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "撤回导师"); //记录日志
            if (!bll.Cancel(id))
            {
                JscriptMsg("撤回选择导师失败!", string.Empty);
                return;
            }
            JscriptMsg("撤回选择导师成功!", string.Empty);
        }