Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblName.Text = PrjPub.CurrentStudent.EmployeeName;
                OrganizationBLL objOrgBll = new OrganizationBLL();
                lblOrg.Text  = objOrgBll.GetOrganization(PrjPub.CurrentStudent.StationOrgID).ShortName;
                lblPost.Text = PrjPub.CurrentStudent.PostName;

                ExamResultBLL objBll = new ExamResultBLL();
                ViewState["NowOrgID"] = Convert.ToInt32(ConfigurationManager.AppSettings["StationID"]);
                IList <RailExam.Model.ExamResult> objList = objBll.GetExamResults(PrjPub.StudentID, 0);
                gvExam.DataSource = objList;
                gvExam.DataBind();

                hfOrgID.Value    = ConfigurationManager.AppSettings["StationID"].ToString();
                hfIsServer.Value = PrjPub.IsServerCenter.ToString();

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

                if (Request.Form.Get("OutPutRandom") != null && Request.Form.Get("OutPutRandom") != "")
                {
                    OutputRandomExam(Request.Form.Get("OutPutRandom"));
                }
            }
        }
Ejemplo n.º 2
0
        private void OutputRandomExam(string strName)
        {
            ExamResultBLL objBll = new ExamResultBLL();
            IList <RailExam.Model.ExamResult> objList = objBll.GetExamResults(PrjPub.StudentID, 0);

            gvExam.DataSource = objList;
            gvExam.DataBind();

            string filename = Server.MapPath("/RailExamBao/Excel/Word.doc");

            if (File.Exists(filename))
            {
                FileInfo file = new FileInfo(filename.ToString());
                this.Response.Clear();
                this.Response.Buffer          = true;
                this.Response.Charset         = "utf-7";
                this.Response.ContentEncoding = Encoding.UTF7;
                // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
                this.Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(strName) + ".doc");
                // 添加头信息,指定文件大小,让浏览器能够显示下载进度
                this.Response.AddHeader("Content-Length", file.Length.ToString());
                // 指定返回的是一个不能被客户端读取的流,必须被下载
                this.Response.ContentType = "application/ms-word";
                // 把文件流发送到客户端
                this.Response.WriteFile(file.FullName);
            }
        }
Ejemplo n.º 3
0
        protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
        {
            this.labelTitle.Text = "考试成绩";
            Grid1.Visible        = false;
            Grid2.Visible        = false;
            Grid3.Visible        = false;
            Grid4.Visible        = true;

            string        struesrId = PrjPub.StudentID;
            ExamResultBLL bkLL      = new ExamResultBLL();
            IList <RailExam.Model.ExamResult> ExamList2 = bkLL.GetExamResults(struesrId, 8000);

            this.Grid4.DataSource = ExamList2;
            this.Grid4.DataBind();
        }
Ejemplo n.º 4
0
        protected DataSet GetDataSet()
        {
            string  qsTypeId = Request.QueryString.Get("type");
            string  qsExamId = Request.QueryString.Get("eid");
            DataSet ds       = new DataSet();

            if (!string.IsNullOrEmpty(qsTypeId) && !string.IsNullOrEmpty(qsExamId))
            {
                int     nOrganizationId     = string.IsNullOrEmpty(hfOrganizationId.Value) ? PrjPub.DEFAULT_INT_IN_DB : int.Parse(hfOrganizationId.Value);
                string  strExamineeName     = string.IsNullOrEmpty(txtExamineeName.Text) ? string.Empty : txtExamineeName.Text;
                decimal dScoreLower         = string.IsNullOrEmpty(txtScoreLower.Text) ? 0 : decimal.Parse(txtScoreLower.Text);
                decimal dScoreUpper         = string.IsNullOrEmpty(txtScoreUpper.Text) ? 500 : decimal.Parse(txtScoreUpper.Text);
                int     nExamStatusId       = string.IsNullOrEmpty(ddlStatusId.SelectedValue) ? PrjPub.DEFAULT_INT_IN_DB : int.Parse(ddlStatusId.SelectedValue);
                string  strOrganizationName = string.IsNullOrEmpty(txtOrganizationName.Text) ? string.Empty : txtOrganizationName.Text;

                ExamResultBLL bllExamResult = new ExamResultBLL();
                IList <RailExam.Model.ExamResult> examResults = bllExamResult.GetExamResults(
                    int.Parse(qsExamId), strOrganizationName, strExamineeName, string.Empty, dScoreLower,
                    dScoreUpper, nExamStatusId);

                ExamResultStatusBLL bllExamResultStatus = new ExamResultStatusBLL();
                IList <RailExam.Model.ExamResultStatus> examResultStatuses = bllExamResultStatus.GetExamResultStatuses();

                DataTable dtExamResults = ConvertToDataTable((IList)examResults);


                DataTable dtExamResultStatuses = ConvertToDataTable((IList)examResultStatuses);

                if (dtExamResults != null)
                {
                    ds.Tables.Add(dtExamResults);
                }
                else
                {
                    ds.Tables.Add(ConvertToDataTable(typeof(RailExam.Model.ExamResult)));
                }
                ds.Tables.Add(dtExamResultStatuses);
                ds.Relations.Add(ds.Tables["ExamResultStatus"].Columns["ExamResultStatusId"],
                                 ds.Tables["ExamResult"].Columns["StatusId"]);
            }

            return(ds);
        }
