protected void Page_Load(object sender, EventArgs e) { try { if (null != Request.Cookies[Settings.Default.SessionCookieKey]) { Int64 userID = UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value); if (0 == userID) { Response.Redirect("Account/Login.aspx?ReturnUrl=Forum.aspx"); } else { Accounts.DataSource = AccountMgmt.GetAccounts(userID); Accounts.DataBind(); } } } catch (Exception ex) { ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex); message.Visible = true; message.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (null != Request.Cookies[Settings.Default.SessionCookieKey]) { Int64 userID = UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value); if (0 == userID) { Response.Redirect("Account/Login.aspx?ReturnUrl=/Forum.aspx"); } else { FromAccount.Items.Clear(); FromAccount.Items.AddRange(AccountMgmt.GetAccountList(userID)); } } } catch (ThreadAbortException tae) { //nothing } catch (Exception ex) { ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex); message.Visible = true; message.Text = ex.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { try { if (null == Request.Cookies[Settings.Default.SessionCookieKey]) { LoginInfo.Text = "Please <a href=\"Account/Login.aspx\">Log in</a>"; } else if (String.IsNullOrEmpty(Request.Cookies[Settings.Default.SessionCookieKey].Value)) { LoginInfo.Text = "Please <a href=\"Account/Login.aspx\">Log in</a>"; } else { Int64 UserID = UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value); LoginInfo.Text = "Welcome to the world of secure banking, " + UserMgmt.LookupUsername(UserID) + "!<br />" + "<a href=\"Logout.aspx\">Log out</a>"; } } catch (Exception ex) { ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex); Response.Write(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { try { if (null != Request.Cookies[Settings.Default.SessionCookieKey]) { if (0 != UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value)) { Anon.Visible = false; Authen.Visible = true; } else { Anon.Visible = true; Authen.Visible = false; } } else { Anon.Visible = true; Authen.Visible = false; } } catch (Exception ex) { Response.Write(ex.ToString()); ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex); } }
protected void Page_Load(object sender, EventArgs e) { if (null != Request.Cookies[Settings.Default.SessionCookieKey]) { if (0 == UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value)) { Response.Redirect("Account/Login.aspx?ReturnUrl=/Forum.aspx"); } } }
protected void Submit_Click(object sender, EventArgs e) { try{ AccountMgmt.CreateAccount(UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value), AccountType.SelectedValue, StartingBalance.Value, AccountLevel.SelectedValue, 1); Response.Redirect(string.Format(@"ActionDone.aspx?Title=Application Completed&Text=Thank you for applying for a new {0} account with SuperSecure Bank, your applicaiton will be reviewed and a banker will be with you shortly. At any time you can check on the status of your account by going to the <a href=""ViewAccount.aspx"">View Accounts Page</a>", AccountType.SelectedItem)); } catch (Exception ex) { ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex); message.Visible = true; message.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { if (null != Request.Cookies[Settings.Default.SessionCookieKey]) { Int64 userID = UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value); if (0 == userID || "admin" != UserMgmt.LookupUsername(userID).ToLower()) { Response.Redirect("404.aspx?AttemptedUrl=/ApplyForAccount.aspx"); } } } catch (Exception ex) { ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex); message.Visible = true; message.Text = ex.ToString(); } }
protected void PostComment_Click(object sender, EventArgs e) { try { Int64 valid = Validated.Value == "False" ? 0 : 1; Int64 userID = UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value); string insertComment = "INSERT INTO Comments VALUES ({0}, '{1}', '{2}', '{3}', {4})"; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ssbcon"].ConnectionString); conn.Open(); insertComment = String.Format(insertComment, userID, TitleBox.Text, BodyBox.Text, DateTime.Now, valid); SqlCommand command = new SqlCommand(insertComment, conn); command.ExecuteNonQuery(); conn.Close(); Response.Redirect("Forum.aspx"); } catch (Exception ex) { ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex); Response.Write(ex.ToString()); } }