Exemplo n.º 1
0
 // GET: Home
 public ActionResult Index()
 {
     string config = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "YourCredentials.json");
     DateTime LastDateUpdated = DateTime.Parse("2016-01-01");
     using (var ctx = new AdExContext())
     {
         var date= ctx.AdExStats.OrderByDescending(x => x.Date).Select(x => x.Date).FirstOrDefault();
         if(date != default(DateTime))
         {
             LastDateUpdated = date;
         }
     }
     //Get and update data from Google ADX
     IntegrationAPI api = new IntegrationAPI(config);
     var googledata=api.FetchAdexchangeData(LastDateUpdated.ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd"));
     api.UpdateData(googledata);
     //Hardcoded, dont have UI right now
     //Will get from UI:    DateRange, TagID
     DateRange range = new DateRange();
     range.DateFrom = DateTime.Parse("2016-01-01");
     range.DateTo = DateTime.Parse("2016-01-12");
     long Tagid = 4642798920;
     api.GenerateReport(ReportType.ConcreteSiteByFormatsByMonth, range, Tagid);
     return View();
 }
Exemplo n.º 2
0
 public List<AdexReportObject> GenerateReport(ReportType Type,DateRange range , long TagID)
 {   
     reportfactory = new ReportFactory(Type);
     var report = reportfactory.GetReportFactory();
     report.DateRange = range;
     if(TagID != 0)
     {
         report.TagId = TagID;
     }
    
     return report.Generate();
 }