protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.fileUploadUrl.FileName.Trim()=="")
        {
            Javascript.GoHistory(-1, "请选择本地Excel文件!", Page);
        }
        else
        {
            fileUploadUrl.SaveAs(Server.MapPath("/" + fileUploadUrl.FileName));//暂时保存要导入的Excel
            DalOperationUsers dos = new DalOperationUsers();

            //从绝对路径Excel文件中读取数据,保存在DataSet
            DataSet ds = dos.ExcelToDS(Server.MapPath("/" + fileUploadUrl.FileName), "考试安排");
            int count = 0;
            try
            {
                count = dos.DataTabletoDBTables(ds.Tables["sheetTable"], "考试安排");
            }
            catch (Exception ex)
            {
               MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "导入失败,错误提示:1.有空项 2.非Excel文件 3.重复插入.请按指定格式上传!", Page);
            }

            File.Delete(Server.MapPath("/" + fileUploadUrl.FileName));//导入完成后删除Excel
            Javascript.AlertAndRedirect("考试安排导入成功,共插入记录" + count.ToString() + "条!", "/Administrator/ImportExamExcelData.aspx", Page);

        }
    }
    //绑定考试安排信息到DataList
    public void DataListBind()
    {
        DalOperationUsers dos = new DalOperationUsers();
        DataView dv = dos.FindExamArrange().Tables[0].DefaultView;

        this.dlCourse.DataSource = dv;
        this.dlCourse.DataBind();
    }
    protected void dlCourse_ItemCommand(object source, DataListCommandEventArgs e)
    {
        DalOperationUsers dos = new DalOperationUsers();

        if (e.CommandName == "delete")
        {
            int examArrangeListId =int.Parse( dlCourse.DataKeys[e.Item.ItemIndex].ToString());//取选中行编号
            dos.DeleteExamArrangeById(examArrangeListId);
            Javascript.AlertAndRedirect("删除成功!", "/Administrator/ImportExamExcelData.aspx", Page);
        }
    }
示例#4
0
 public void PageDataBind()
 {
     DalOperationUsers dou = new DalOperationUsers();
     AssistantsList assistant = dou.FindAssistantByNo(assistantNo);
     if (assistant == null)
     {
         Javascript.AlertAndRedirect("对不起,您要查看的助教不存在!", "/Administrator/AssistantManager.aspx", Page);
     }
     else
     {
         lblName.Text = assistant.assistantName;
         lblOffice.Text = assistant.officeAddress;
         lblEmail.Text = assistant.emailAddress;
         lblRemark.Text = assistant.remark;
     }
 }
示例#5
0
    public void PageDataBind()
    {
        DalOperationUsers dou = new DalOperationUsers();
        TeachersList teacher = dou.FindTeacherByEmail(email);
        if (teacher == null)
        {
            Javascript.Alert("对不起,您要查看的教师不存在!", Page);
        }
        else
        {

            lblName.Text = teacher.teacherName;
            lblOffice.Text = teacher.officeAddress;
            lblEmail.Text = teacher.emailAddress;
            lblRemark.Text = teacher.remark;
        }
    }
示例#6
0
 public void PageDataBind()
 {
     DalOperationUsers dou = new DalOperationUsers();
     TeachersList teacher = dou.FindTeacherByNo(teacherNo);
     if (teacher == null)
     {
         Javascript.AlertAndRedirect("对不起,您要查看的教师不存在!", "/Administrator/TeacherManager.aspx", Page);
     }
     else
     {
         //lblNo.Text = teacher.teacherNo;
         lblName.Text = teacher.teacherName;
         lblOffice.Text = teacher.officeAddress;
         lblEmail.Text = teacher.emailAddress;
         lblRemark.Text = teacher.remark;
     }
 }
