예제 #1
0
    protected void ButtonLogin_Click(object sender, EventArgs e)
    {
        client.Login(TextBoxEmailLogin.Text, TextBoxPasswordLogin.Text);
        Response.Write(client.Login(TextBoxEmailLogin.Text, TextBoxPasswordLogin.Text));

        if (client.Login(TextBoxEmailLogin.Text, TextBoxPasswordLogin.Text).Trim().Equals("You have successfully logged in."))
        {
            Session["New"] = TextBoxEmailLogin.Text;

            if (client.GetUserType(TextBoxEmailLogin.Text).Trim().Equals("Student"))
            {
                ServiceReference1.MdlStudent student = (ServiceReference1.MdlStudent)client.GetStudentData(TextBoxEmailLogin.Text);
                storeStudentObjToSession(student);
                Response.Redirect("MainPageStudent.aspx");
            }
            else
            {
                ServiceReference1.MdlLandlord landlord = (ServiceReference1.MdlLandlord)client.GetLandlordData(TextBoxEmailLogin.Text);
                storeLandlordObjToSession(landlord);
                Response.Redirect("MainPageLandlord.aspx");
            }
        }
        else
        {
            LabelNotCorrect.Visible = true;
        }
    }