public override int CreateRankingMonitor(int idProject, string loginName, int[] idKeywordLists, out int keywordsTotal)
 {
     var dsKeyword = DSKeyword.Create(_connName);
     var keywords = dsKeyword.FindUniqueByKeywordLists(idKeywordLists);
     keywordsTotal = keywords.Count;
     var keywordAnalysis = new List<KeywordAnalysis>();
     foreach (var keyword in keywords)
     {
         var keywordAnalysisItem = new KeywordAnalysis
                                       {
                                           Keyword = keyword,
                                           Status = "P"
                                       };
         var keyword1 = keyword;
         if (keywordAnalysis.Exists(Item => Item.Keyword == keyword1)) continue;
         keywordAnalysis.Add(keywordAnalysisItem);
     }
     var rankingMonitorRun = new RankingMonitorRun
                                 {
                                     AnalysisType = "M",
                                     ExecutionDate = DateTime.Now,
                                     Project = new Project { Id = idProject },
                                     Status = new Status { Name = "P" },
                                     User = loginName
                                 };
     using (var tran = new TransactionScope(_connName))
     {
         var dsRankingMonitorRun = DSRankingMonitorRun.Create(_connName);
         var dsKeywordAnalysis = DSKeywordAnalysis.Create(_connName);
         dsRankingMonitorRun.Insert(rankingMonitorRun);
         keywordAnalysis.ForEach(KeywordAnalysis =>
                                     {
                                         KeywordAnalysis.RankingMonitorRun = rankingMonitorRun;
                                         dsKeywordAnalysis.Insert(KeywordAnalysis);
                                     });
         tran.Commit();
     }
     return rankingMonitorRun.Id;
 }
 public abstract void UpdateRankingMonitor(RankingMonitorRun rankingMonitorRun);
 public override void UpdateRankingMonitor(RankingMonitorRun rankingMonitorRun)
 {
     using (var tran = new TransactionScope(_connName))
     {
         DSRankingMonitorRun.Create(_connName).Update(rankingMonitorRun);
         tran.Commit();
     }
 }
Exemplo n.º 4
0
 public static void UpdateRankingMonitor(RankingMonitorRun rankingMonitorRun)
 {
     Provider.UpdateRankingMonitor(rankingMonitorRun);
 }