示例#7
0
    //绑定用户组下拉列表
    public void DataBindGroupUsers()
    {
        DalOperationUsers dou = new DalOperationUsers();
        DataTable dt = null;
        if (ddlUserGroup.SelectedValue == "3")
        {
            dt = dou.SearchStudentByCourseNo(ddlCourses.SelectedValue.Trim()).Tables[0];
            dt.Columns["studentNo"].ColumnName = "userNo";
            dt.Columns["studentName"].ColumnName = "userName";
        }
        else
        {
            dt = dou.FindUserByTypeAndKeywod(ReturnUserGroup(), "");
        }

        if (dt.Rows.Count > 0)
        {
            EmailCounts.Visible = true;
        }
        else
        {
            EmailCounts.Visible = false;
        }

        this.dlSearchUserGroup.DataSource = dt.DefaultView;
        this.dlSearchUserGroup.DataBind();

        int recordCount = dt.Rows.Count;

        if (recordCount == 0)
        {
            this.dlSearchUserGroup.ShowFooter = true;
        }
        else
        {
            this.dlSearchUserGroup.ShowFooter = false;
        }

        if (dt.Rows.Count > 0)
        {
            ltlSelectAllUser.Text = "<input id=\"dzxBtnSelectAll\" name=\"dzxBtnSelectAll\" type=\"button\" value=\"全选\" onclick=\"selectAll();\" /> ";
        }
    }
示例#8
0
 public void PageDataBind()
 {
     DalOperationUsers dou = new DalOperationUsers();
     StudentsList student = dou.FindStudentByNo(studentNo);
     if (student == null)
     {
         Javascript.AlertAndRedirect("对不起,您要查看的学生不存在!", "/Administrator/StudentManager.aspx", Page);
     }
     else
     {
         lblNo.Text = student.studentNo;
         lblName.Text = student.studentName;
         lblSpeciality.Text = student.studentSpeciality;
         lblClass.Text = student.classNo;
         lblMobileNo.Text = student.mobileNo;
         lblEmail.Text = student.emailAddress;
         lblRemark.Text = student.remark;
     }
 }
示例#9
0
    //绑定搜索到的助教数据
    protected void DataListBind()
    {
        DalOperationUsers dos = new DalOperationUsers();
        DataView dv = dos.SearchUserByTypeAndKeywod(2, txtKeyword.Text.Trim()).DefaultView;

        this.AspNetPager2.RecordCount = dv.Count;

        PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
        pds.DataSource = dv;
        pds.AllowPaging = true;

        pds.CurrentPageIndex = pageIndex - 1;
        pds.PageSize = CommonUtility.pageSize; ;

        this.dlSearchAssistant.DataSource = pds;
        this.dlSearchAssistant.DataBind();

        if (pds.Count > 0)
        {
            this.dlSearchAssistant.ShowFooter = false;
        }
    }
