private void LoadStudentEachProgram()
 {
     Security mySecurity = new Security();
          DAL myDal = new DAL(conn);
          GVStudentEachProgram.DataSource = myDal.ExecuteProcedure("spGetStudentEachProgram");
          GVStudentEachProgram.DataBind();
 }
 private void LoadQutionNumberByExam()
 {
     Security mySecurity = new Security();
     DAL myDal = new DAL(conn);
     GVNumberofQutionbyExam.DataSource = myDal.ExecuteProcedure("spGetQutionNumberbyExam");
     GVNumberofQutionbyExam.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Security s = new Security();
     if (s.IsStudent() || !s.IsLoggedIn())
     {
         Response.Redirect("Home.aspx");
     }
 }
 public string insertQuizInformation()
 {
     Security S = new Security();
     DAL mydal = new DAL(conn);
     mydal.AddParam("@UserId", S.Userid);
     mydal.AddParam("@QuizId", (int)Session["QuizId"]);
       DataSet ds=  mydal.ExecuteProcedure("spInsertQuizInformation");
       return ds.Tables[0].Rows[0]["newQuizResponseId"].ToString();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Security mySecurity = new Security();

            if (!IsPostBack)
            {
                LoadQuizResponseByUser();
                LoadQuiz();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Security mySecurity = new Security();

            if (!IsPostBack)
            {

                LoadStudentEachProgram();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Security mySecurity = new Security();

            if (!IsPostBack)
            {

                LoadQutionNumberByExam();
            }
        }
 public void LoadAvailableExamforlogedInUser()
 {
     Security s = new Security();
     DAL mydal = new DAL(conn);
     mydal.AddParam("@UserId",s.Userid);
     DataSet ds = mydal.ExecuteProcedure("spGetActiveQuizByUser");
     string QuizName = ds.Tables[0].Rows[0]["QuizTitle"].ToString();
     lblShowQuiz.Text = QuizName;
     Session["QuizName"] = QuizName;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Security mySecurity = new Security();

            if (!IsPostBack)
            {

                LoadNumberOfStudentByProgram("ProgramName");

                Session["Column"] = "ProgramName";
            }
        }
 protected override void OnPreInit(EventArgs e)
 {
     Security s = new Security();
     if (s.IsStudent())
     {
         this.MasterPageFile = "NestedStudentMasterPage.Master";
     }
     else if(s.IsTeacher() || s.IsAdmin())
     {
         this.MasterPageFile = "NestedTeacherMasterPage.Master";
     }
     // default is neither.
 }
        private void CheckSecurity()
        {
            Security mySecurity = new Security();
            lblFirstname.Text = mySecurity.Firstname;
            if (!mySecurity.IsLoggedIn())
            {
                btnLogout.Visible = false;

            }
            else
            { //Adjust links visible according to Security Level(Admin or Regular)

                UpdatePanelLogin.Visible = false;
                pnlLogout.Visible = true;
                hlRegistration.Visible = false;
            }
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string FullEmail = txtUserName.Text;
            Security mySecurity = new Security(FullEmail, txtPassword.Text);
            if (mySecurity.IsLoggedIn())
            {

                if (mySecurity.IsTeacher()||mySecurity.IsAdmin())
                {
                    Response.Redirect("TeacherInstructions.aspx");
                }
                Response.Redirect("Home.aspx");

            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Your User Name or Password Not Correct');", true);
            }
        }
        public void updateResponses()
        {
            bool isFinish = false;
            Security s = new Security();
            DAL mydal = new DAL(conn);

            string newQuizResponseId = insertQuizInformation();

            int j = (int)Session["NumberofQuestion"];
            for (int i = 0; i < (int)Session["NumberofQuestion"]; i++)
            {
                if (Responses[i] != null)
               {
                    mydal.ClearParams();
                    mydal.AddParam("@newQuizResponseId", newQuizResponseId);
                    mydal.AddParam("@QuestionId", (i + 1).ToString());
                    mydal.AddParam("@Response", Responses[i]);
                    DataSet ds = mydal.ExecuteProcedure("spInsertQuestionResponse");
                    string Result = ds.Tables[0].Rows[0]["Result"].ToString();
                    if (Result == "success")
                    {

                        isFinish = true;
                    }
               }

            }

            if (isFinish)
            {
                Response.Redirect("FinishExam.aspx");
            }
            else
            {
                //to do
            }
        }
        public string GetRole()
        {
            string role = string.Empty;

                Security mySecurity = new Security();
                if (mySecurity.GetSecurityLevel() == 3)
                {
                    role = "admin";
                }

                else if (mySecurity.GetSecurityLevel() == 2)
                {
                    role = "Teacher";
                }

                else if (mySecurity.GetSecurityLevel() == 1)
                {
                    role = "student";
                }
                return role;
        }
Beispiel #15
0
        protected void btnfinish_Click1(object sender, EventArgs e)
        {
            Security s=new Security();
            DAL mydal = new DAL(conn);
             //  mydal.AddParam("@QuizResponseId",);
            for (int i=0;i<(int)Session["NumberofQuestion"];i++)
            {
                mydal.ClearParams();
              mydal.AddParam("@UserId",s.Userid);
              mydal.AddParam("@QuizId", (int)Session["QuizId"]);

                mydal.AddParam("@QuestionId",(i+1).ToString());
              mydal.AddParam("@Response",Responses[i]);
              mydal.ExecuteProcedure("spInsertQuestionResponse");
            }
        }