Example #1
0
 public void signOut(object sender, EventArgs e)
 {
     using (BulmaLINQDataContext dbContext = new BulmaLINQDataContext())
     {
         Session["username"] = "";
         Response.Redirect("HomePage.aspx");
     }
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using (BulmaLINQDataContext dbContext = new BulmaLINQDataContext())
     {
         Account account = dbContext.Accounts.SingleOrDefault(x => x.fullName == Session["username"].ToString());
         fullNameInput.Text = account.fullName;
         emailInput.Text    = account.email;
     }
 }
Example #3
0
 public void delete(object sender, EventArgs e)
 {
     using (BulmaLINQDataContext dbContext = new BulmaLINQDataContext())
     {
         Account account = dbContext.Accounts.SingleOrDefault(x => x.fullName == Session["username"].ToString());
         dbContext.Accounts.DeleteOnSubmit(account);
         dbContext.SubmitChanges();
         Session["username"] = "";
         Response.Redirect("HomePage.aspx");
     }
 }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BulmaLINQDataContext dbContext = new BulmaLINQDataContext();

            GridView1.DataSource = from review in dbContext.Reviews
                                   select new
            {
                Name    = review.fullName,
                Comment = review.comment,
            };
            GridView1.DataBind();
        }
Example #5
0
 public void update(object sender, EventArgs e)
 {
     using (BulmaLINQDataContext dbContext = new BulmaLINQDataContext())
     {
         Account account = dbContext.Accounts.SingleOrDefault(x => x.fullName == Session["username"].ToString());
         account.fullName = fullNameInput.Text;
         account.email    = emailInput.Text;
         if (passwordInput.Text != null)
         {
             account.password = passwordInput.Text;
         }
         dbContext.SubmitChanges();
         Session["username"] = "";
         ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "you need to sign in again after account changes" + "');", true);
         Response.Redirect("HomePage.aspx");
     }
 }
Example #6
0
 public void signIn(object sender, EventArgs e)
 {
     using (BulmaLINQDataContext dbContext = new BulmaLINQDataContext())
     {
         Account account = dbContext.Accounts.SingleOrDefault(x => x.email == Request["emailInput"]);
         if (Request["passwordInput"] == account.password)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Login successful" + "');", true);
             Session["username"] = account.fullName;
             Response.Redirect("HomePage.aspx");
         }
         else
         {
             ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Login NOT successful" + "');", true);
         }
     }
 }
Example #7
0
 public void submitReview(object sender, EventArgs e)
 {
     using (BulmaLINQDataContext dbContext = new BulmaLINQDataContext())
     {
         Review newReview = new Review
         {
             fullName = Request["fullNameInput"],
             comment  = Request["commentInput"]
         };
         dbContext.Reviews.InsertOnSubmit(newReview);
         dbContext.SubmitChanges();
         GridView1.DataSource = from review in dbContext.Reviews
                                select new
         {
             Name    = review.fullName,
             Comment = review.comment,
         };
         GridView1.DataBind();
     }
 }
Example #8
0
 public void signUp(object sender, EventArgs e)
 {
     using (BulmaLINQDataContext dbContext = new BulmaLINQDataContext())
     {
         Account newAccount = new Account
         {
             fullName = Request["fullNameInput"],
             email    = Request["emailInput"],
             password = Request["passwordInput"]
         };
         String info = "your name: " + Request["fullNameInput"] + " your email: " + Request["emailInput"];
         ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "You have succesfully created an account! we will send you the account information via email" + "');", true);
         MailMessage message = new MailMessage("*****@*****.**", Request["emailInput"], "bulma account info", info);
         message.IsBodyHtml = true;
         SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
         client.EnableSsl   = true;
         client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "techno14789@");
         dbContext.Accounts.InsertOnSubmit(newAccount);
         dbContext.SubmitChanges();
         client.Send(message);
         Response.Redirect("Signin.aspx");
     }
 }