Example #1
0
    protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        try
        {

            //if (TextBoxBannerID.Text.Length < 1 && Date1.CalendarDateString=="")
            if (TextBoxBannerID.Text.Length < 1 && Date1.CalendarDateString == "")
            {
                LabelMsg.Text = "Please Enter BannerID or Date of Birth";
                return;
            }
            if (TextBoxFirstName.Text.Length < 1)
            {
                LabelMsg.Text = "Please Enter First Name";
                TextBoxFirstName.Focus();
                return;

            }
            if (TextBoxLastName.Text.Length < 1)
            {
                LabelMsg.Text = "Please Enter Last Name";
                TextBoxLastName.Focus();
                return;

            }
            else
            {
                string aid = (Session["aoid"] != null) ? Session["aoid"].ToString() : "0";

                string firstName = "", lastName = "", bannerID = "", studentName = "", creditQuestion = "", term = "", program = "", middleName = "";
                string dob = "";

                firstName = TextBoxFirstName.Text.Trim();
                lastName = TextBoxLastName.Text.Trim();
                if (TextBoxMiddleName.Value != "")
                {
                    middleName = TextBoxMiddleName.Value.Trim();
                }
                bannerID = TextBoxBannerID.Text.Trim();

                studentName = lastName + ", " + firstName + " " + middleName;
                //creditQuestion = TextBoxPrior.Text;
                term = TextBoxTerm.Text;
                //program = TextBoxProgram.SelectedItem.Text;
                if (Date1.CalendarDateString != "")
                {
                    dob = DateTime.Parse(Date1.CalendarDateString).ToString();
                }
                Student std = new Student();
                // std = std.GetValidStudentsForAssessment(bannerID, studentName,term,program);
                std = std.GetValidStudentsForAssessment(bannerID, firstName, middleName, lastName, term, dob);
                Answer ans = new Answer();
                ans = ans.CheckBannerID_Answer(bannerID, Convert.ToInt32(aid));
                if (ans != null)
                {
                    LabelMsg.Text = "This Student already take this Assessment....";
                }

                else if (std != null)
                {

                    Session["currentStd"] = std;
                    //Response.Redirect("ExamHome.aspx?aid=" + aid, false);
                    Response.Redirect("QuestionSheet.aspx?aoid=" + aid, false);
                }
                else
                {
                    LabelMsg.Text = "Student does not exist with your provided information";
                }

            }

        }
        catch (Exception ex)
        {
            LabelMsg.Text = "Student does not exist with your provided information";
        }
    }