private void GenerateBFReport(BusinessFlow bf) { try { LiteDbManager dbManager = new LiteDbManager(WorkSpace.Instance.SolutionRepository.ConvertSolutionRelativePath(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder)); var result = dbManager.GetRunSetLiteData(); List <LiteDbRunSet> filterData = dbManager.FilterCollection(result, Query.All()); LiteDbRunSet runSetLast = filterData.Last(); //runSetLast._id = new ObjectId(); LiteDbRunner runnerFilter = runSetLast.RunnersColl.Find(r => r.GUID.ToString() == mRunner.Guid.ToString()); //runnerFilter._id = new ObjectId(); //runSetLast.RunnersColl = new List<LiteDbRunner>() { runnerFilter }; LiteDbBusinessFlow bfFilter = runnerFilter.BusinessFlowsColl.Find(b => b.GUID.ToString() == bf.Guid.ToString() && b.StartTimeStamp.ToString() == bf.StartTimeStamp.ToLocalTime().ToString()); if (bfFilter == null) { Reporter.ToUser(eUserMsgKey.BFNotExistInDB); return; } //runnerFilter.RunStatus = bfFilter.RunStatus; //runSetLast.RunStatus = runnerFilter.RunStatus; //runnerFilter.BusinessFlowsColl = new List<LiteDbBusinessFlow>() { bfFilter }; //dbManager.WriteToLiteDb(dbManager.NameInDb<LiteDbRunner>(), new List<LiteDbReportBase>() { runnerFilter }); //dbManager.WriteToLiteDb(dbManager.NameInDb<LiteDbRunSet>(), new List<LiteDbReportBase>() { runSetLast }); WebReportGenerator webReporterRunner = new WebReportGenerator(); webReporterRunner.RunNewHtmlReport(string.Empty, runSetLast._id.ToString(), new WebReportFilter() { Guid = bfFilter.GUID.ToString() }); //var newRSData = dbManager.GetRunSetLiteData(); //newRSData.Delete(runSetLast._id); //var newRunnerData = dbManager.GetRunnerLiteData(); //newRunnerData.Delete(runnerFilter._id); } catch (Exception ex) { } }
// TODO: Make this function to just generate the report folder !!! public LiteDbRunSet RunNewHtmlReport(string runSetGuid = null, WebReportFilter openObject = null, bool shouldDisplayReport = true) { LiteDbRunSet lightDbRunSet = new LiteDbRunSet(); bool response = false; try { string clientAppFolderPath = Path.Combine(WorkSpace.Instance.LocalUserApplicationDataFolderPath, "Reports", "Ginger-Web-Client"); if (!Directory.Exists(clientAppFolderPath)) { return(lightDbRunSet); } DeleteFoldersData(Path.Combine(clientAppFolderPath, "assets", "Execution_Data")); DeleteFoldersData(Path.Combine(clientAppFolderPath, "assets", "screenshots")); LiteDbManager dbManager = new LiteDbManager(new ExecutionLoggerHelper().GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder)); var result = dbManager.GetRunSetLiteData(); List <LiteDbRunSet> filterData = null; if (!string.IsNullOrEmpty(runSetGuid)) { filterData = result.IncludeAll().Find(a => a._id.ToString() == runSetGuid).ToList(); } else { filterData = dbManager.FilterCollection(result, Query.All()); } lightDbRunSet = filterData.Last(); PopulateMissingFields(lightDbRunSet, clientAppFolderPath); string json = Newtonsoft.Json.JsonConvert.SerializeObject(filterData.Last()); response = RunClientApp(json, clientAppFolderPath, openObject, shouldDisplayReport); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "RunNewHtmlReport,error :" + ex.ToString()); } return(lightDbRunSet); }