Ejemplo n.º 1
0
        protected void btnLast_Click(object sender, EventArgs e)
        {
            string strId = Request.QueryString.Get("id");

            string strFlag = "";

            if (ViewState["mode"].ToString() == "Insert")
            {
                strFlag = "Edit";
            }
            else
            {
                strFlag = ViewState["mode"].ToString();
            }

            ExamResultBLL reBll = new ExamResultBLL();

            IList <RailExam.Model.ExamResult> examResults = reBll.GetExamResultByExamID(int.Parse(strId));

            if (examResults.Count > 0 && ViewState["mode"].ToString() != "ReadOnly")
            {
                Response.Redirect("ExamManageFirst.aspx?mode=" + strFlag + "&id=" + strId);
            }
            else
            {
                Response.Redirect("ExamManageSecond.aspx?mode=" + strFlag + "&id=" + strId);
            }
        }
Ejemplo n.º 2
0
        private void HasExamId()
        {
            string strExamId = Request.QueryString.Get("id");

            //已经参加考试的考生自动填充上


            ExamResultBLL reBll = new ExamResultBLL();
            IList <RailExam.Model.ExamResult> examResults = reBll.GetExamResultByExamID(int.Parse(strExamId));
            string strId = "";

            for (int i = 0; i < examResults.Count; i++)
            {
                string strEmId = examResults[i].ExamineeId.ToString();

                if (strId.Length == 0)
                {
                    strId += strEmId;
                }
                else
                {
                    strId += "," + strEmId;
                }
            }
            ViewState["HasExamId"] = strId;;
        }
Ejemplo n.º 3
0
        protected void btnOutPutWord_Click(object sender, ImageClickEventArgs e)
        {
            string qsExamId = Request.QueryString.Get("eid");
            IList <RailExam.Model.ExamResult> examResults = null;
            ExamResultBLL bllExamResult = new ExamResultBLL();

            examResults = bllExamResult.GetExamResultByExamID(int.Parse(qsExamId));

            string str = "";

            //string fileName = "考试成绩";
            for (int i = 0; i < examResults.Count; i++)
            {
                //if (i == 0)
                //{
                //    fileName = examResults[i].ExamName + "成绩";
                //}

                str += GetExamOutString(examResults[i].ExamResultId.ToString(), examResults[i].OrganizationId.ToString());
            }

            Response.Clear();
            Response.Charset = "utf-7";
            Response.Buffer  = true;
            EnableViewState  = false;
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + "ExamResult" + ".doc");

            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-7");
            Response.ContentType     = "application/ms-word";
            Response.Write(str);
            Response.End();
        }
Ejemplo n.º 4
0
        private void BindChoosedGrid(string strId, string strOrderBy)
        {
            HasExamId();

            string strExamId = Request.QueryString.Get("id");
            //已经参加考试的考生自动填充上


            ExamResultBLL reBll = new ExamResultBLL();
            IList <RailExam.Model.ExamResult> examResults = reBll.GetExamResultByExamID(int.Parse(strExamId));

            for (int i = 0; i < examResults.Count; i++)
            {
                string strEmId     = examResults[i].ExamineeId.ToString();
                string strOldAllId = "," + strId + ",";
                if (strOldAllId.IndexOf("," + strEmId + ",") == -1)
                {
                    if (strId.Length == 0)
                    {
                        strId += strEmId;
                    }
                    else
                    {
                        strId += "," + strEmId;
                    }
                }
            }

            EmployeeBLL psBLL = new EmployeeBLL();
            DataSet     ds    = new DataSet();

            string strIDs = "," + strId + ",";

            if (strIDs.Length > 2000)
            {
                ds = psBLL.GetEmployeesByEmployeeIdS(strIDs);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //DataView dv = ds.Tables[0].DefaultView;
                    //dv.Sort = strOrderBy;
                    Grid2.DataSource = ds;
                    Grid2.DataBind();
                }
                else
                {
                    BindEmptyGrid2();
                }
            }
            else
            {
                IList <Employee> objList = psBLL.GetEmployeesByEmployeeId(strIDs);
                if (objList.Count > 0)
                {
                    ds.Tables.Add(ConvertToDataTable((IList)objList));
                    Grid2.DataSource = ds;
                    Grid2.DataBind();
                }
                else
                {
                    BindEmptyGrid2();
                }
            }
        }
