예제 #1
0
        // This is a 404 or some other error - do a check for a month to see if it returns
        // This can be done within Imogen as Background House keeping
        internal void SetLinkToGoneButNotForgotten(string url)
        {
            Damocles2Entities de = new Damocles2Entities();

            string pHash = hh.GetSHA512(CurrentUser.UserPassword);
            User usr = de.Users.Where(u => u.Username == CurrentUser.Username && u.UserPassword == pHash).FirstOrDefault();

            EUReported eu = de.EUReporteds.Where(l => l.LinkUrl == url).FirstOrDefault();
            if (!string.IsNullOrEmpty(CurrentInternalReport.TrueLinkUrl))
                eu.TrueLinkUrl = CurrentInternalReport.TrueLinkUrl;
            if (!string.IsNullOrEmpty(CurrentInternalReport.TrueLinkUrlHash))
                eu.TrueLinkUrlHash = CurrentInternalReport.TrueLinkUrlHash;
            eu.UpdatedOn = DateTime.UtcNow;

            GoneButNotForgottenLink gb = new GoneButNotForgottenLink();
            gb.CreatedOn = DateTime.UtcNow;
            gb.Id = eu.id;
            gb.LastCheckedOn = DateTime.UtcNow;
            gb.LinkUrlHash = eu.LinkUrlHash;
            gb.ReportedBy = usr.Id;

            //TODO: This won't work - we don't know which link is GoneButNotForgotten - the redirection link or the TrueLink.
            if (!string.IsNullOrEmpty(CurrentInternalReport.TrueLinkUrlHash))
                eu.TrueLinkUrlHash = CurrentInternalReport.TrueLinkUrlHash;

            de.GoneButNotForgottenLinks.Add(gb);
            try
            {
                de.SaveChanges();
            }
            catch (Exception)
            {

            }

            de.Dispose();
            gb = null;
            eu = null;
            usr = null;
        }
예제 #2
0
        internal void SetSrcToGoneButNotForgotten(string url)
        {
            Damocles2Entities de = new Damocles2Entities();
            User usr = GetUser(de);

            EUReported eu = de.EUReporteds.Where(l => l.SrcUrl == url).FirstOrDefault();
            eu.UpdatedOn = DateTime.UtcNow;

            GoneButNotForgottenLink gb = new GoneButNotForgottenLink();
            gb.CreatedOn = DateTime.UtcNow;
            gb.Id = eu.id;
            gb.LastCheckedOn = DateTime.UtcNow;
            gb.SrcUrlHash = eu.SrcUrlHash;
            gb.ReportedBy = usr.Id;
            de.GoneButNotForgottenLinks.Add(gb);
            de.SaveChanges();

            de.Dispose();
            gb = null;
            eu = null;
            usr = null;
        }