Exemple #1
0
    protected void LoginSubmit_Click(object sender, EventArgs e)
    {
        UserService us1 = new UserService();
        DataSet     ds  = us1.Login(LoginIdTB.Text, LoginPasswordTB.Text);

        if (ds.Tables[0].Rows.Count == 1)
        {
            Label6.Text = "התחברת בהצלחה";
            UserService us = new UserService();
            us.UpdateLastLoginDate(LoginIdTB.Text, DateTime.Now);
            User u = GetAllData.GetAllUserDataById(LoginIdTB.Text);
            Session["user"] = u;
            Response.Redirect("http://localhost:49675/Personal.aspx");
        }
        else
        {
            DoctorService doc1 = new DoctorService();
            DataSet       ds1  = doc1.DoctorLogin(LoginIdTB.Text, LoginPasswordTB.Text);
            if (ds1.Tables[0].Rows.Count == 1)
            {
                Doctor d = GetAllData.GetAllDoctorDataById(LoginIdTB.Text);
                Session["doctor"] = d;
                Response.Redirect("http://localhost:49675/DoctorInfo.aspx");
                Label6.Text = "התחברת בהצלחה";
            }
            else
            {
                ManagerService ms  = new ManagerService();
                DataSet        ds2 = ms.ManagerLogin(LoginIdTB.Text, LoginPasswordTB.Text);
                if (ds2.Tables[0].Rows.Count == 1)
                {
                    Manager m = GetAllData.GetAllManagerDataById(LoginIdTB.Text);
                    Session["manager"] = m;
                    Response.Redirect("http://localhost:49675/ManagerHome.aspx");
                }
                else
                {
                    Label6.Text = "תעודת זהות או סיסמא אינם נכונים";
                }
            }
        }
    }
 public Doctor DoctorLogin(string username, string password)
 {
     return(doctorService.DoctorLogin(username, password));
 }