Exemplo n.º 1
0
    protected void btnGuestbookSubmit_Click(object s, EventArgs e)
    {
        if (Page.IsValid)
        {
            NbpDataContext db = new NbpDataContext();
            guestbook g = new guestbook();

            g.guestbookId = Guid.NewGuid();
            g.guestbookEmail = txtEmail.Text.ToString();
            g.guestbookRelationship = txtRelationship.Text.ToString();
            g.guestbookSourceIp = Request.ServerVariables["REMOTE_ADDR"];
            g.guestbookText = txtText.Text.ToString();
            g.guestbookTimestamp = DateTime.Now;
            g.guestbookAuthor = txtAuthor.Text.ToString();

            db.guestbooks.InsertOnSubmit(g);
            db.SubmitChanges();

            Session["nbpEmail"] = txtEmail.Text.ToString();
            Session["nbpName"] = txtAuthor.Text.ToString();

            // audit stuff
            audit a = new audit();
            a.auditId = Guid.NewGuid();
            a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
            a.auditRequestedUrl = "Guestbook.aspx";
            a.auditSessionEmail = Session["nbpEmail"] != null ? Session["nbpEmail"].ToString() : "";
            a.auditSessionId = Session.SessionID.ToString();
            a.auditSessionName = Session["nbpName"] != null ? Session["nbpName"].ToString() : "";
            a.auditTimestamp = DateTime.Now;
            a.auditType = "Guestbook Signed";
            a.auditDescription = "E-Mail: " + txtEmail.Text.ToString() +
                " Relationship: " + txtRelationship.Text.ToString() +
                " Text: " + txtText.Text.ToString();
            a.auditReferrer = Request.UrlReferrer.AbsolutePath.ToString();
            a.auditLogonUser = Request.ServerVariables["LOGON_USER"];
            db.audits.InsertOnSubmit(a);
            db.SubmitChanges();

            MultiView1.ActiveViewIndex = 2;
            MultiView1.DataBind();
        }
        else
        {
            foreach (BaseValidator valControl in Page.Validators)
            {
                WebControl aControl = (WebControl)Page.FindControl(valControl.ControlToValidate);
                if (!valControl.IsValid)
                    aControl.BackColor = System.Drawing.Color.Yellow;
                else
                    aControl.BackColor = System.Drawing.Color.White;
            }

        }
    }
Exemplo n.º 2
0
    protected void ReservationSubmit_Click(object s, EventArgs e)
    {
        NbpDataContext db = new NbpDataContext();

        if (ReservationIsValid())
        {
            reservation r = new reservation();
            r.reservationEmail = reservationEmail.Text.ToString();
            r.reservationId = Guid.NewGuid();
            r.reservationName = reservationName.Text.ToString();
            r.reservationPartySize = Convert.ToInt32(reservationPartySize.SelectedItem.Value);
            r.reservationRelationship = reservationRelationship.Text.ToString();
            r.reservationRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
            r.reservationTimestamp = DateTime.Now;
            r.reservationPhoneNumber = reservationPhoneNumber.Text.ToString();
            db.reservations.InsertOnSubmit(r);
            db.SubmitChanges();

            Session["nbpEmail"] = reservationEmail.Text.ToString();
            Session["nbpName"] = reservationName.Text.ToString();

            // send cookie
            HttpCookie c = new HttpCookie("MemorialReservation");
            c.Expires = DateTime.Now.AddMonths(1);
            c.Value = reservationName.Text.ToString();
            Response.Cookies.Add(c);

            MultiView1.ActiveViewIndex = 1;
        }

        audit a = new audit();
        a.auditId = Guid.NewGuid();
        a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
        a.auditRequestedUrl = "Memorial.aspx";
        a.auditSessionEmail = Session["nbpEmail"]!=null ? Session["nbpEmail"].ToString() : "";
        a.auditSessionId = Session.SessionID.ToString();
        a.auditSessionName = Session["nbpName"]!=null ? Session["nbpName"].ToString() : "";
        a.auditTimestamp = DateTime.Now;
        a.auditType = "Memorial signup";
        a.auditDescription = "Email: " + reservationEmail.Text.ToString() +
            " Name: " + reservationName.Text.ToString() +
            " PartySize: " + reservationPartySize.SelectedItem.Value.ToString() +
            " Relationship: " + reservationRelationship.Text.ToString() +
            " Phone: " + reservationPhoneNumber.Text.ToString();
        a.auditReferrer = Request.UrlReferrer.AbsolutePath.ToString();
        a.auditLogonUser = Request.ServerVariables["LOGON_USER"];
        db.audits.InsertOnSubmit(a);
        db.SubmitChanges();
    }