示例#10
0
        //绑定搜索到的教师数据
        protected void TeacherDataListBind()
        {
            DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
            UserAuth auth = dalua.GetUserAuth(pageName);
            if (auth != null)
            {
                string ids = auth.userIds;
                string[] _ids = ids.Split(',');
                for (int i = 0; i < _ids.Length; i++)
                {
                    authIds.Add(_ids[i]);
                }
            }

            DalOperationUsers dal = new DalOperationUsers();

            string keyWord = "";

            if (Request["teacherName"] != null)
            {
                keyWord = Request["teacherName"].Trim();
                this.txtKeyword.Text = keyWord;
            }

            DataView dv = dal.SearchTeacherByTermTagAndKeyword(null, keyWord, 0).DefaultView;

            this.TeacherListPager.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count == 0)
            {
                dlSearchTeacher.ShowFooter = true;
            }
            else
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }
示例#11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="termTag"></param>
        /// <param name="searchKey"></param>
        /// <param name="teacherType"></param>
        /// <returns></returns>
        public DataSet getTeacherLoad(string termTag,string searchKey,string teacherType)
        {
            DataSet ds = new DataSet();
            DataTable datatable = new DataTable();
            DataSet normDs = GetFirstNorms(termTag);
            DataTable dt = normDs.Tables[0];
            int[] ids = new int[dt.Rows.Count];
            datatable.Columns.Add("教师");
            datatable.Columns.Add("硕士教学");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                datatable.Columns.Add(dt.Rows[i]["name"].ToString());
                ids[i] =  Convert.ToInt32( dt.Rows[i]["normId"]);
            }
            datatable.Columns.Add("合计");
            ds.Tables.Add(datatable);
            datatable.TableName = "工作汇总";
            DalOperationUsers daluser = new DalOperationUsers();

            DataTable teachers = daluser.SearchTeacher(searchKey, teacherType).Tables[0];
            DataTable normValues = GetNormValuesByTerm(termTag).Tables[0];
            for (int i = 0; i < teachers.Rows.Count; i++)
            {
                DataRow dr = datatable.NewRow();
                dr.SetField(datatable.Columns[0], teachers.Rows[i]["teacherName"].ToString().Trim());
               DataRow[] shuoshirows =  normValues.Select("normId=-1 and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");
               if (shuoshirows.Length == 0)
               {
                   dr.SetField(datatable.Columns[1], 0);
               }
               else
               {
                   dr.SetField(datatable.Columns[1], shuoshirows[0]["value"]);
               }
                for (int j = 2; j < datatable.Columns.Count - 1; j++)
                {
                    Object value = null;
                    DataRow[] rows = normValues.Select("normId=" + ids[j - 2] + " and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");
                    if (GetNormType(ids[j - 2]) == 0)
                    {
                        if (rows.Length > 0)
                            value = rows[0]["value"];
                        float factValue = 0;
                        if (value != null)
                        {
                            factValue = float.Parse(value.ToString());
                        }
                        dr.SetField(datatable.Columns[j], factValue);
                    }
                    else
                    {
                        if (rows.Length > 0)
                        dr.SetField(datatable.Columns[j], rows[0]["textValue"]);
                    }

                }
                DataRow[] rootrow = normValues.Select("normId=" + 0 + " and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");

                object roots = null;
                if (rootrow.Length > 0)
                    roots = rootrow[0]["value"];
                float rootValue = 0;
                if (roots != null)
                {
                    rootValue = float.Parse(roots.ToString());
                }
                dr.SetField("合计", rootValue);
                datatable.Rows.Add(dr);
            }
            DataTable shuoshitable = new DataTable();
            shuoshitable.TableName = "硕士教学";
            shuoshitable.Columns.Add("教师");
            shuoshitable.Columns.Add("课程名称");
            shuoshitable.Columns.Add("学期");
            shuoshitable.Columns.Add("类型");
            shuoshitable.Columns.Add("理论课时");
            shuoshitable.Columns.Add("实验课时");
            DataTable shuoshinormChildValues = this.GetChildNorms(-1,termTag).Tables[0];

            for (int i = 0; i < shuoshinormChildValues.Rows.Count; i++)
            {
                shuoshitable.Columns.Add(shuoshinormChildValues.Rows[i]["name"].ToString());

            }
            for (int i = 0; i < teachers.Rows.Count; i++)
            {

                DataTable shuoshit = this.GetCourseStatistic(teachers.Rows[i]["teacherNo"].ToString().Trim(), termTag);
                for (int rownum = 0; rownum < shuoshit.Rows.Count; rownum++)
                {
                    DataRow dr = shuoshitable.NewRow();
                    dr.SetField(shuoshitable.Columns[0], teachers.Rows[i]["teacherName"].ToString().Trim());
                    for (int col = 3; col < shuoshit.Columns.Count; col++)
                    {
                        dr.SetField(shuoshit.Columns[col].ColumnName, shuoshit.Rows[rownum][shuoshit.Columns[col]].ToString().Trim());
                    }
                    shuoshitable.Rows.Add(dr);

                }

            }
            ds.Tables.Add(shuoshitable);

            for (int ci = 0; ci < dt.Rows.Count; ci++)
            {
                DataTable childTable = new DataTable();
                childTable.TableName = dt.Rows[ci]["name"].ToString();
                DataTable normChildValues = this.GetChildNorms(int.Parse(dt.Rows[ci]["normId"].ToString()),termTag).Tables[0];
                int[] dids = new int[normChildValues.Rows.Count];
                childTable.Columns.Add("教师");
                for (int i = 0; i < normChildValues.Rows.Count; i++)
                {
                    childTable.Columns.Add(normChildValues.Rows[i]["name"].ToString());
                    dids[i] = Convert.ToInt32(normChildValues.Rows[i]["normId"]);
                }
                for (int i = 0; i < teachers.Rows.Count; i++)
                {
                    DataRow dr = childTable.NewRow();
                    dr.SetField(childTable.Columns[0], teachers.Rows[i]["teacherName"].ToString().Trim());
                    for (int j = 1; j < childTable.Columns.Count; j++)
                    {
                        Object value = null;
                        DataRow[] rows = normValues.Select("normId=" + dids[j - 1] + " and teacherNo='" + teachers.Rows[i]["teacherNo"].ToString().Trim() + "'");
                        if (GetNormType(dids[j - 1]) == 0)
                        {
                            if (rows.Length > 0)
                                value = rows[0]["value"];
                            float factValue = 0;
                            if (value != null)
                            {
                                factValue = float.Parse(value.ToString());
                            }
                            dr.SetField(childTable.Columns[j], factValue);
                        }
                        else
                        {
                            if (rows.Length > 0)
                                dr.SetField(childTable.Columns[j], rows[0]["textValue"]);
                        }
                    }
                    childTable.Rows.Add(dr);
                }

                ds.Tables.Add(childTable);
            }
            conn.Close();
            return ds;
        }
