protected void ButtonLogin_Click(object sender, EventArgs e) { User usr = UserDataProcess.controlUser(TextBoxLoginNick.Text, InputLoginPassword.Value); User admin = AdminDataProcess.controlAdmin(TextBoxLoginNick.Text, InputLoginPassword.Value); LabelNoUser.Text = ""; if (usr != null) { if (admin != null) { Session["AuthenticatedAdminData"] = admin; UserDataProcess.UpdateUserOnline(admin.UserId, true); } else { Session["AuthenticatedUserData"] = usr; UserDataProcess.UpdateUserOnline(usr.UserId, true); } Response.Redirect("HomeLibrary.aspx"); } else { LabelNoUser.Text = "No Authentication!"; } }
protected void ButtonLogOut_Click(object sender, EventArgs e) { if (Session["AuthenticatedUserData"] != null) { User user = (User)Session["AuthenticatedUserData"]; UserDataProcess.UpdateUserOnline(user.UserId, false); } else if (Session["AuthenticatedAdminData"] != null) { User admin = (User)Session["AuthenticatedAdminData"]; UserDataProcess.UpdateUserOnline(admin.UserId, false); } Session["AuthenticatedUserData"] = null; Session["AuthenticatedAdminData"] = null; ButtonLogOut.Visible = false; ButtonLogIn.Visible = true; LinkButton1.Visible = false; ButtonOrder.Visible = false; Response.Redirect("Default.aspx"); }