protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            Session["SelectedAnswer"] = SubmittedAnswer.Text;

            if (SubmittedAnswer.Text == "")
            {
                Responselbl.Attributes.Add("class", "alert alert-danger");
                Responselbl.Text = "You cannot sumbit a blank answer!";
            }
            else if (IsAnagram(Session["SelectedAnswer"].ToString(), Session["Word"].ToString()) && Session["SelectedAnswer"].ToString() != Session["Answer"].ToString())
            {
                Responselbl.Attributes.Add("class", "alert alert-warning");
                Responselbl.Text = "Check spelling!";
            }
            else if (Session["SelectedAnswer"].ToString().Equals(Session["Answer"].ToString()))
            {
                Responselbl.Attributes.Add("class", "alert alert-success");
                Responselbl.Text   = "Correct! Here's a new definition";
                LabelNumTotal.Text = NumTotal.Inc(Session, NumTotal_def2word, 1);                 // Canny v0.15
                CorrectAnswerUpdate();
                Clear();
                GenerateNewQuestion();
            }
            else
            {
                Responselbl.Attributes.Add("class", "alert alert-danger");
                Responselbl.Text     = "Incorrect, Try Again";
                LabelNumTotal.Text   = NumTotal.Inc(Session, NumTotal_def2word, 0);               // Canny v0.15
                SubmittedAnswer.Text = "";
                AttemptUpdate();
                SubmittedAnswer.Text = "";
            }
        }
Exemple #2
0
        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            Session["SelectedAnswer"] = AnswerList.SelectedValue;

            if (AnswerList.SelectedIndex == -1)
            {
                Responselbl.Attributes.Add("class", "alert alert-danger");
                Responselbl.Text = "You must choose an answer!";
            }
            else if (Session["SelectedAnswer"].ToString().Equals(Session["Answer"].ToString()))
            {
                Responselbl.Attributes.Add("class", "alert alert-success");
                Responselbl.Text   = "Correct! Here's a new word";
                LabelNumTotal.Text = NumTotal.Inc(Session, NumTotal_word2def, 1);                 // Canny v0.15
                CorrectAnswerUpdate();
                HintIncUpdate();
                Clear();
                GenerateNewQuestion();
            }
            else
            {
                Responselbl.Attributes.Add("class", "alert alert-danger");
                Responselbl.Text   = "Incorrect, Try Again";
                LabelNumTotal.Text = NumTotal.Inc(Session, NumTotal_word2def, 0);                 // Canny v0.15
                AnswerList.Items[AnswerList.SelectedIndex].Enabled = false;
                AttemptUpdate();
                LabelNumTotal.Text = NumTotal.Inc(Session, NumTotal_word2def, 0);                 // Canny v0.15
            }
        }
Exemple #3
0
        static public string Inc(HttpSessionState sesState, string ses_id, int num)
        {
            NumTotal numTotal = (NumTotal)sesState[ses_id];

            numTotal.Inc(num);
            sesState[ses_id] = numTotal;
            return(numTotal.toStr());
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     CheckLoggedIn();
     CheckResortValue();
     if (!IsPostBack)
     {
         Session[NumTotal_def2word] = new NumTotal();                 // v0.15
         CheckWordTotal();
         Clear();
         GenerateNewQuestion();
     }
     SubmittedAnswer.Focus();             // Canny, v0.1.1
 }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckLoggedIn();

            CheckResortValue();

            if (!IsPostBack)
            {
                Session[NumTotal_word2def] = new NumTotal();                 // v0.15

                CheckWordTotal();
                Clear();
                GenerateNewQuestion();
            }
        }