示例#12
0
        //绑定搜索到的教师数据
        protected void DataListBind()
        {
            DalOperationUsers dos = new DalOperationUsers();
            DataView dv = dos.SearchTeacher(txtKeyword.Text.Trim(), ddltTeacherType.SelectedValue).Tables[0].DefaultView;
            this.AspNetPager2.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count > 0)
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }
示例#13
0
    //搜索到的学生列表操作
    protected void dlSearchStudent_ItemCommand(object source, DataListCommandEventArgs e)
    {
        DalOperationUsers dos = new DalOperationUsers();

        if (e.CommandName == "delete")
        {
            string studentNo = dlSearchStudent.DataKeys[e.Item.ItemIndex].ToString();//取选中行学生编号

            if (dos.DeleteStudentByNo(studentNo) > 0)
            {
                Javascript.AlertAndRedirect("删除成功!", "/Administrator/StudentManager.aspx?fragment=1&page=" + pageIndex, Page);
            }
            else
            {
                Javascript.GoHistory(-1, "删除失败!", Page);
            }
        }
    }
示例#14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DalOperationAboutAdminNotifyType dalOperationAboutAdminNotifyType = new DalOperationAboutAdminNotifyType();
            DataSet _ds = dalOperationAboutAdminNotifyType.FindAllParentAdminNotifyType();

            string strLi = string.Empty;

            for (int i = 0; i < _ds.Tables[0].Rows.Count; i++)
            {
                strLi += "<li id=\"liFragment" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\" pid=\"" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\"><a href=\"?pid=" + _ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim() + "\"><span>" + _ds.Tables[0].Rows[i]["notifyTypeName"].ToString().Trim() + "</span></a></li>";

                if (i == 0 && notifyTypeParentId == -3)
                {
                    notifyTypeParentId = int.Parse(_ds.Tables[0].Rows[i]["notifyTypeId"].ToString().Trim());
                }
            }

            ltlNotifyTypeParent.Text = strLi;

            if (notifyTypeParentId > 0 || notifyTypeParentId == -3)
            {

                divFragment1.Attributes.Add("pid", notifyTypeParentId.ToString());
                DataListBindNotifyType(notifyTypeParentId);
                divFragment1.Visible = true;
            }

            if (notifyTypeParentId == -1)
            {
                ViewAdminNotify();
            }
            if (notifyTypeParentId == -2)
            {
                if (Request["notifyTypeId"] != null)
                {
                    int typeId = -1;
                    if (CommonUtility.SafeCheckByParams<string>(Request["notifyTypeId"], ref typeId))
                    {
                        DataListBindNotifyByTypeId(typeId);
                    }
                    else
                    {
                        Javascript.GoHistory(-1, Page);
                    }
                }
            }

            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

            isAdmin = UserCookiesInfo.userType.ToString();

            if (UserCookiesInfo.userType == 3)
            {
                DalOperationUsers DalOperationUsers = new DalOperationUsers();
                DataSet ds = DalOperationUsers.StudentTips(UserCookiesInfo.userNo);

                int examCount = ds.Tables[0].Rows.Count;

                int experimentsCount = ds.Tables[1].Rows.Count;

                int schoolWorksCount = ds.Tables[2].Rows.Count;

                int schoolworkpaperCount = ds.Tables[3].Rows.Count;

                int feedBackCount = ds.Tables[4].Rows.Count;

                DalOperationPatch dal = new DalOperationPatch();
                DataSet ds1 = dal.GetLatestCourseNotify(UserCookiesInfo.userNo);

                int courseNotifyCount = ds1.Tables[0].Rows.Count;

                tbTip.Visible = true;

                if (feedBackCount == 0)
                {
                    divFeedBack.Visible = false;
                    tdFeedBack.Visible = false;
                }
                else
                {
                    ltlFeedBack.Text = feedBackCount.ToString();
                    dlistFeedBack.DataSource = ds.Tables[4];
                    dlistFeedBack.DataBind();
                }

                if (examCount == 0)
                {
                    divExam.Visible = false;
                    tdExam.Visible = false;
                }
                else
                {
                    ltlExamTip.Text = examCount.ToString();
                    dlstExam.DataSource = ds.Tables[0];
                    dlstExam.DataBind();
                }

                if (experimentsCount == 0)
                {
                    divExperiments.Visible = false;
                    tdExperiments.Visible = false;
                }
                else
                {
                    ltlExperimentsTip.Text = experimentsCount.ToString();
                    dlstExpriment.DataSource = ds.Tables[1];
                    dlstExpriment.DataBind();
                }

                if (schoolWorksCount == 0)
                {
                    divSchoolWorks.Visible = false;
                    tdSchoolWorks.Visible = false;
                }
                else
                {
                    ltlSchoolWorksTip.Text = schoolWorksCount.ToString() + "次在线作业待提交";

                    dlstSchoolwork.DataSource = ds.Tables[2];
                    dlstSchoolwork.DataBind();
                }

                if (schoolworkpaperCount == 0)
                {
                    divSchoolWorksPaper.Visible = false;
                    tdSchoolWorksPaper.Visible = false;
                }
                else
                {
                    ltlschoolworkpaper.Text = "近期有" + schoolworkpaperCount.ToString() + "次书面作业待提交(此为提醒功能,并不表示未提交作业)";

                    dlstSchoolworkpa.DataSource = ds.Tables[3];
                    dlstSchoolworkpa.DataBind();
                }

                if (courseNotifyCount == 0)
                {
                    divNotify.Visible = false;
                    tdNotify.Visible = false;
                }
                else
                {
                    ltlnotify.Text = courseNotifyCount.ToString();
                    DataList1.DataSource = ds1.Tables[0];
                    DataList1.DataBind();
                }
            }
            if (UserCookiesInfo.userType == 0 || UserCookiesInfo.userType == 1 || UserCookiesInfo.userType == 2)
            {
                DalOperationAboutArchivesConfig dalArchivesConfig = new DalOperationAboutArchivesConfig();

                if (dalArchivesConfig.CheckArchivesNotifyTime())
                {
                    tdArchivesNotify.Visible = true;
                    divArchivesNotify.Visible = true;
                }
                else
                {
                    tdArchivesNotify.Visible = false;
                    divArchivesNotify.Visible = false;
                }

                DalOperationAboutGameCategory dal = new DalOperationAboutGameCategory();

                if (dal.GetGameCategoryIng(DateTime.Now).Tables[0].Rows.Count>0)
                {
                    tdGameCategory.Visible = true;
                    divGameCategory.Visible = true;
                }
                else
                {
                    tdGameCategory.Visible = false;
                    divGameCategory.Visible = false;
                }

            }
        }
    }
