コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //Authenticate the user
     if (Session["userId"] != null)
     {
         string s = Session["userId"].ToString();
         studentId = Convert.ToInt32(s);
     }
     else
     {
         Response.Redirect("~/Login.aspx");
     }
     if (!IsPostBack)
     {
         lblQuizId.Text = myDecryption(HttpUtility.UrlDecode(Request.QueryString["id"]));
         bool status = proxy1.GetStdudentAttempt(studentId, Convert.ToInt32(lblQuizId.Text));
         professor_Quiz_WCFLib.quizModel qM = proxy.GetQuizById(Convert.ToInt32(lblQuizId.Text));
         weight            = qM.quiz_weightage;
         lblQuizTitle.Text = qM.quiz_title;
         if (status)
         {
             GetQuizData(Convert.ToInt32(lblQuizId.Text));
         }
         else
         {
             lblAlready.Visible = true;
         }
     }
 }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Authenticate the user
            if (Session["userId"] != null)
            {
                string s = Session["userId"].ToString();
                profId = Convert.ToInt32(s);
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }
            if (!IsPostBack)
            {
                lblQuizId.Text = myDecryption(HttpUtility.UrlDecode(Request.QueryString["ID"]));
                professor_Quiz_WCFLib.quizModel qModel = proxy.GetQuizById(Convert.ToInt32(lblQuizId.Text));
                if (System.DateTime.Now < qModel.quiz_end_date)
                {
                    GetQuizData(Convert.ToInt32(lblQuizId.Text));


                    lblCurrentQuiz.Text = qModel.quiz_title;
                    txtTitle.Value      = qModel.quiz_title;
                    lblStartDate.Text   = qModel.quiz_date.ToString();
                    lblEndDate.Text     = qModel.quiz_end_date.ToString();
                    if (qModel.isTimeup == 1)
                    {
                        rdbTimeUp.Checked = true;
                    }
                    else
                    {
                        rdbTimeUp1.Checked = false;
                    }
                    moduleId           = qModel.FK_ModuleId;
                    txtLength.Value    = qModel.quiz_length.ToString();
                    txtWeightage.Value = qModel.quiz_weightage.ToString();
                    txtEndDate.Value   = qModel.quiz_end_date.ToString();
                }
                else
                {
                    //btnAddOption.Enabled = false;
                    //btnMultAdd.Enabled = false;
                    //btnMultDelete.Enabled = false;
                    //btnOptionDelete.Enabled = false;
                    //btnSave.Enabled = false;
                    //btnUpdateQuiz.Enabled = false;
                }
            }
            placeHolder();
        }
コード例 #3
0
        protected void btnCreateQuiz_Click(object sender, EventArgs e) //Create new Quiz
        {
            try
            {
                professor_Quiz_WCFLib.quizModel quizM = new professor_Quiz_WCFLib.quizModel(); // initialise the question model
                quizM.FK_Professor_id = Convert.ToInt32(profId);                               // professor Id for
                quizM.quiz_title      = txtTitle.Value.Trim();
                quizM.FK_ModuleId     = Convert.ToInt32(ddlModule.SelectedItem.Value);
                //  var d = DateTime.Parse(txtDate.Value);
                // var t = DateTime.Parse(txtTime.Value);
                //var start = d + t - t.Date ; //Concate start time
                quizM.quiz_date = DateTime.Parse(txtDate.Value);

                if (rdbTimeUp.Checked)
                {
                    quizM.isTimeup = 1;
                }
                else if (rdbTimeUp1.Checked)
                {
                    quizM.isTimeup = 0;
                }
                quizM.quiz_length    = float.Parse(txtLength.Value.Trim());
                quizM.quiz_weightage = float.Parse(txtWeightage.Value.Trim());
                quizM.quiz_end_date  = Convert.ToDateTime(txtEndDate.Value); //Concate End time ;

                int res = proxy.CreateQuiz(quizM);                           // Return is quiz Id
                //int res = 5;
                if (res > 1)                                                 // If it is successfull then check and proceed further
                {
                    lblError.Visible = false;
                    lblQuizId.Text   = res.ToString();
                    lblQuizName.Text = quizM.quiz_title;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "showQuestions()", true);
                }
                else
                {
                    lblError.Text    = "There is an error in the Quiz Creation. Please try again.";
                    lblError.Visible = true;
                }
            }
            catch (Exception ex)
            {
                Session["Error"] = ex.ToString();
                Response.Redirect("~/Error.aspx");
            }
        }
コード例 #4
0
        protected void btnUpdateQuiz_Click(object sender, EventArgs e)
        {
            try{
                professor_Quiz_WCFLib.quizModel qModel = new professor_Quiz_WCFLib.quizModel();

                if (txtDate.Value == "" || txtTime.Value == "")
                {
                    qModel.quiz_date = Convert.ToDateTime(lblStartDate.Text.Trim());
                }
                else
                {
                    DateTime ds = Convert.ToDateTime(txtDate.Value);
                    qModel.quiz_date = ds.Add(TimeSpan.Parse(txtTime.Value));
                }
                if (txtEndDate.Value == "" || txtEndTime.Value == "")
                {
                    qModel.quiz_end_date = Convert.ToDateTime(lblEndDate.Text.Trim());
                }
                else
                {
                    DateTime d1 = Convert.ToDateTime(txtEndDate.Value);
                    qModel.quiz_end_date = d1.Add(TimeSpan.Parse(txtEndTime.Value));
                }

                int i = 0;
                if (rdbTimeUp.Checked)
                {
                    i = 1;
                }
                qModel.isTimeup        = i;
                qModel.quiz_title      = txtTitle.Value.Trim();
                qModel.PK_Quiz_id      = Convert.ToInt32(lblQuizId.Text);
                qModel.FK_Professor_id = profId;
                qModel.FK_ModuleId     = moduleId;
                qModel.quiz_status     = 1;
                qModel.quiz_length     = float.Parse(txtLength.Value);
                qModel.quiz_weightage  = float.Parse(txtWeightage.Value);
                bool res = proxy.UpdateQuiz(qModel);
                //Response.Redirect(Request.RawUrl);
            }
            catch (Exception ex)
            {
                Session["Error"] = ex.ToString();
                Response.Redirect("~/Error.aspx");
            }
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Authenticate the user

            if (Session["userId"] != null)
            {
                string s = Session["userId"].ToString();
                profId = Convert.ToInt32(s);
            }

            else
            {
                Response.Redirect("~/Login.aspx");
            }
            if (!IsPostBack)
            {
                lblQuizId.Text = myDecryption(HttpUtility.UrlDecode(Request.QueryString["ID"]));
                this.GetQuizData(Convert.ToInt32(lblQuizId.Text));
                professor_Quiz_WCFLib.quizModel qM = proxy.GetQuizById(Convert.ToInt32(lblQuizId.Text));
                weight            = qM.quiz_weightage;
                lblQuizTitle.Text = qM.quiz_title;
            }
        }