Ejemplo n.º 5
0
        protected void FillPage(int nExamID)
        {
            ExamBLL examBLL = new ExamBLL();

            RailExam.Model.Exam exam = examBLL.GetExam(nExamID);

            if (exam != null)
            {
                if (ViewState["mode"].ToString() == "Edit")
                {
                    if (exam.Downloaded == 1)
                    {
                        Response.Write("<script>alert('该考试已被下载,不能被编辑!');window.close();</script>");
                    }
                }
                txtCategoryName.Text    = exam.CategoryName;
                hfCategoryId.Value      = exam.CategoryId.ToString();
                ddlType.SelectedValue   = exam.ExamTypeId.ToString();
                txtExamName.Text        = exam.ExamName;
                txtExamTime.Text        = exam.ExamTime.ToString();
                dateBeginTime.DateValue = exam.BeginTime.ToString("yyyy-MM-dd HH:mm:ss");
                dateEndTime.DateValue   = exam.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
                if (exam.ExamModeId == 1)
                {
                    rbExamMode1.Checked = true;
                }
                else
                {
                    rbExamMode2.Checked = true;
                }

                chUD.Checked          = exam.IsUnderControl;
                chAutoScore.Checked   = exam.IsAutoScore;
                chSeeAnswer.Checked   = exam.CanSeeAnswer;
                chSeeScore.Checked    = exam.CanSeeScore;
                chPublicScore.Checked = exam.IsPublicScore;
                txtDescription.Text   = exam.Description;
                txtMemo.Text          = exam.Memo;

                lblCreatePerson.Text = exam.CreatePerson;
                lblCreateTime.Text   = exam.CreateTime.ToString("yyyy-MM-dd HH:mm");

                ExamResultBLL reBll = new ExamResultBLL();

                try
                {
                    if (ViewState["mode"].ToString() == "Edit")
                    {
                        IList <RailExam.Model.ExamResult> examResults = reBll.GetExamResultByExamID(exam.ExamId);
                        if (examResults.Count > 0)
                        {
                            ViewState["mode"] = "ReadOnly";
                        }
                    }
                }
                catch
                {
                    Pub.ShowErrorPage("无法连接站段服务器,请检查站段服务器是否打开以及网络连接是否正常!");
                }
            }

            if (ViewState["mode"].ToString() == "ReadOnly")
            {
                txtExamName.Enabled      = false;
                dateBeginTime.Enabled    = false;
                this.dateEndTime.Enabled = false;
                ddlType.Enabled          = false;
                txtExamTime.Enabled      = false;
                rbExamMode1.Enabled      = false;
                rbExamMode2.Enabled      = false;

                chUD.Enabled           = false;
                chAutoScore.Enabled    = false;
                chSeeAnswer.Enabled    = false;
                chSeeScore.Enabled     = false;
                chPublicScore.Enabled  = false;
                txtDescription.Enabled = false;
                txtMemo.Enabled        = false;
            }
        }
