/// <summary>
 ///Handle Button Login click event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ButtonLogin_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         var studentManage  = new StudentManage();
         var auth           = new Authenticator();
         var am             = new AdmissionManage();
         var registrationId = 0;
         try
         {
             registrationId = am.GetAdmisionIdFromString(txtEnrollNumber.Text);
         }
         catch (Exception)
         {
             ShowMessage("Invalid Enrollnumber");
         }
         var password = auth.EncodePassword(txtPassword.Text);
         var ds       = studentManage.StudentLogin(registrationId, password);
         if (ds.Tables[0].Rows.Count == 0)
         {
             ShowMessage("Login failed. Invalid Enrollnumber or Password");
         }
         else
         {
             Session["student"]       = txtEnrollNumber.Text;
             StudentLoginForm.Visible = false;
             Page.ClientScript.RegisterClientScriptBlock(GetType(), "alert", "alert('Welcome: " + txtEnrollNumber.Text + "');document.location.href='Student.aspx';", true);
         }
     }
 }