void Process_StartExam()
        {
            Configuration Cfg = new Configuration();
            Cfg.LoadConfig(this.Master);

            Int64 NoItemsTotal = Cfg.pNoItemsTotal;
            Int64 NoItemsPerPage = Cfg.pNoItemsPerPage;

            ClsApplicant Obj_Applicant = new ClsApplicant();
            Obj_Applicant.Load();
            Obj_Applicant.pDr["Name"] = this.Txt_Name.Text;
            Obj_Applicant.pDr["Email"] = this.Txt_Email.Text;

            ClsExam Obj_Exam = new ClsExam();
            Obj_Exam.GenerateExam(NoItemsTotal, NoItemsPerPage, Obj_Applicant, Do_Methods.Convert_Int64(this.Cbo_Category.SelectedValue));
            this.Session[Layer01_Constants_Web.CnsSession_Exam_Obj] = Obj_Exam;
            this.Session[Layer01_Constants_Web.CnsSession_Exam_IsSession] = true;

            this.pCurrentUser.Logoff();

            this.Response.Redirect(@"~/Page/Exam.aspx");
        }
        protected override void Page_Load(object sender, EventArgs e)
        {
            if (this.pIsPageLoaded) { return; }
            base.Page_Load(sender, e);

            //[-]

            this.Page.LoadComplete += new EventHandler(Page_LoadComplete);

            bool IsFinish = false;
            try
            { IsFinish = (bool)this.Session[Layer01_Constants_Web.CnsSession_Exam_IsFinish]; }
            catch { }

            if (!IsFinish)
            { this.Response.Redirect("~/Page/ExamStart.aspx"); }

            this.Session[Layer01_Constants_Web.CnsSession_Exam_IsFinish] = false;
            this.mObj_Exam = (ClsExam)this.Session[Layer01_Constants_Web.CnsSession_Exam_Obj];
            this.Lbl_ApplicantName.Text = (string)Do_Methods.IsNull(this.mObj_Exam.pObj_Applicant.pDr["Name"], "");
            this.Lbl_Score.Text = Do_Methods.IsNull(this.mObj_Exam.pDr_Exam["Score"], 0).ToString() + " out of " + Do_Methods.IsNull(this.mObj_Exam.pDr_Exam["TotalItems"], 0).ToString() + " Items.";
        }
Пример #3
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            //[-]

            if (this.pIsPageLoaded) { return; }
            base.Page_Load(sender, e);

            this.Btn_First.Click += new EventHandler(Btn_First_Click);
            this.Btn_Previous.Click += new EventHandler(Btn_Previous_Click);
            this.Btn_Next.Click += new EventHandler(Btn_Next_Click);
            this.Btn_Last.Click += new EventHandler(Btn_Last_Click);
            this.Cbo_Page.SelectedIndexChanged += new EventHandler(Cbo_Page_SelectedIndexChanged);
            this.Btn_Submit.Click += new EventHandler(Btn_Submit_Click);
            this.Btn_BackToExamReport.Click += new EventHandler(Btn_BackToExamReport_Click);
            this.Btn_Export.Click += new EventHandler(Btn_Export_Click);

            //[-]

            // Check if session exists, if not warn the user or redirect page to ExamStart.aspx
            try { mIsSession = (bool)this.Session[Layer01_Constants_Web.CnsSession_Exam_IsSession]; }
            catch { }

            if (!this.mIsReadOnly)
            {
                if (!mIsSession)
                {
                    //Exam is not in progress
                    this.Response.Redirect("ExamStart.aspx");
                }
                this.mObj_Exam = (ClsExam)this.Session[Layer01_Constants_Web.CnsSession_Exam_Obj];
            }

            try { this.mCurrentPage = Do_Methods.Convert_Int64(this.ViewState[CnsCurrentPage].ToString()); }
            catch { this.mCurrentPage = 1; }

            //[-]

            if (!this.IsPostBack)
            { this.SetupPage(); }
            else
            {
                if (this.mIsReadOnly)
                {
                    this.mObjID = (string)this.ViewState[CnsObjID];
                    this.mObj_Exam = (ClsExam)this.Session[CnsPage + this.mObjID];
                }

                this.mList_Questions = this.SetupPage_Questions();
            }
        }
Пример #4
0
        void SetupPage()
        {
            if (this.mIsReadOnly)
            {
                if (!this.pCurrentUser.CheckAccess(this.pSystem_ModulesID, Layer02_Constants.eAccessLib.eAccessLib_View))
                { throw new CustomException("Access Denied."); }

                this.mObj_Exam = new ClsExam();
                this.mObj_Exam.LoadExam(this.mExamID, this.mLimit);

                this.mObjID = this.Master.pCurrentUser.GetNewPageObjectID();
                this.ViewState[CnsObjID] = this.mObjID;
                this.Session[CnsPage + this.mObjID] = this.mObj_Exam;

                //[-]

                this.Panel_Title.Visible = true;
                this.Lbl_Applicant.Text = Do_Methods.Convert_String(this.mObj_Exam.pObj_Applicant.pDr["Name"], "");
                DateTime? DateTaken = Do_Methods.Convert_DateTime(this.mObj_Exam.pDr_Exam["DateTaken"]);
                this.Lbl_DateTaken.Text = DateTaken != null ? DateTaken.Value.ToShortDateString() : "";

                this.mTitle = "Exam Report of " + this.Lbl_Applicant.Text;
            }
            else
            { this.mTitle = "Applicant Exam"; }

            //[-]

            this.SetupPage_Questions();

            //[-]

            this.Lbl_Page.Text = "Page " + this.mCurrentPage + " of " + this.mObj_Exam.pPages;

            this.Btn_First.Enabled = true;
            this.Btn_Previous.Enabled = true;
            this.Btn_Next.Enabled = true;
            this.Btn_Last.Enabled = true;
            this.Btn_Submit.Visible = false;
            this.Panel_Report.Visible = false;

            if (this.mCurrentPage <= 1)
            {
                this.Btn_First.Enabled = false;
                this.Btn_Previous.Enabled = false;
            }

            if (this.mCurrentPage >= this.mObj_Exam.pPages)
            {
                this.Btn_Next.Enabled = false;
                this.Btn_Last.Enabled = false;

                this.Btn_Submit.Visible = !this.mIsReadOnly;
            }

            this.Panel_Report.Visible = this.mIsReadOnly;

            DataTable Dt_Page = new DataTable();

            Dt_Page.Columns.Add("Page", typeof(Int64));

            for (Int64 Ct = 1; Ct <= this.mObj_Exam.pPages; Ct++)
            {
                List<QueryParameter> List_Sp = new List<QueryParameter>();
                List_Sp.Add(new QueryParameter("Page", Ct));
                Do_Methods.AddDataRow(ref Dt_Page, List_Sp);
            }

            Methods_Web.BindCombo(ref this.Cbo_Page, Dt_Page, "Page", "Page");

            try { this.Cbo_Page.SelectedValue = this.mCurrentPage.ToString(); }
            catch { }
        }