Ejemplo n.º 5
0
        protected DataSet GetDataSet()
        {
            string  qsTypeId = Request.QueryString.Get("type");
            string  qsExamId = Request.QueryString.Get("eid");
            int     orgID    = Convert.ToInt32(Request.QueryString.Get("OrgID"));
            DataSet ds       = new DataSet();

            if (!string.IsNullOrEmpty(qsTypeId) && !string.IsNullOrEmpty(qsExamId))
            {
                int     nOrganizationId     = string.IsNullOrEmpty(hfOrganizationId.Value) ? PrjPub.DEFAULT_INT_IN_DB : int.Parse(hfOrganizationId.Value);
                string  strExamineeName     = string.IsNullOrEmpty(txtExamineeName.Text) ? string.Empty : txtExamineeName.Text;
                string  strWorkNo           = string.IsNullOrEmpty(txtWorkNo.Text) ? string.Empty : txtWorkNo.Text;
                decimal dScoreLower         = string.IsNullOrEmpty(txtScoreLower.Text) ? 0 : decimal.Parse(txtScoreLower.Text);
                decimal dScoreUpper         = string.IsNullOrEmpty(txtScoreUpper.Text) ? 500 : decimal.Parse(txtScoreUpper.Text);
                int     nExamStatusId       = string.IsNullOrEmpty(ddlStatusId.SelectedValue) ? PrjPub.DEFAULT_INT_IN_DB : int.Parse(ddlStatusId.SelectedValue);
                string  strOrganizationName = string.IsNullOrEmpty(txtOrganizationName.Text) ? string.Empty : txtOrganizationName.Text;

                IList <RailExam.Model.ExamResult> examResults = null;
                ExamResultBLL bllExamResult = new ExamResultBLL();

                try
                {
                    if (orgID == 1)
                    {
                        examResults = bllExamResult.GetExamResults(int.Parse(qsExamId), strOrganizationName, strExamineeName, strWorkNo, dScoreLower,
                                                                   dScoreUpper, nExamStatusId);
                    }
                    else
                    {
                        examResults = bllExamResult.GetExamResultsByOrgID(
                            int.Parse(qsExamId), strOrganizationName, strExamineeName, strWorkNo, dScoreLower,
                            dScoreUpper, nExamStatusId, orgID);
                    }
                }
                catch
                {
                    Pub.ShowErrorPage("无法连接站段服务器,请检查站段服务器是否打开以及网络连接是否正常!");
                }

                ExamResultStatusBLL bllExamResultStatus = new ExamResultStatusBLL();
                IList <RailExam.Model.ExamResultStatus> examResultStatuses = bllExamResultStatus.GetExamResultStatuses();

                DataTable dtExamResults        = ConvertToDataTable((IList)examResults);
                DataTable dtExamResultStatuses = ConvertToDataTable((IList)examResultStatuses);

                if (dtExamResults != null)
                {
                    ds.Tables.Add(dtExamResults);
                }
                else
                {
                    ds.Tables.Add(ConvertToDataTable(typeof(RailExam.Model.ExamResult)));
                }

                ds.Tables.Add(dtExamResultStatuses);
                ds.Relations.Add(ds.Tables["ExamResultStatus"].Columns["ExamResultStatusId"],
                                 ds.Tables["ExamResult"].Columns["StatusId"]);
            }

            return(ds);
        }