private void btnLinkSubmit_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbTrueDestinationLinkUrl.Text)) { HashingHelper hh = new HashingHelper(); CurrentInternalReport.TrueLinkUrl = tbTrueDestinationLinkUrl.Text; CurrentInternalReport.TrueLinkUrlHash = hh.GetSHA512(tbTrueDestinationLinkUrl.Text); hh = null; } btnLinkSubmit.Visible = false; DBHelper dbHelper = new DBHelper(); switch ((string)btnLinkSubmit.Tag) { case "X": dbHelper.SetLinkToGoneButNotForgotten(CurrentInternalReport.LinkUrl); break; case "A": dbHelper.SetLinkToAllowed(CurrentInternalReport.LinkUrl); break; case "R": dbHelper.SetLinkToRestricted(CurrentInternalReport.LinkUrl); break; case "C": dbHelper.SetLinkToCriminal(CurrentInternalReport.LinkUrl); break; default: break; } //TODO: Make Disposable? dbHelper = null; }
internal static string GetImagesReported() { Damocles2Entities de = new Damocles2Entities(); HashingHelper hh = new HashingHelper(); string passwordHash = hh.GetSHA512(CurrentUser.UserPassword); User u = de.Users.Where(usr => usr.Username == CurrentUser.Username && usr.UserPassword == passwordHash).FirstOrDefault(); var pr = de.ProcessingResults.Where(pi => pi.id == u.Id); int iCount = 0; foreach (ProcessingResult p in pr) { if (p.CSrcResultId != null) iCount++; } return iCount.ToString("N0"); }
private void btnSrcSubmit_Click(object sender, EventArgs e) { CurrentInternalReport.SrcSaved = true; btnSrcSubmit.Visible = false; DBHelper dbHelper = new DBHelper(); switch ((string)btnSrcSubmit.Tag) { case "X": dbHelper.SetSrcToGoneButNotForgotten(CurrentInternalReport.SrcUrl); break; case "A": dbHelper.SetSrcToAllowed(CurrentInternalReport.SrcUrl); break; case "R": dbHelper.SetSrcToRestricted(CurrentInternalReport.SrcUrl); break; case "C": dbHelper.SetSrcToCriminal(CurrentInternalReport.SrcUrl); break; default: break; } // Save the Hashes HashingHelper hh = new HashingHelper(); string fMd5 = hh.GetFileMD5(CurrentInternalReport.ImagePath); dbHelper.SaveMD5Hash(fMd5); string fSha1 = hh.GetFileSha1(CurrentInternalReport.ImagePath); dbHelper.SaveSha1Hash(fSha1); string fSha256 = hh.GetFileSha256(CurrentInternalReport.ImagePath); dbHelper.SaveSha256Hash(fSha256); string fSha512 = hh.GetFileSha512(CurrentInternalReport.ImagePath); dbHelper.SaveSha512Hash(fSha512); // Now we need to save the Metadata! btnSrcSubmit.Tag = null; //TODO: Make Disposable? dbHelper = null; }