private void operationMakeOffline(string websiteKey, Artical artical, ArticalOverview overview)
        {
            //TODO: Find a way to save the pdf data in a different folder for future use as folder
            if (db == null)
            {
                throw new InvalidOperationException("Database is not created yet.");
            }

            overview.IsDatabaseConfirmed_Offline = true;
            overview.OfflineAvailableOn          = DateTime.Today.ToString("yyyyMMdd");
            var obj = OfflineTable.New(websiteKey, artical, overview);

            try
            {
                db.Insert(obj);
            }
            catch (Exception)
            {
                try
                {
                    db.Update(obj);
                }
                catch (Exception) { }
            }
        }
Exemple #2
0
 public void ReadArtical(string uid, string websiteKey, ArticalOverview overview, IUiArticalResponseHandler responseHandler, bool isForced = false)
 {
     MyLog.Log(this, nameof(ReadArtical) + "...");
     pendingRequest.Enqueue(
         RequestPacket.CreatePacket(uid, websiteKey, overview.LinkOfActualArtical, isForced, RequestPacketOwners.AnalysisModule, responseHandler).AddTag(overview));
     MyLog.Log(this, nameof(ReadArtical) + "...Done");
 }
 public static BrowserHistoryTable New(ArticalOverview overview)
 {
     return(new BrowserHistoryTable()
     {
         URL = overview.LinkOfActualArtical,
         LastSeenOn = DateTime.Today.ToString("yyyyMMdd")
     });
 }
 public static InstructionSet GetArtical(ArticalOverview overview, IUiArticalResponseHandler responseHandler)
 {
     return(new InstructionSet()
     {
         articalOverview = new ArticalOverview[] { overview },
         action = ActionToPerformInfo.GetArtical,
         tags = new object[] { responseHandler }
     });
 }
 public static InstructionSet UpdateIsSeen(ArticalOverview overview)
 {
     return(new InstructionSet()
     {
         articalOverview = new ArticalOverview[] { overview },
         action = ActionToPerformInfo.UpdateIsSeen,
         artical = null
     });
 }
 public static OfflineTable New(string websiteKey, Artical artical, ArticalOverview overview)
 {
     return(new OfflineTable()
     {
         LinkOfActualArtical = overview.LinkOfActualArtical,
         Title = overview.Title,
         SummaryText = overview.SummaryText,
         Date = overview.Date,
         SeenOn = overview.SeenOn,
         HtmlText = artical.HtmlText,
         ExtrnalLinks = artical.ExternalFileLink,
         OfflineAvailableOn = DateTime.Today.ToString("yyyyMMdd"),
         WebsiteKey = websiteKey
     });
 }
        private void operationGetArtical(string transactionId, ArticalOverview overview, IUiArticalResponseHandler responseHandler)
        {
            if (db == null)
            {
                throw new InvalidOperationException("Database is not created yet.");
            }
            if (responseHandler == null)
            {
                return;
            }

            var row = db.Get <OfflineTable>(OfflineTable.GetPrimaryKey(overview));

            if (row == null)
            {
                return;
            }

            responseHandler?.ArticalProcessedCallback(transactionId, row.LinkOfActualArtical, row.ToArtical());
        }
Exemple #8
0
 public virtual Artical ReadArticalExtrnal(ArticalOverview overview, string extrnalLink) => null;
Exemple #9
0
 public abstract Artical ReadArtical(ArticalOverview overview, HtmlAgilityPack.HtmlDocument doc);
 public void GetArtical(string transactionId, ArticalOverview articalOverview, IUiArticalResponseHandler responseHandler)
 {
     pendingRequest.Push(transactionId, InstructionSet.GetArtical(articalOverview, responseHandler));
     handler.Set();
 }
 public void MakeOffline(string transactionId, string websiteKey, Artical artical, ArticalOverview articalOverview)
 {
     pendingRequest.Push(transactionId, InstructionSet.MakeOffline(websiteKey, artical, articalOverview));
     handler.Set();
 }
 public void UpdateIsSeen(string transactionId, ArticalOverview articalOverview)
 {
     pendingRequest.Push(transactionId, InstructionSet.UpdateIsSeen(articalOverview));
     handler.Set();
 }
 public static string GetPrimaryKey(ArticalOverview overview) => overview.LinkOfActualArtical;
 public void IsSeen(string transactionId, ArticalOverview articalOverview) => IsSeen(transactionId, new ArticalOverview[] { articalOverview });
 public static InstructionSet MakeOffline(string wesiteKey, Artical artical, ArticalOverview overview)
 {
     return(new InstructionSet()
     {
         articalOverview = new ArticalOverview[] { overview },
         action = ActionToPerformInfo.MakeOffline,
         artical = artical,
         tags = new object[] { wesiteKey }
     });
 }
 public override Artical ReadArtical(ArticalOverview overview, HtmlDocument doc) => null;