Ejemplo n.º 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ExamBLL examBLL = new ExamBLL();

            RailExam.Model.Exam exam = new RailExam.Model.Exam();

            string strID   = string.Empty;
            string strMode = ViewState["mode"].ToString();

            if (strMode == "Insert")
            {
                exam.CategoryId   = int.Parse(hfCategoryId.Value);
                exam.ExamName     = txtExamName.Text;
                exam.Memo         = txtMemo.Text;
                exam.CreatePerson = PrjPub.CurrentLoginUser.EmployeeName;
                if (rbExamMode1.Checked)
                {
                    exam.ExamModeId = 1;
                }
                else
                {
                    exam.ExamModeId = 2;
                }

                exam.IsAutoScore    = chAutoScore.Checked;
                exam.CanSeeAnswer   = chSeeAnswer.Checked;
                exam.CanSeeScore    = chSeeScore.Checked;
                exam.IsPublicScore  = chPublicScore.Checked;
                exam.IsUnderControl = chUD.Checked;
                exam.paperId        = 0;
                exam.MaxExamTimes   = 1;
                exam.MinExamTimes   = 0;
                exam.BeginTime      = DateTime.Parse(dateBeginTime.DateValue.ToString());
                exam.EndTime        = DateTime.Parse(dateEndTime.DateValue.ToString());
                exam.ExamTypeId     = 1;
                exam.CreateTime     = DateTime.Now;
                exam.Description    = txtDescription.Text;
                exam.ExamTime       = int.Parse(txtExamTime.Text);
                exam.StatusId       = 1;

                exam.AutoSaveInterval = 0;
                exam.OrgId            = PrjPub.CurrentLoginUser.StationOrgID;

                int id = examBLL.AddExam(exam);
                strID = id.ToString();

                Response.Redirect("ExamManageSecond.aspx?mode=" + strMode + "&id=" + strID);
            }
            else if (strMode == "Edit")
            {
                strID = Request.QueryString.Get("id");

                exam.ExamName = txtExamName.Text;
                exam.Memo     = txtMemo.Text;
                exam.ExamId   = int.Parse(strID);
                exam.ExamTime = int.Parse(txtExamTime.Text);
                if (rbExamMode1.Checked)
                {
                    exam.ExamModeId = 1;
                }
                else
                {
                    exam.ExamModeId = 2;
                }

                exam.BeginTime = DateTime.Parse(dateBeginTime.DateValue.ToString());
                exam.EndTime   = DateTime.Parse(dateEndTime.DateValue.ToString());

                exam.IsAutoScore    = chAutoScore.Checked;
                exam.CanSeeAnswer   = chSeeAnswer.Checked;
                exam.CanSeeScore    = chSeeScore.Checked;
                exam.IsPublicScore  = chPublicScore.Checked;
                exam.IsUnderControl = chUD.Checked;
                exam.MaxExamTimes   = 1;
                exam.MinExamTimes   = 0;

                exam.ExamTypeId       = 1;
                exam.Description      = txtDescription.Text;
                exam.AutoSaveInterval = 0;
                examBLL.UpdateExam(exam);

                ExamResultBLL reBll = new ExamResultBLL();

                IList <RailExam.Model.ExamResult> examResults = reBll.GetExamResultByExamID(int.Parse(strID));
                if (examResults.Count > 0)
                {
                    Response.Redirect("SelectEmployeeDetail.aspx?mode=" + strMode + "&id=" + strID);
                }
                else
                {
                    Response.Redirect("ExamManageSecond.aspx?mode=" + strMode + "&id=" + strID);
                }
            }
            else
            {
                strID = Request.QueryString.Get("id");
                ExamResultBLL reBll = new ExamResultBLL();

                IList <RailExam.Model.ExamResult> examResults = reBll.GetExamResultByExamID(int.Parse(strID));
                if (examResults.Count > 0)
                {
                    Response.Redirect("SelectEmployeeDetail.aspx?mode=" + strMode + "&id=" + strID);
                }
                else
                {
                    Response.Redirect("ExamManageSecond.aspx?mode=" + strMode + "&id=" + strID);
                }
            }
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange != 1)
                //{
                //    HfUpdateRight.Value = "False";
                //    HfDeleteRight.Value = "False";
                //}
                //else
                //{
                //    HfUpdateRight.Value = PrjPub.HasEditRight("考试设计").ToString();
                //    HfDeleteRight.Value = PrjPub.HasDeleteRight("考试设计").ToString();
                //}
                if (PrjPub.HasEditRight("考试设计") && PrjPub.IsServerCenter)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("考试涉及") && PrjPub.IsServerCenter)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }

                hfOrgID.Value          = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                HfExamCategoryId.Value = Request.QueryString.Get("id");
                Grid1.DataBind();
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    ExamResultBLL reBll = new ExamResultBLL();
                    IList <RailExam.Model.ExamResult> examResults = reBll.GetExamResultByExamID(int.Parse(strDeleteID));

                    if (examResults.Count > 0)
                    {
                        SessionSet.PageMessage = "已有考生参加考试,该考试不能被删除!";
                        Grid1.DataBind();
                        return;
                    }



                    DeleteData(int.Parse(strDeleteID));
                    Grid1.DataBind();
                }

                if (Request.Form.Get("Refresh") == "true")
                {
                    Grid1.DataBind();
                }

                if (Request.Form.Get("OutPut") != null && Request.Form.Get("OutPut") != "")
                {
                    OutputData(Request.Form.Get("OutPut"));
                }
            }
        }