示例#15
0
        //绑定搜索到的教师数据
        protected void TeacherDataListBind()
        {
            DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
            UserAuth auth = dalua.GetUserAuth(pageName);
            if (auth != null)
            {
                string ids = auth.userIds;
                string[] _ids = ids.Split(',');
                for (int i = 0; i < _ids.Length; i++)
                {
                    authIds.Add(_ids[i]);
                }
            }
            DalOperationUsers dal = new DalOperationUsers();
            string termValue = Request["termTag"];
            string teacherName = Request["teacherName"];
            DataBindSearchTermTagList(searchTeacherTermTag.Items, termValue);
            if (termValue == "all")
            {
                termValue = "";
            }
            else if(termValue == null || termValue.Trim().Length == 0) {
                termValue = searchTeacherTermTag.SelectedValue;
            }

            if (teacherName != null) {
                teacherName = teacherName.Trim();
                this.txtKeyword.Text = teacherName;
            }

            DataView dv = dal.SearchTeacherByTermTagAndKeyword(termValue, teacherName).DefaultView;

            this.TeacherListPager.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count > 0)
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }
示例#16
0
        private string SearchTeacherIds(string keyWord)
        {
            DalOperationUsers dos = new DalOperationUsers();
            DataView dv = dos.SearchUserByTypeAndKeywod(1, keyWord).DefaultView;
            DataRowCollection drCollection = dv.Table.Rows;
            List<string> tidList = new List<string>();

            for (var i = 0; i < drCollection.Count; i++)
            {
                string s = drCollection[i]["teacherNo"].ToString();
                tidList.Add("'" + s + "'");
            }

            string tids = string.Join(",", tidList.ToArray());
            return tids;
        }
