protected void btnAddComment_Submit_Click(object sender, EventArgs e) { comment newComment = new comment(); newComment.commentAuthor = txtNewComment_username.Text.ToString(); newComment.commentIpSource = Request.ServerVariables["REMOTE_ADDR"]; newComment.commentPhotoId = new Guid(imgCurrentGuid.Value.ToString()); newComment.commentText = txtNewComment_Text.Text.ToString(); newComment.commentId = Guid.NewGuid(); newComment.commentTimestamp = DateTime.Now; db.comments.InsertOnSubmit(newComment); db.SubmitChanges(); Session["nbpEmail"] = txtNewComment_email.Text.ToString(); Session["nbpName"] = txtNewComment_username.Text.ToString(); LoadCommentData(); ToggleAddCommentDiv(); audit a = new audit(); a.auditId = Guid.NewGuid(); a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString(); a.auditRequestedUrl = "PhotoView.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 = "PhotoView Comment Posted"; a.auditDescription = "Author: " + txtNewComment_username.Text.ToString() + " Text: " + txtNewComment_Text.Text.ToString(); a.auditReferrer = Request.UrlReferrer.AbsolutePath.ToString(); a.auditLogonUser = Request.ServerVariables["LOGON_USER"]; db.audits.InsertOnSubmit(a); db.SubmitChanges(); }
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); }
public ActionResult auditDeleteConfirmed(int id) { audit audit = db.audits.Find(id); db.audits.Remove(audit); db.SaveChanges(); return(RedirectToAction("auditList")); }
public ActionResult Edit([Bind(Include = "id,owner,field_name,old_value,new_value,action_date")] audit audit) { if (ModelState.IsValid) { db.Entry(audit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(audit)); }
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; } } }
public ActionResult Create([Bind(Include = "id,owner,field_name,old_value,new_value,action_date")] audit audit) { if (ModelState.IsValid) { db.audit.Add(audit); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(audit)); }
public ActionResult auditEdit([Bind(Include = "Id,personId,datetime,activityId,auditObject")] audit audit) { if (ModelState.IsValid) { db.Entry(audit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("auditList")); } ViewBag.activityId = new SelectList(db.activities, "Id", "name", audit.activityId); ViewBag.personId = new SelectList(db.people, "Id", "fullname", audit.personId); return(View(audit)); }
// GET: audits/Details/5 public ActionResult auditDetails(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } audit audit = db.audits.Find(id); if (audit == null) { return(HttpNotFound()); } return(View(audit)); }
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(); }
public static string Log(string action, string user_id, byte status) { NatterbaseEntities db = new NatterbaseEntities(); audit audit = new audit { action = action, user_id = user_id, status = status }; db.audits.Add(audit); db.SaveChanges(); return("Log"); }
// GET: audits/Edit/5 public ActionResult auditEdit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } audit audit = db.audits.Find(id); if (audit == null) { return(HttpNotFound()); } ViewBag.activityId = new SelectList(db.activities, "Id", "name", audit.activityId); ViewBag.personId = new SelectList(db.people, "Id", "fullname", audit.personId); return(View(audit)); }
public ActionResult CreateAudit(audit info) { if (ModelState.IsValid && CheckExpertSession()) { var expertId = (Int32)Session["user_id"]; info.expertId = expertId; info.audit_time = DateTime.Now; CreateRecord <audit>(info); Utility.EditRecord <expert>(x => x.expertId == expertId, (x) => { x.expert_accept_count += 1; return(x); }); } return(RedirectToAction("Detail", new { id = info.bidId })); }
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(); }
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("¤cy_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()); }
partial void Insertaudit(audit instance);
partial void Updateaudit(audit instance);
partial void Deleteaudit(audit instance);
protected void PhotoUpload_Submit_Click(object sender, EventArgs e) { if (upload_File.FileContent.Length > 0 && CheckFileType(upload_File.FileName)) { setting s; int photoSeqNumber = 0; string filename; System.Drawing.Image img; /* Validate and resize image */ img = PhotoReformat(upload_File.FileContent); /* Get filename and increment setting */ var q = from p in db.settings where p.settingName == "NextImageFilename" select p; s = q.First(); filename = "images/image" + q.First().settingInt.ToString().PadLeft(3, '0'); filename += System.IO.Path.GetExtension(upload_File.FileName); s.settingInt++; db.SubmitChanges(); /* Copy file into image store */ img.Save(MapPath(filename), System.Drawing.Imaging.ImageFormat.Jpeg); //upload_File.SaveAs(MapPath(filename)); /* Build new photo in database */ photo uploadedPhoto = new photo(); uploadedPhoto.photoId = Guid.NewGuid(); uploadedPhoto.photoDate = Convert.ToDateTime(upload_PhotoDate.Text.ToString()); uploadedPhoto.photoCaption = upload_Caption.Text.ToString(); uploadedPhoto.photoLocation = filename; uploadedPhoto.photoPageType = 0; uploadedPhoto.photoUploadedTimestamp = DateTime.Now; uploadedPhoto.photoUploader = upload_Username.Text.ToString(); uploadedPhoto.photoIsMemorial = rbMemorial.Checked; /* get next sequence number */ var sq = from p in db.photos where p.photoSequenceNumber != null orderby p.photoSequenceNumber descending select p.photoSequenceNumber; if (sq.Count() != 0) { photoSeqNumber = sq.First().Value + 1; } uploadedPhoto.photoSequenceNumber = photoSeqNumber; db.photos.InsertOnSubmit(uploadedPhoto); db.SubmitChanges(); lnkImageUploadLink.NavigateUrl = "PhotoView.aspx?p=" + photoSeqNumber; MultiView1.ActiveViewIndex = 1; Session["nbpName"] = upload_Username.Text.ToString(); Session["nbpEmail"] = upload_Email.Text.ToString(); } // audit stuff audit a = new audit(); a.auditId = Guid.NewGuid(); a.auditRemoteAddr = Request.ServerVariables["REMOTE_ADDR"].ToString(); a.auditRequestedUrl = "PhotoUpload.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 = "PhotoUpload attempt"; a.auditDescription = "PhotoDate: " + upload_PhotoDate.Text.ToString() + " Caption: " + upload_Caption.Text.ToString() + " Filename: " + upload_File.FileName.ToString() + " Name: " + upload_Username.Text.ToString(); a.auditReferrer = Request.UrlReferrer.AbsolutePath.ToString(); a.auditLogonUser = Request.ServerVariables["LOGON_USER"]; db.audits.InsertOnSubmit(a); db.SubmitChanges(); }