コード例 #1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("teacher", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;                                             //成功数量
            int errorCount = 0;                                             //失败数量

            BLL.teacher bll     = new BLL.teacher();
            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)
                {
                    var model = bll.GetModel(id);
                    if (!string.IsNullOrEmpty(model.students))
                    {
                        JscriptMsg("导师【" + model.name + "】已经选择学生,无法删除!", "back");
                        return;
                    }

                    BLL.student studentBll    = new BLL.student();
                    var         studentList   = studentBll.GetList(0, " teacher_id!='' and teacher_id is not null", "id asc");
                    var         teacherIdList = new List <string>();
                    foreach (DataRow item in studentList.Rows)
                    {
                        teacherIdList.Add(Utils.ObjectToStr(item["teacher_id"]));
                    }
                    if (teacherIdList.Contains(id.ToString()))
                    {
                        JscriptMsg("导师【" + model.name + "】已经被学生选择,无法删除!", "back");
                        return;
                    }
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除导师资料成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("teacher_list.aspx", "keywords={0}&property={1}",
                                                                                        this.keywords, this.property));
        }
コード例 #2
0
        private void RptBind(string _strWhere, string _orderby)
        {
            BLL.student bll = new BLL.student();
            if (this.action == DTEnums.ActionEnum.Edit.ToString())
            {
                BLL.teacher teacherBll     = new BLL.teacher();
                var         selectStudetns = teacherBll.GetStudentIds(this.id);

                //未选择学生
                this.rptList1.Visible    = true;
                this.rptList1.DataSource = bll.GetList(0, _strWhere + " and (status='' or status is null or status='待导师确认')", _orderby);
                this.rptList1.DataBind();
                btnCancel.Visible = false;
            }
            else
            {
                //已选择学生
                this.rptList2.Visible    = true;
                this.rptList2.DataSource = bll.GetList(0, " id in(select * from dbo.f_split((select students from dt_teacher where id=" + this.id + "),','))", _orderby);
                this.rptList2.DataBind();
                btnSubmit.Visible = false;
                //btnCancel.Visible = true;
            }
        }
コード例 #3
0
ファイル: teacher_print.aspx.cs プロジェクト: ymh007/hyfp
        private void ShowInfo(int teacher_id)
        {
            BLL.teacher bll = new BLL.teacher();
            model      = bll.GetModel(teacher_id);
            adminModel = GetAdminInfo();
            this.rptList.DataSource = bll.GetList(0, "id=" + teacher_id, " name ");
            this.rptList.DataBind();

            BLL.student studentBll = new BLL.student();
            var         students   = bll.GetStudentIds(teacher_id);
            var         strWhere   = "";

            if (!string.IsNullOrEmpty(students))
            {
                strWhere = " id in(select * from dbo.f_split((select students from dt_teacher where id=" + teacher_id + "),','))";
                this.rptList1.DataSource = studentBll.GetList(0, strWhere, "name asc");
                this.rptList1.DataBind();
            }
        }
コード例 #4
0
ファイル: student_list.aspx.cs プロジェクト: ymh007/hyfp
        private void RptBind(string _strWhere, string _orderby)
        {
            Model.manager model = GetAdminInfo();
            labRoleId.Value = model.role_id.ToString();
            string strWhere = "";

            if (model.role_id == 2)
            {
                strWhere = " and no='" + model.user_name + "'";
            }
            this.page = DTRequest.GetQueryInt("page", 1);

            //图表或列表显示
            BLL.student bll = new BLL.student();
            this.rptList1.DataSource = bll.GetList(this.pageSize, this.page, _strWhere + strWhere, _orderby, out this.totalCount);
            this.rptList1.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("student_list.aspx", "property={0}&page={1}",
                                              this.property, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }