protected void btnLogin_Click(object sender, EventArgs e) { var query = new Query(); var user = query.login(txtUsername.Text, txtPassword.Text); query.Dipose(); if (user != null) { if ((user.Avatar == null) || (user.Avatar.Equals(""))) { user.Avatar = "images/sidebar/profile.png"; } Session["user"] = user; Session["userID"] = user.User_ID; // Create authentication ticket var auth = new Controller.LanbanAuthentication(); auth.Authenticate(Response, user); FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, false); } else { btnLogin.Style["margin-top"] = "10px"; btnLRegister.Style["margin-top"] = "10px"; lblMsg.Style["display"] = "block"; lblMsg.Text = "Wrong Username and/or Password"; } }
protected async void InitBoard() { Model.UserModel user = (Model.UserModel)Session["user"]; userID = user.User_ID; projectID = Convert.ToInt32(Session["projectID"]); // Start initialize // var timer = System.Diagnostics.Stopwatch.StartNew(); Task task1 = createKanban(); Task task2 = Task.Run(() => initDropdownList()); // Profile general info string name = Session["projectName"].ToString(); Page.Title = "Lanban - " + name; lblProjectName.Text = name; //Profile area var profile = (Image)Master.FindControl("profile"); profile.ToolTip = user.Name; profile.ImageUrl = user.Avatar; // Authentication var authen = new Controller.LanbanAuthentication(); var ticket = authen.GetAuthenTicket(user.Username, projectID.ToString(), 30); authen.SetAuthenCookie(Response, ticket); string script = "const userID = " + userID + "; const projectID = " + projectID + ";"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "boardScript", script, true); // Wait all task to complete await Task.WhenAll(task1, task2); // timer.Stop(); // System.Diagnostics.Debug.WriteLine(timer.ElapsedMilliseconds); }