示例#17
0
        protected void btnExamSeatArrange_Click(object sender, EventArgs e)
        {
            List<string> listStudent = new List<string>();

            if (ddlCourses.SelectedValue != "-1")
            {
                DalOperationUsers dou = new DalOperationUsers();
                DataTable dt1 = dou.SearchStudentByCourseNo(ddlCourses.SelectedValue.Trim()).Tables[0];

                Session["examSeatArrange_dt1"] = dt1;

                for (int i = 0; i < dt1.Rows.Count;i++ )
                {
                    listStudent.Add(dt1.Rows[i]["studentNo"].ToString().Trim() + "_" + dt1.Rows[i]["studentName"].ToString().Trim());
                }

                DalOperationAboutGradeCheck dal = new DalOperationAboutGradeCheck();
                DataTable dt2 = dal.GetStudentGradeCheckApplyAccordByCourse(ddlCourses.SelectedValue).Tables[0];

                Session["examSeatArrange_dt2"] = dt2;

                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    listStudent.Add(dt2.Rows[j]["studentNo"].ToString().Trim() + "_" + dt2.Rows[j]["studentName"].ToString().Trim());
                }

                //总学生人数
                int studentsNum = dt1.Rows.Count + dt2.Rows.Count;

                //座位行数
                int rows = int.Parse(txtRows.Text.Trim());
                //座位列数
                int cols = -1;

                if (studentsNum % rows == 0)
                {
                    cols = studentsNum / rows;
                }
                else
                {
                    cols = (studentsNum / rows) + 1;
                }

                Table tb = new Table();
                tb.CssClass = "datagrid2";
                tb.Width = Unit.Percentage(100);

                TableRow tr1 = new TableRow();

                TableHeaderCell th = new TableHeaderCell();
                th.Style["text-align"] = "center";
                th.ColumnSpan = cols;
                th.Text = ddlCourses.SelectedItem.Text + "(当前共" + rows.ToString() + "行" + cols.ToString() + "列" + studentsNum + "名学生)";
                tr1.Cells.Add(th);
                tb.Rows.Add(tr1);

                for (int x = 0; x < rows; x++)
                {
                    TableRow tr = new TableRow();

                    for (int k = 0; k < cols; k++)
                    {
                        TableCell td = new TableCell();
                        td.HorizontalAlign = HorizontalAlign.Center;

                        if (studentsNum > 0)
                        {
                            List<string> listStudentCopy = listStudent;
                            List<string> newList = new List<string>();

                            while (listStudentCopy.Count > 0)
                            {
                                Random random = new Random();
                                int _index = random.Next(listStudentCopy.Count);

                                newList.Insert(0, listStudentCopy[_index]);

                                listStudentCopy.RemoveAt(_index);
                            }

                            listStudent = newList;

                            int _rdm = GenerateRandom(studentsNum);

                            string _studentNo = listStudent[_rdm].Split("_".ToCharArray())[0];
                            string _studentName = listStudent[_rdm].Split("_".ToCharArray())[1];

                            td.Text = _studentName + "<br />(" + _studentNo + ")";
                            listStudent.RemoveAt(_rdm);

                            studentsNum--;
                        }
                        tr.Cells.Add(td);
                    }
                    tb.Rows.Add(tr);
                }

                phExamSeats.Controls.Add(tb);

                outputExcel.Visible = true;
            }
            else
            {
                Javascript.GoHistory(-1, "请选择课程:)", Page);
            }
        }