Exemplo n.º 3
0
    protected void ddlLanguages_Changed(object sender, EventArgs e)
    {
        NbpDataContext db = new NbpDataContext();
        string selectedLanguage = ddlLanguages.SelectedValue.ToString();
        HttpCookie c = new HttpCookie("Culture");
        c.Expires = DateTime.Now.AddYears(5);
        c.Value = selectedLanguage;
        Response.Cookies.Add(c);

        Page.Culture = selectedLanguage;
        Session.Remove("Culture");
        Session.Add("Culture", selectedLanguage);

        // track from db
        audit a = new audit();
        a.auditId = Guid.NewGuid();
        a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
        a.auditRequestedUrl = "Default.aspx";
        a.auditSessionEmail = Session["nbpEmail"] != null ? Session["nbpEmail"].ToString() : "";
        a.auditSessionId = Session.SessionID.ToString();
        a.auditSessionName = Session["nbpName"] != null ? Session["nbpName"].ToString() : "";
        a.auditTimestamp = DateTime.Now;
        a.auditType = "Language changed";
        a.auditDescription = ddlLanguages.SelectedValue.ToString();
        a.auditReferrer = Request.UrlReferrer.AbsolutePath.ToString();
        a.auditLogonUser = Request.ServerVariables["LOGON_USER"];
        db.audits.InsertOnSubmit(a);
        db.SubmitChanges();

        Server.Transfer("Default.aspx", false);
    }
Exemplo n.º 4
0
    public void AuditTransaction(string type, string desc)
    {
        NbpDataContext db = new NbpDataContext();

        // audit stuff
        audit a = new audit();
        a.auditId = Guid.NewGuid();
        a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
        a.auditRequestedUrl = "";
        a.auditSessionEmail = Session["nbpEmail"] != null ? Session["nbpEmail"].ToString() : "";
        a.auditSessionId = Session.SessionID.ToString();
        a.auditSessionName = Session["nbpName"] != null ? Session["nbpName"].ToString() : "";
        a.auditTimestamp = DateTime.Now;
        a.auditType = type;
        a.auditDescription = desc;
        a.auditReferrer = "";
        a.auditLogonUser = Request.ServerVariables["LOGON_USER"];
        db.audits.InsertOnSubmit(a);
        db.SubmitChanges();
    }
Exemplo n.º 5
0
    protected void ForwardToPaypal(object s, EventArgs e)
    {
        StringBuilder sb = new StringBuilder();
        NbpDataContext db = new NbpDataContext();

        string postUrl = "https://www.paypal.com/cgi-bin/webscr";
        string cmd = "_donations";
        string business = "DD3QBBHPA59RW";
        string lc = "US";
        string item_name = "Jeremy Villegas c/o Nelly Brandt";
        string currency_code = "USD";
        string bn = "PP-DonationsBF:btn_donateCC_LG.gif:NonHosted";

        sb.Append(postUrl + "?cmd=" + cmd);
        sb.Append("&business=" + business);
        sb.Append("&lc=" + lc);
        sb.Append("&item_name=" + item_name);
        sb.Append("&currency_code=" + currency_code);
        sb.Append("&bn=" + bn);

        // audit stuff
        audit a = new audit();
        a.auditId = Guid.NewGuid();
        a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString();
        a.auditRequestedUrl = "Donations.aspx";
        a.auditSessionEmail = Session["nbpEmail"] != null ? Session["nbpEmail"].ToString() : "";
        a.auditSessionId = Session.SessionID.ToString();
        a.auditSessionName = Session["nbpName"] != null ? Session["nbpName"].ToString() : "";
        a.auditTimestamp = DateTime.Now;
        a.auditType = "Donation Link Clicked";
        a.auditReferrer = Request.UrlReferrer.AbsolutePath.ToString();
        a.auditLogonUser = Request.ServerVariables["LOGON_USER"];
        db.audits.InsertOnSubmit(a);
        db.SubmitChanges();

        // now send redirect
        Response.Redirect(sb.ToString());
    }