public void DataListBindEnglishExamNotify()
        {
            DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
            DataTable dt = dalOperationAboutEnglishExam.GetEnglishExamNotifyByLocale(ddlEnglishExamNotifyLocale.SelectedValue).Tables[0];
            DataView dv = dt.DefaultView;

            this.AspNetPager1.RecordCount = dv.Count;
            AspNetPager1.PageSize = CommonUtility.pageSize;

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

            pds.CurrentPageIndex = pageIndex - 1;
            pds.PageSize = AspNetPager1.PageSize;

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

            if (pds.Count == 0)
            {
                this.dlstEnglishExamNotify.ShowFooter = true;
            }
            else
            {
                this.dlstEnglishExamNotify.ShowFooter = false;
            }
        }
        //修改
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text.Trim().Length == 0 || this.Textarea1.Value.Trim().Length == 0)
            {
                Javascript.GoHistory(-1, "标题和内容不能为空,请输入!", Page);
            }
            else
            {
                DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
                EnglishExamNotify notify = new EnglishExamNotify();
                notify.englishExamNotifyId = englishExamNotifyInfoId;

                notify.englishExamNotifyTitle = txtTitle.Text.Trim();
                notify.englishExamNotifyContent = this.Textarea1.Value.Trim();
                notify.attachmentIds = hidAttachmentId.Value;
                notify.deadLineTime = Convert.ToDateTime(datepicker.Value);
                notify.updateTime = DateTime.Now;
                notify.locale = ddlLocale.SelectedValue;

                try
                {

                    dalOperationAboutEnglishExam.UpdateEnglishExamNotifyById(notify);//修改
                    Javascript.RefreshParentWindow("修改成功!", "/Administrator/EnglishExamManage.aspx?page="+pageIndex, Page);
                }
                catch (Exception ex)
                {
                    MongoDBLog.LogRecord(ex);
                    Javascript.GoHistory(-1, "修改失败,请检查格式是否有误!", Page);
                }

            }
        }
        //初始化编辑页面
        public void InitialNotifyEdit(int englishExamNotifyInfoId)
        {
            DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
            EnglishExamNotify englishExamNotify = dalOperationAboutEnglishExam.GetEnglishExamNotifyById(englishExamNotifyInfoId);

            txtTitle.Text = englishExamNotify.englishExamNotifyTitle;

            this.Textarea1.Value = englishExamNotify.englishExamNotifyContent;
            datepicker.Value = englishExamNotify.deadLineTime.ToString("yyyy-MM-dd HH:mm:ss");

            hidAttachmentId.Value = englishExamNotify.attachmentIds;

            if (englishExamNotify.attachmentIds.Length > 0)
            {
                DalOperationAttachments dalOperationAttachments = new DalOperationAttachments();
                ltlAttachment.Text = dalOperationAttachments.GetAttachmentsList(englishExamNotify.attachmentIds, ref iframeCount, true, string.Empty);
            }

            if (englishExamNotify.locale.Trim() == "苏州")
            {
                ddlLocale.Items.Add(new ListItem("苏州", "苏州"));
                ddlLocale.Items.Add(new ListItem("合肥", "合肥"));
            }
            else if (englishExamNotify.locale.Trim() == "合肥")
            {
                ddlLocale.Items.Add(new ListItem("合肥", "合肥"));
                ddlLocale.Items.Add(new ListItem("苏州", "苏州"));
            }
        }
        //绑定搜索的四六级报名信息
        public void DataBindEnglishExamSignUpInfo()
        {
            DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();
            DataView dv = doac.GetEnglishExamSignUpInfoByTeacherNoAndLocale("admin", ddlSerachSchoolClass.SelectedValue == "all", ddlSerachSchoolClass.SelectedValue, txtKeyword.Text.Trim().Length > 0, txtKeyword.Text.Trim(), false, ddlSearchLocale.SelectedValue).Tables[0].DefaultView;

            this.AspNetPager2.RecordCount = dv.Count;

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

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

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

            if (pds.Count == 0)
            {
                this.dlstEnglishExamSignUpInfo.ShowFooter = true;
            }
            else
            {
                this.dlstEnglishExamSignUpInfo.ShowFooter = false;
            }
        }
        //初始化编辑页面
        public void InitialNotifyEdit(int englishExamId)
        {
            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();
            DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam();

            if (dal.CheckIsOverDateOrSignUpConfirm(UserCookiesInfo.userNo, englishExamId))
            {
                Javascript.AlertAndRedirect("您好,当前报名信息不能修改,可能的原因为:\n1. 已经过报名截止日期。2. 报名信息已经确认。\n如有疑问请发送疑问反馈,谢谢!", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
                return;
            }

            DataSet ds = dal.GetEnglishExamNotifyIngById(englishExamNotifyId);
            DataRowCollection drc = ds.Tables[0].Rows;

            if (drc.Count == 0)
            {
                Javascript.RefreshParentWindow("您好,当前无四六级报名信息!", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
                return;
            }

            for (int i = 0; i < 1; i++)
            {
                ddlEnglishExamNotify.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim()));
            }
            StudentsList studentList = dal.GetEnglishExamSignUpStudentInfoByStudentNo(UserCookiesInfo.userNo);

            ltlName.Text = studentList.studentName;
            ltlSex.Text = (studentList.Sex == 1 ? "女" : "男");
            ltlStudentNo.Text = studentList.studentNo;
            ltlCardType.Text = studentList.CardType;
            ltlCardNum.Text = studentList.CardNum;
            ltlMatriculationDate.Text = studentList.MatriculationDate.ToString("yyyy-MM-dd");
            ltlMajor.Text = studentList.studentSpeciality;
            ltlSchoolClass.Text = studentList.SchoolClassName;

            EnglishExam englishExam =  dal.GetEnglishExamSignUpInfoByStudentNo(UserCookiesInfo.userNo, englishExamId);

            if (englishExam.examType.Trim() == "四级")
            {
                ddlEnglishExamType.Items.Add(new ListItem("四级", "四级"));
                ddlEnglishExamType.Items.Add(new ListItem("六级", "六级"));
            }
            else if (englishExam.examType.Trim() == "六级")
            {
                ddlEnglishExamType.Items.Add(new ListItem("六级", "六级"));
                ddlEnglishExamType.Items.Add(new ListItem("四级", "四级"));
            }

            if (englishExam.examPlace.Trim() == "合肥")
            {
                ddlEnglishExamPlace.Items.Add(new ListItem("合肥", "合肥"));
                ddlEnglishExamPlace.Items.Add(new ListItem("苏州", "苏州"));
            }
            else if (englishExam.examPlace.Trim() == "苏州")
            {
                ddlEnglishExamPlace.Items.Add(new ListItem("苏州", "苏州"));
                ddlEnglishExamPlace.Items.Add(new ListItem("合肥", "合肥"));
            }
        }
        //初始化编辑页面
        public void InitialNotifyEdit(int englishExamId)
        {
            DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam();

            DataSet ds = dal.GetEnglishExamNotifyIngById(englishExamNotifyId);
            DataRowCollection drc = ds.Tables[0].Rows;
            for (int i = 0; i < drc.Count; i++)
            {
                ddlEnglishExamNotify.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim()));
            }
            StudentsList studentList = dal.GetEnglishExamSignUpStudentInfoByStudentNo(studentNo);

            ltlName.Text = studentList.studentName;
            ltlSex.Text = (studentList.Sex == 1 ? "女" : "男");
            ltlStudentNo.Text = studentList.studentNo;
            ltlCardType.Text = studentList.CardType;
            ltlCardNum.Text = studentList.CardNum;
            ltlMatriculationDate.Text = studentList.MatriculationDate.ToString("yyyy-MM-dd");
            ltlMajor.Text = studentList.studentSpeciality;
            ltlSchoolClass.Text = studentList.SchoolClassName;

            EnglishExam englishExam = dal.GetEnglishExamSignUpInfoByStudentNo(studentNo, englishExamId);

            if (englishExam.examType.Trim() == "四级")
            {
                ddlEnglishExamType.Items.Add(new ListItem("四级", "四级"));
                ddlEnglishExamType.Items.Add(new ListItem("六级", "六级"));
            }
            else if (englishExam.examType.Trim() == "六级")
            {
                ddlEnglishExamType.Items.Add(new ListItem("六级", "六级"));
                ddlEnglishExamType.Items.Add(new ListItem("四级", "四级"));
            }

            if (englishExam.examPlace.Trim() == "合肥")
            {
                ddlEnglishExamPlace.Items.Add(new ListItem("合肥", "合肥"));
                ddlEnglishExamPlace.Items.Add(new ListItem("苏州", "苏州"));
            }
            else if (englishExam.examPlace.Trim() == "苏州")
            {
                ddlEnglishExamPlace.Items.Add(new ListItem("苏州", "苏州"));
                ddlEnglishExamPlace.Items.Add(new ListItem("合肥", "合肥"));
            }

            if (englishExam.englishExamSignUpConfirm == 1)
            {
                btnConfirm.Text = "取消确认报名信息";
                btnConfirm.Attributes.Add("onclick", "return confirm('是否取消确认报名信息?')");
                ddlEnglishExamType.Attributes.Add("disabled", "disabled");
                ddlEnglishExamPlace.Attributes.Add("disabled", "disabled");
            }
            else
            {
                btnConfirm.Attributes.Add("onclick", "return confirm('是否确认报名信息(包括基本信息、考试类型、考试地点等)?')");
            }
            hidExamType.Value = englishExam.examType;
            hidExamPlace.Value = englishExam.examPlace;
        }
        //绑定班级下拉列表
        public void DataBindSchoolClassList(DropDownList ddl)
        {
            DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();
            UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();
            DataTable dt = doac.GetSchoolClassByTeacherNo(user.userNo).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ddl.Items.Add(new ListItem(dt.Rows[i]["className"].ToString().Trim(), dt.Rows[i]["SchoolClassID"].ToString().Trim()));
            }
        }
        //搜索课程列表
        protected void btnCommitExamCertificate_Click(object sender, EventArgs e)
        {
            DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();

            try
            {
                doac.BatchUpdateSignUpInfoState("examCertificateState", ddlExamCertificate.SelectedValue, int.Parse(ddlEnglishExamNotify.SelectedValue), ddlSchoolClass.SelectedValue);
                Javascript.AlertAndRedirect("更改当前班级所有报名学生准考证状态成功!", "/Teacher/EnglishExamManage.aspx?fragment=1", Page);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "更改当前班级所有报名学生准考证状态失败,请检查格式是否有误!", Page);
            }
        }
        //初始化编辑页面
        public void InitialNotifyEdit(int englishExamNotifyInfoId)
        {
            DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
            dalOperationAboutEnglishExam.UpdateEnglishExamNotifyHitsById(englishExamNotifyInfoId);
            EnglishExamNotify englishExamNotify = dalOperationAboutEnglishExam.GetEnglishExamNotifyById(englishExamNotifyInfoId);

            ltlTitle.Text = englishExamNotify.englishExamNotifyTitle;

            this.ltlContent.Text = englishExamNotify.englishExamNotifyContent;
            ltlDeadLineTime.Text = englishExamNotify.deadLineTime.ToString();

            if (englishExamNotify.attachmentIds.Length > 0)
            {
                DalOperationAttachments dalOperationAttachments = new DalOperationAttachments();
                ltlAttachment.Text = dalOperationAttachments.GetAttachmentsList(englishExamNotify.attachmentIds, ref iframeCount, true,string.Empty);
            }
        }
        //初始化编辑页面
        public void InitialNotifyEdit(int englishExamId)
        {
            DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam();

            DataSet ds = dal.GetEnglishExamNotifyIngById(englishExamNotifyId);
            DataRowCollection drc = ds.Tables[0].Rows;
            for (int i = 0; i < drc.Count; i++)
            {
                ddlEnglishExamNotify.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim()));
            }

            EnglishExam englishExam = dal.GetEnglishExamSignUpInfoByStudentNo(studentNo, englishExamId);

            //txtIsPaid.Text = englishExam.isPaid.ToString();
            txtIsPaidRemark.Text = englishExam.isPaidRemark;
            //txtExamCertificateState.Text = englishExam.examCertificateState;
            txtExamCertificateStateRemark.Text = englishExam.examCertificateRemark;
            txtGrade.Text = englishExam.grade;
            //txtGradeCertificateState.Text = englishExam.gradeCertificateState;
            txtGradeCertificateStateRemark.Text = englishExam.gradeCertificateRemark;

            for (int i = 0; i < ddlIspaid.Items.Count; i++)
            {
                if (int.Parse(ddlIspaid.Items[i].Value.Trim()) == englishExam.isPaid)
                {
                    ddlIspaid.SelectedIndex = i;
                }
            }

            for (int i = 0; i < ddlExamCertificate.Items.Count; i++)
            {
                if (ddlExamCertificate.Items[i].Value.Trim() == englishExam.examCertificateState.Trim())
                {
                    ddlExamCertificate.SelectedIndex = i;
                }
            }

            for (int i = 0; i < ddlGradeCertificate.Items.Count; i++)
            {
                if (ddlGradeCertificate.Items[i].Value.Trim() == englishExam.gradeCertificateState.Trim())
                {
                    ddlGradeCertificate.SelectedIndex = i;
                }
            }
        }
        //修改
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();

                EnglishExam model = new EnglishExam { studentNo = studentNo, englishExamId = englishExamId, englishExamNotifyId=englishExamNotifyId, examCertificateRemark=txtExamCertificateStateRemark.Text.Trim(), gradeCertificateRemark=txtGradeCertificateStateRemark.Text.Trim(), isPaidRemark=txtIsPaidRemark.Text.Trim(),
                     grade=txtGrade.Text.Trim(),
                     gradeCertificateState= ddlGradeCertificate.SelectedValue,
                     examCertificateState=ddlExamCertificate.SelectedValue,
                     isPaid = int.Parse(ddlIspaid.SelectedValue)
                 };
                dalOperationAboutEnglishExam.UpdateEnglishExamSignUpState(model);
                Javascript.RefreshParentWindow("修改报名相关状态信息成功!", "/Teacher/EnglishExamManage.aspx?fragment=1", Page);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "修改报名相关状态信息失败,请检查格式是否有误!", Page);
            }
        }
        //绑定班级下拉列表
        public void DataBindSchoolClassList(DropDownList ddl)
        {
            DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();
            DataTable dt = doac.GetAllSchoolClass().Tables[0];

            schoolClassName = "{";

            List<string> schoolClassNameTemp = new List<string>();

            ddl.Items.Add(new ListItem("全部班级", "all"));

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ddl.Items.Add(new ListItem(dt.Rows[i]["className"].ToString().Trim(), dt.Rows[i]["SchoolClassID"].ToString().Trim()));
                schoolClassNameTemp.Add("\"" + dt.Rows[i]["className"].ToString().Trim() + "\":" + "\"" + dt.Rows[i]["SchoolClassID"].ToString().Trim()+"\"");
            }

            schoolClassName += String.Join(",", schoolClassNameTemp.ToArray());

            schoolClassName += "}";
        }
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
                UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();

                if (dalOperationAboutEnglishExam.CheckHasSignUpInfo(user.userNo,int.Parse(ddlEnglishExamNotify.SelectedValue)) > 0)
                {
                    Javascript.AlertAndRedirect("您好,当前已经报名,点击确定查看报名信息", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
                    return;
                }

                dalOperationAboutEnglishExam.AddEnglishExamSignUp(user.userNo, ddlEnglishExamPlace.SelectedValue, ddlEnglishExamType.SelectedValue
                    , int.Parse(ddlEnglishExamNotify.SelectedValue)); //保存反馈意见
                Javascript.AlertAndRedirect("报名成功!", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "报名失败,请检查格式是否有误!", Page);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //控制Tab的显示
            string fragmentFlag = "1";

            if (Request["fragment"] != null)
            {
                fragmentFlag = Request["fragment"];
            }

            CommonUtility.ShowLiControl(fragmentFlag, liFragment1, liFragment2, liFragment3,liFragment4
                , divFragment1, divFragment2, divFragment3,divFragment4);

            if (fragmentFlag.Equals("1"))
            {
                if (!IsPostBack)
                {
                    DataListBindEnglishExamNotify();
                }
            }
            if (fragmentFlag.Equals("2"))
            {
                if (!IsPostBack)
                {
                    Javascript.ExcuteJavascriptCode("initBeforeUnloadEvent('温馨提示:当前页面数据可能未保存哟~(此为提示,并不代表您真正未保存数据),确定离开吗?');", Page);
                    txtTitle.Attributes.Add("class", "required");
                }

            }
            if (fragmentFlag.Equals("3"))
            {
                txtTitle.Attributes.Remove("class");
                datepicker.Attributes.Remove("class");
                if (!IsPostBack)
                {
                    DataBindSchoolClassList(ddlSerachSchoolClass);
                    DataBindEnglishExamSignUpInfo();
                }
            }

            if (fragmentFlag.Equals("4"))
            {
                DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();
                DataSet ds = doac.GetAllEnglishExamNotify();
                DataRowCollection drc = ds.Tables[0].Rows;
                for (int i = 0; i < drc.Count; i++)
                {
                    ddlEnglishExamNotifyExcel.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim()));
                }
                //绑定班级标识下拉列表
                DataBindSchoolClassList(ddlSchoolClassExcel);
            }
        }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BaseConfig baseconfig = CacheCollections.GetBaseConfig();
        if (!IsPostBack)
        {

            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

            //UserCookiesInfo UserCookiesInfo = CacheCollections.GetUserCookiesInfo();

            string nickName = string.Empty;

            switch (UserCookiesInfo.userType)
            {
                case 0:
                    ulAdmin.Visible = true;
                    nickName = "老师";

                    if (UserCookiesInfo.teacherType != null && UserCookiesInfo.teacherType == "本院")
                    {
                        drawAdminTeacher.Visible = true;
                    }

                    break;
                case 1:
                case 2:
                    ulTeacher.Visible = true;
                    nickName = "老师";
                    DalOperationNorm dalOperationNorm = new DalOperationNorm();
                    DalOperationAboutUserAuth dalua = new DalOperationAboutUserAuth();
                    UserAuth auth = dalOperationNorm.GetUserAuth(pageName);
                    UserAuth salaryAuth = dalua.GetUserAuth(salaryPageName);
                    UserAuth projectAuth = dalua.GetUserAuth(projectPageName);

                    if (auth!=null&&auth.userIds != null)
                    {
                        string[] _ids = auth.userIds.Split(',');
                        if (_ids != null)
                        {
                            norm_right = _ids.Contains(UserCookiesInfo.userNo);
                        }
                    }

                    if (salaryAuth!=null&&salaryAuth.userIds != null)
                    {
                        string[] _ids = salaryAuth.userIds.Split(',');
                        if (_ids != null)
                        {
                            if (_ids.Contains(UserCookiesInfo.userNo))
                            {
                                salary_right = true;
                            }
                        }
                    }

                    if (projectAuth != null)
                    {
                        string projectUserIds = projectAuth.userIds;
                        if (!(projectUserIds == null || projectUserIds.Trim().Length == 0))
                        {
                            if (projectUserIds.Contains(UserCookiesInfo.userNo))
                            {
                                project_right = true;
                            }
                        }
                    }

                    if (UserCookiesInfo.teacherType != null && UserCookiesInfo.teacherType == "本院")
                    {
                        drawTeacher.Visible = true;
                    }

                    break;
                case 3:
                    ulStudent.Visible = true;
                    nickName = "同学";
                    break;
                default:
                    break;
            }
            user.InnerHtml = "尊敬的" + UserCookiesInfo.userName.Trim() + nickName + "  您好!";
            //设置系统配置信息

            //DalOperationBaseConfig dobc = new DalOperationBaseConfig();
            ltlSystemVersion.Text = baseconfig.systemVersion;
            this.lblCopyRight.Text = baseconfig.systemCopyRight;
            //判断是否为班主任
            DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
            if (dalOperationAboutEnglishExam.CheckIsHeadTeacherByTeacherNo(UserCookiesInfo.userNo))
            {
                englishExamManage.Visible = true;
            }
        }
        pageTitle.Text = baseconfig.systemName + " 当前系统版本号:" + baseconfig.systemVersion;
    }
        public void ProcessRequest(HttpContext context)
        {
            CommonFunction.CheckUser();

            context.Response.CacheControl = "no-cache";

            string englishExamNotifyId = context.Request["englishExamNotifyId"];

            string useSchoolClassId = context.Request["useSchoolClassId"];

            string schoolClassId = context.Request["schoolClassId"].Trim();

            string schoolClassName = string.Empty;
            string englishExamNotifyTitle = string.Empty;

            string englishExamSignUpExcel = System.Configuration.ConfigurationManager.AppSettings["EnglishExamSignUpExcel"];

            //StringBuilder sb = new StringBuilder();

            using (FileStream file1 = new FileStream(HttpContext.Current.Server.MapPath(englishExamSignUpExcel) + "template.xls", FileMode.Open))
            {
                HSSFWorkbook workbook = new HSSFWorkbook(file1);

                DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam();
                UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();

                DataSet ds = dal.GetEnglishExamSignUpInfoByTeacherNo(user.userNo, false, schoolClassId, false, string.Empty, useSchoolClassId != null);
                DataTable dt = ds.Tables[0];
                DataRow[] dr1 = dt.Select("examType='四级'");
                DataRow[] dr2 = dt.Select("examType='六级'");

                //创建WorkSheet
                HSSFSheet sheet1 = workbook.GetSheet("四级");
                HSSFSheet sheet2 = workbook.GetSheet("六级");
                string[] cardTypeCollection = System.Configuration.ConfigurationManager.AppSettings["cardType"].Split(",".ToCharArray());

                int dr1RowCount = dr1.Length;

                for (int i = 0; i < dr1RowCount; i++)
                {
                    int cardType = -1;

                    for (int x = 0; x < cardTypeCollection.Length; x++)
                    {
                        if (cardTypeCollection[x].IndexOf(dr1[i]["cardType"].ToString().Trim()) != -1)
                        {
                            cardType = int.Parse(cardTypeCollection[x].Split("|".ToCharArray())[1]);
                        }
                    }

                    sheet1.CreateRow(i + 3).CreateCell(0).SetCellValue(i + 1);
                    sheet1.CreateRow(i + 3).CreateCell(1).SetCellValue(dr1[i]["studentName"].ToString().Trim());
                    sheet1.CreateRow(i + 3).CreateCell(2).SetCellValue(dr1[i]["sex"].ToString().Trim() == "0" ? "男" : "女");
                    sheet1.CreateRow(i + 3).CreateCell(3).SetCellValue(dr1[i]["studentNo"].ToString().Trim());
                    sheet1.CreateRow(i + 3).CreateCell(4).SetCellValue(cardType.ToString().Trim());
                    sheet1.CreateRow(i + 3).CreateCell(5).SetCellValue(dr1[i]["cardNum"].ToString().Trim());
                    sheet1.CreateRow(i + 3).CreateCell(6).SetCellValue(string.Empty);
                    sheet1.CreateRow(i + 3).CreateCell(7).SetCellValue(string.Empty);
                    sheet1.CreateRow(i + 3).CreateCell(8).SetCellValue(dr1[i]["studentNo"].ToString().Trim().Substring(2, 2));

                    string studentGrade = string.Empty;

                    if (DateTime.Now.Month >= 9)
                    {
                        studentGrade = "0" + (int.Parse(DateTime.Now.Year.ToString().Trim().Substring(2, 2)) - int.Parse(dr1[i]["studentNo"].ToString().Trim().Substring(2, 2)) + 1);
                    }
                    else
                    {
                        studentGrade = "0" + (int.Parse(DateTime.Now.Year.ToString().Trim().Substring(2, 2)) - int.Parse(dr1[i]["studentNo"].ToString().Trim().Substring(2, 2)));
                    }
                    sheet1.CreateRow(i + 3).CreateCell(9).SetCellValue(studentGrade);
                    sheet1.CreateRow(i + 3).CreateCell(10).SetCellValue("软件学院");
                    sheet1.CreateRow(i + 3).CreateCell(11).SetCellValue(dr1[i]["SchoolClassName"].ToString().Trim());
                    sheet1.CreateRow(i + 3).CreateCell(12).SetCellValue(dr1[i]["studentSpeciality"].ToString().Trim());
                    sheet1.CreateRow(i + 3).CreateCell(13).SetCellValue("四级");
                    sheet1.CreateRow(i + 3).CreateCell(14).SetCellValue(dr1[i]["examPlace"].ToString().Trim());

                    schoolClassName = dr1[i]["SchoolClassName"].ToString().Trim();
                    englishExamNotifyTitle = dr1[i]["englishExamNotifyTitle"].ToString().Trim();
                }

                int dr2RowCount = dr2.Length;

                for (int i = 0; i < dr2RowCount; i++)
                {
                    int cardType = -1;

                    for (int x = 0; x < cardTypeCollection.Length; x++)
                    {
                        if (cardTypeCollection[x].IndexOf(dr2[i]["cardType"].ToString().Trim()) != -1)
                        {
                            cardType = int.Parse(cardTypeCollection[x].Split("|".ToCharArray())[1]);
                        }
                    }

                    sheet2.CreateRow(i + 3).CreateCell(0).SetCellValue(i + 1);
                    sheet2.CreateRow(i + 3).CreateCell(1).SetCellValue(dr2[i]["studentName"].ToString().Trim());
                    sheet2.CreateRow(i + 3).CreateCell(2).SetCellValue(dr2[i]["sex"].ToString().Trim() == "0" ? "男" : "女");
                    sheet2.CreateRow(i + 3).CreateCell(3).SetCellValue(dr2[i]["studentNo"].ToString().Trim());
                    sheet2.CreateRow(i + 3).CreateCell(4).SetCellValue(cardType.ToString().Trim());
                    sheet2.CreateRow(i + 3).CreateCell(5).SetCellValue(dr2[i]["cardNum"].ToString().Trim());
                    sheet2.CreateRow(i + 3).CreateCell(6).SetCellValue(string.Empty);
                    sheet2.CreateRow(i + 3).CreateCell(7).SetCellValue(string.Empty);
                    sheet2.CreateRow(i + 3).CreateCell(8).SetCellValue(dr2[i]["studentNo"].ToString().Trim().Substring(2, 2));

                    string studentGrade = string.Empty;
                    if (DateTime.Now.Month >= 9)
                    {
                        studentGrade = "0" + (int.Parse(DateTime.Now.Year.ToString().Trim().Substring(2, 2)) - int.Parse(dr2[i]["studentNo"].ToString().Trim().Substring(2, 2)) + 1);
                    }
                    else
                    {
                        studentGrade = "0" + (int.Parse(DateTime.Now.Year.ToString().Trim().Substring(2, 2)) - int.Parse(dr2[i]["studentNo"].ToString().Trim().Substring(2, 2)));
                    }

                    sheet2.CreateRow(i + 3).CreateCell(9).SetCellValue(studentGrade);
                    sheet2.CreateRow(i + 3).CreateCell(10).SetCellValue("软件学院");
                    sheet2.CreateRow(i + 3).CreateCell(11).SetCellValue(dr2[i]["SchoolClassName"].ToString().Trim());
                    sheet2.CreateRow(i + 3).CreateCell(12).SetCellValue(dr2[i]["studentSpeciality"].ToString().Trim());
                    sheet2.CreateRow(i + 3).CreateCell(13).SetCellValue("六级");
                    sheet2.CreateRow(i + 3).CreateCell(14).SetCellValue(dr2[i]["examPlace"].ToString().Trim());

                    schoolClassName = dr2[i]["SchoolClassName"].ToString().Trim();
                    englishExamNotifyTitle = dr2[i]["englishExamNotifyTitle"].ToString().Trim();
                }

                string fileName = englishExamNotifyTitle + schoolClassName + "四六级报名数据汇总" + UploadFiles.DateTimeString();

                if (!Directory.Exists(context.Server.MapPath(englishExamSignUpExcel)))
                {
                    Directory.CreateDirectory(englishExamSignUpExcel);
                }

                System.IO.FileStream file = new System.IO.FileStream(HttpContext.Current.Server.MapPath(englishExamSignUpExcel + fileName + ".xls"), System.IO.FileMode.Create);
                workbook.Write(file);
                file.Dispose();

                ////插入值
                FileInfo DownloadFile = new FileInfo(context.Server.MapPath(englishExamSignUpExcel + fileName + ".xls"));

                context.Response.Clear();
                context.Response.ClearHeaders();
                context.Response.Buffer = false;
                Encoding code = Encoding.GetEncoding("gb2312");
                context.Response.ContentEncoding = Encoding.UTF8;
                context.Response.HeaderEncoding = code;//这句很重要
                context.Response.ContentType = "application/octet-stream";
                context.Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls");
                context.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
                context.Response.WriteFile(DownloadFile.FullName);

                if (File.Exists(context.Server.MapPath(englishExamSignUpExcel + fileName + ".xls")))
                {
                    File.Delete(context.Server.MapPath(englishExamSignUpExcel + fileName + ".xls"));
                }
                context.Response.Flush();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //控制Tab的显示

            UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo();

            if (Request["fragment"] != null)
            {
                fragmentFlag = Request["fragment"];
            }

            CommonUtility.ShowLiControl(fragmentFlag, liFragment1, liFragment2, liFragment3
                , divFragment1, divFragment2, divFragment3);

            if (!IsPostBack)
            {
                if (fragmentFlag == "1")
                {
                    DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam();
                    DataTable _dt = dal.GetLocaleByStudentNo(UserCookiesInfo.userNo).Tables[0];

                    DataSet ds = dal.GetEnglishExamNotifyByLocale(_dt.Rows.Count > 0 ? _dt.Rows[0]["locale"].ToString().Trim() : string.Empty);
                    DataRowCollection drc = ds.Tables[0].Rows;

                    if (drc.Count == 0)
                    {
                        tbEnglishtSignUp.Visible = false;
                        Javascript.AlertAndRedirect("您好,当前无四六级报名信息!", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
                        return;
                    }

                    for (int i = 0; i < 1; i++)
                    {
                        ddlEnglishExamNotify.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim()));
                    }

                    if (dal.CheckHasSignUpInfo(UserCookiesInfo.userNo, int.Parse(ddlEnglishExamNotify.SelectedValue)) > 0)
                    {
                        Javascript.AlertAndRedirect("您好,当前已经报名,点击确定查看报名信息", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
                        return;
                    }

                    StudentsList studentList = dal.GetEnglishExamSignUpStudentInfoByStudentNo(UserCookiesInfo.userNo);

                    ltlName.Text = studentList.studentName;
                    ltlSex.Text = (studentList.Sex == 1 ? "女" : "男");
                    ltlStudentNo.Text = studentList.studentNo;
                    ltlCardType.Text = studentList.CardType;
                    ltlCardNum.Text = studentList.CardNum;
                    ltlMatriculationDate.Text = studentList.MatriculationDate.ToString("yyyy-MM-dd");
                    ltlMajor.Text = studentList.studentSpeciality;
                    ltlSchoolClass.Text = studentList.SchoolClassName;

                }

                if (fragmentFlag == "2")
                {
                    DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam();
                    dlstEnglishExamSignUp.DataSource = dal.GetAllEnglishExamSignUpInfoByStudentNo(UserCookiesInfo.userNo);
                    dlstEnglishExamSignUp.DataBind();
                }
            }
        }
        //修改
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
                UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();

                if (dalOperationAboutEnglishExam.CheckIsOverDateOrSignUpConfirm(user.userNo, englishExamId))
                {
                    Javascript.AlertAndRedirect("您好,当前报名信息不能修改,可能的原因为:\n1. 已经过报名截止日期。2. 报名信息已经确认。\n如有疑问请发送疑问反馈,谢谢!", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
                    return;
                }

                dalOperationAboutEnglishExam.UpdateEnglishExamSignUp(user.userNo, ddlEnglishExamPlace.SelectedValue, ddlEnglishExamType.SelectedValue
                    , englishExamId); //保存反馈意见
                Javascript.RefreshParentWindow("修改报名信息成功!", "/Student/EnglishExamSignUp.aspx?fragment=2", Page);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "修改报名信息失败,请检查格式是否有误!", Page);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //控制Tab的显示

                if (Request["fragment"] != null)
                {
                    fragmentFlag = Request["fragment"];
                }

                CommonUtility.ShowLiControl(fragmentFlag, liFragment1, liFragment2, liFragment3
                    , divFragment1, divFragment2, divFragment3);

                if (fragmentFlag.Equals("1"))
                {
                    DataBindSchoolClassList(ddlSerachSchoolClass);
                    DataBindEnglishExamSignUpInfo();
                }
                else if (fragmentFlag.Equals("2"))
                {
                    DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();
                    DataSet ds = doac.GetAllEnglishExamNotify();
                    DataRowCollection drc = ds.Tables[0].Rows;

                    if (drc.Count == 0)
                    {
                        Javascript.AlertAndRedirect("当前暂无需要处理的四六级通知!", "/Teacher/EnglishExamManage.aspx?fragment=1", Page);
                    }

                    for (int i = 0; i < drc.Count; i++)
                    {
                        ddlEnglishExamNotify.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim()));
                    }
                    //绑定班级标识下拉列表
                    DataBindSchoolClassList(ddlSchoolClass);
                }
                else if (fragmentFlag.Equals("3"))
                {
                    DalOperationAboutEnglishExam doac = new DalOperationAboutEnglishExam();
                    DataSet ds = doac.GetAllEnglishExamNotify();
                    DataRowCollection drc = ds.Tables[0].Rows;

                    if (drc.Count == 0)
                    {
                        Javascript.AlertAndRedirect("当前暂无需要处理的四六级通知!", "/Teacher/EnglishExamManage.aspx?fragment=1", Page);
                    }

                    for (int i = 0; i < drc.Count; i++)
                    {
                        ddlEnglishExamNotifyExcel.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim()));
                    }
                    //绑定班级标识下拉列表
                    DataBindSchoolClassList(ddlSchoolClassExcel);
                }
            }
        }
        //第1个标签:结束
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text.Trim().Length == 0 || Textarea1.Value.Trim().Length == 0)
            {
                Javascript.GoHistory(-1, "标题和内容不能为空,请输入!", Page);
                Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
            }
            else
            {
                DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
                EnglishExamNotify englishExamNotify = new EnglishExamNotify();
                englishExamNotify.englishExamNotifyTitle = txtTitle.Text.Trim();
                englishExamNotify.englishExamNotifyContent = Textarea1.Value.Trim();
                englishExamNotify.deadLineTime = Convert.ToDateTime(datepicker.Value.Trim());
                englishExamNotify.locale = ddlLocale.SelectedValue;

                //以下提交附件的判断与相关操作
                if (hidAttachmentId.Value.CompareTo(string.Empty) != 0)
                {
                    englishExamNotify.attachmentIds = hidAttachmentId.Value;//保存了附件并且返回了attachmentId(自增长类型主键)
                }

                try
                {
                    dalOperationAboutEnglishExam.AddEnglishExamNotify(englishExamNotify);//保存通知
                    Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
                    Javascript.AlertAndRedirect("添加成功!", "/Administrator/EnglishExamManage.aspx?fragment=1", Page);
                }
                catch (Exception ex)
                {
                    MongoDBLog.LogRecord(ex);
                    Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
                    Javascript.GoHistory(-1, "添加失败,请检查格式是否有误!", Page);
                }

            }
        }
 protected void dlstEnglishExamNotify_ItemCommand(object source, DataListCommandEventArgs e)
 {
     DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
     if (e.CommandName == "delete")
     {
         string englishExamNotifyInfoId = dlstEnglishExamNotify.DataKeys[e.Item.ItemIndex].ToString();//取选中行公告编号
         dalOperationAboutEnglishExam.DeleteEnglishExamNotifyById(int.Parse(englishExamNotifyInfoId));
         Javascript.AlertAndRedirect("删除成功!", "/Administrator/EnglishExamManage.aspx?fragment=1", Page);
     }
     else if (e.CommandName == "update")
     {
         string englishExamNotifyInfoId = dlstEnglishExamNotify.DataKeys[e.Item.ItemIndex].ToString();//取选中行公告编号
         Javascript.JavaScriptLocationHref("/Administrator/EditEnglishExamNotifyInfo.aspx?englishExamNotifyInfoId=" + englishExamNotifyInfoId, Page);
     }
 }
        //修改
        protected void btnConfirm_Click(object sender, EventArgs e)
        {
            DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();

            dalOperationAboutEnglishExam.ConfirmOrCancelSignUpInfo(englishExamId.ToString(), studentNo, ddlEnglishExamType.SelectedValue, ddlEnglishExamPlace.SelectedValue, (btnConfirm.Text == "确认报名信息" ? false : true));
            Javascript.RefreshParentWindow((btnConfirm.Text == "确认报名信息" ? "确认报名信息成功!" : "取消确认报名信息成功!"), "/Teacher/EnglishExamManage.aspx?fragment=1", Page);
        }