示例#18
0
        //绑定搜索到的教师数据
        protected void DataListBind()
        {
            UserAuth auth = dalua.GetUserAuth(pageName);
            if (auth != null)
            {
                string ids = auth.userIds;
                string[] _ids = ids.Split(',');
                for (int i = 0; i < _ids.Length; i++)
                {
                    authIds.Add(_ids[i]);
                }
            }

            DalOperationUsers dos = new DalOperationUsers();
            DataView dv = dos.SearchTeacher(txtKeyword.Text.Trim(), ddltTeacherType.SelectedValue).Tables[0].DefaultView;

            this.AspNetPager2.RecordCount = dv.Count;
            PagedDataSource pds = new PagedDataSource();    //定义一个PagedDataSource类来执行分页功
            pds.DataSource = dv;
            pds.AllowPaging = true;

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = CommonUtility.pageSize;

            this.dlSearchTeacher.DataSource = pds;
            this.dlSearchTeacher.DataBind();

            if (pds.Count > 0)
            {
                dlSearchTeacher.ShowFooter = false;
            }
        }
示例#19
0
    //绑定用户信息到DataList
    public void DataListBind(int type)
    {
        //if (txtKeyword.Text.Trim().Length > 0)
        //{
        DalOperationUsers dou = new DalOperationUsers();
        DataTable dt = dou.FindUserByTypeAndKeywod(type, txtKeyword.Text);
        if (dt.Rows.Count > 0)
        {
            maiContent.Visible = true;
        }
        else
        {
            maiContent.Visible = false;
        }

        DataView dv = dt.DefaultView;

        this.dlSearchUser.DataSource = dv;
        this.dlSearchUser.DataBind();

        int recordCount = dt.Rows.Count;

        if (recordCount == 0)
        {
            this.dlSearchUser.ShowFooter = true;
        }
        else
        {
            this.dlSearchUser.ShowFooter = false;
        }

        if (dt.Rows.Count > 0)
        {
            ltlSelectAllSearchUser.Text = "<input id=\"dzxBtnSelectAll\" name=\"dzxBtnSelectAll\" type=\"button\" value=\"全选\" onclick=\"selectAll();\" /> ";
        }
    }