public void StorageReadData()
        {
            var storage = new ReportStorage(@"TestData\StorageData");

            IsTrue(storage.Contains("DependencyScanner1"));
            IsTrue(storage.Contains("DependencyScanner 2"));
            IsTrue(storage.Contains("DependencyScanner3"));
        }
        public void StorageReadData2()
        {
            var storage = new ReportStorage(@"TestData\StorageData");

            IsTrue(storage.Contains("DependencyScanner1", out IEnumerable <StorageKey> result));

            IsTrue(result.First(a => a.Date == DateTime.Parse("02/05/2018 15:41:59")).Path == @"TestData\StorageData\file1.1.html");
            IsTrue(result.First(a => a.Date == DateTime.Parse("02/06/2018 15:41:59")).Path == @"TestData\StorageData\file1.html");
        }
Esempio n. 3
0
 StorageDataSet.ReportStorageRow FindRow(string id)
 {
     DataRow[] result = ReportStorage.Select(string.Format("ID = '{0}'", id));
     if (result.Length > 0)
     {
         return(result[0] as StorageDataSet.ReportStorageRow);
     }
     return(null);
 }
Esempio n. 4
0
 private void deleteReport()
 {
     try
     {
         ReportStorage.DeleteReports();
         Logger.Debug("Deleted reports from disk.");
     }
     catch (Exception ex)
     {
         Logger.Error("Failed to delete report file.", ex);
     }
 }
Esempio n. 5
0
        public void SaveReportTest()
        {
            var log = new UpdateInstallationLog();

            log.Add(new UpdateInstallationLogEntry("123", InstallationStatus.Success, "", DateTime.UtcNow));
            log.Add(new UpdateInstallationLogEntry("321", InstallationStatus.Failure, "it failed.", DateTime.UtcNow));

            var    rs       = new ReportStorage();
            string filePath = rs.SaveReportLog(log);

            Assert.IsTrue(File.Exists(filePath));
        }
Esempio n. 6
0
 private void saveReport(UpdateInstallationLog log)
 {
     try
     {
         Logger.Debug("Saving report to disk...");
         string path = ReportStorage.SaveReportLog(log);
         Logger.Debug("Report log was saved to disk: " + path);
     }
     catch (Exception ex)
     {
         Logger.Error("Failed to write report to disk: ", ex);
     }
 }
Esempio n. 7
0
 public void SetData(string reportId, string title, XtraReport report)
 {
     StorageDataSet.ReportStorageRow row = FindRow(reportId);
     if (row != null)
     {
         row.Buffer = GetBuffer(report);
     }
     else
     {
         row = ReportStorage.AddReportStorageRow(reportId, title, GetBuffer(report));
     }
     DataSet.WriteXml(StoragePath, XmlWriteMode.WriteSchema);
 }
Esempio n. 8
0
        private UpdateInstallationLog loadReport()
        {
            try
            {
                Logger.Debug("Loading report...");
                return(ReportStorage.LoadReportLog());
            }
            catch (Exception ex)
            {
                Logger.Error("Failed to load report.", ex);
            }

            return(null);
        }
Esempio n. 9
0
        public bool SaveReportInRepository(ReportDTO reportDTO)
        {
            Report report;

            watch.Start();

            try
            {
                if (UserStorage.GetUserByID(reportDTO.UserID) == null)
                {
                    Log.ErrorFormat("User Id: [{0}] does not exist!", reportDTO.UserID);
                    return(false);
                }
                //Save report info
                if (!ReportStorage.SaveReport(ref reportDTO, out report))
                {
                    return(false);
                }

                //associate to user
                if (!UserStorage.SaveUserReport(report))
                {
                    return(false);
                }

                //associate to task
                if (!TaskStorage.AssociateReport(report.UserID, report.ReportID, report.TaskId))
                {
                    return(false);
                }

                Log.Debug("[INFO - REPOSITORY] - Report Saved!");
                watch.Stop();
                Log.DebugFormat("Execution Time: [{0}] in milliseconds to Save a Report", watch.ElapsedMilliseconds);
                watch.Reset();
                return(true);
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                return(false);
            }
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            var connectionString = "Server=localhost;Database=LatviaTestUpload;Trusted_Connection=True;";

            var configurationProvider = Mock.Of <IConfigurationProvider>(
                cf => cf.GetConfigurationSection <DataAccessConfiguration>() == new DataAccessConfiguration
            {
                ConnectionStringUpload = connectionString
            });

            var logger       = Mock.Of <ILogger>();
            var timeProvider = Mock.Of <ITimeProvider>(t => t.Now == DateTime.Now);

            ReportStorage rs = new ReportStorage(
                new SqlGenericDataAccessFactory <IReportUnitOfWork>(
                    configurationProvider, logger, () => new SqlReportUnitOfWork(configurationProvider, timeProvider)), new XmlReportSerializer(new DummyPerformanceLoggerProvider()));


            var response = rs.GetReport <CreditinfoReportPlus>(new Guid("A0209CE2-F7BE-42F0-9284-5CF525347991"));
        }
Esempio n. 11
0
        public ErrorReporter(ISettings settings)
        {
            _settings = settings;

            InstallationDate = File.GetLastWriteTime(AssemblyTools.EntryAssembly.Location);
            HandleExceptions = !Debugger.IsAttached; // do not handle exception if debugger is attached by default

            _backgroundLock = new object();
            _tokenSource    = new CancellationTokenSource();

            _storage = new ReportStorage(_settings);

            if (_settings.UseBackgroundSender)
            {
                _backgroundTask = new Task(SendReportInBackground, _tokenSource.Token);
                _backgroundTask.Start();
            }

            Current = this;
        }
Esempio n. 12
0
 public void PerTestPrepare()
 {
     RS = new ReportStorage(_config);
     RR = new ReportRepository(RS);
 }
Esempio n. 13
0
 public WindowMain(ReportStorage reportStorage)
 {
     InitializeComponent();
     this.reportStorage = reportStorage;
 }
Esempio n. 14
0
        private void BindDG()
        {
            int i = 2;

            grdMain.Columns[i++].HeaderText = LocRM.GetString("FieldName");
            grdMain.Columns[i++].HeaderText = LocRM.GetString("tIsPersonal");
            grdMain.Columns[i++].HeaderText = LocRM.GetString("tCategory");

            foreach (DataGridColumn dgc in grdMain.Columns)
            {
                if (dgc.SortExpression == pc["rep_Config_Sort"].ToString())
                {
                    dgc.HeaderText += String.Format("&nbsp;<img border='0' align='absmiddle' width='9px' height='5px' src='{0}'/>",
                                                    ResolveUrl("~/layouts/images/upbtnF.jpg"));
                }
                else if (dgc.SortExpression + " DESC" == pc["rep_Config_Sort"].ToString())
                {
                    dgc.HeaderText += String.Format("&nbsp;<img border='0' align='absmiddle' width='9px' height='5px' src='{0}'/>",
                                                    ResolveUrl("~/layouts/images/downbtnF.jpg"));
                }
            }

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Id", typeof(int)));
            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("sortName", typeof(string)));
            dt.Columns.Add(new DataColumn("Description", typeof(string)));
            dt.Columns.Add(new DataColumn("Category", typeof(string)));
            dt.Columns.Add(new DataColumn("CategoryId", typeof(int)));
            dt.Columns.Add(new DataColumn("ActionVS", typeof(string)));
            dt.Columns.Add(new DataColumn("Type", typeof(string)));
            DataRow dr;

            ReportInfo[] _ri = rs.GetReports();
            foreach (ReportInfo ri in _ri)
            {
                if (ri.Name == "ProjectTime" && !Configuration.ProjectManagementEnabled)
                {
                    continue;
                }
                dr                = dt.NewRow();
                dr["Id"]          = ri.Id;
                dr["Name"]        = String.Format("<a href='{0}'>{1}</a>", ResolveUrl("~" + ri.Url), ri.ShowName);
                dr["sortName"]    = ri.ShowName;
                dr["Description"] = ri.Description;
                dr["Category"]    = ((ri.Category == null) || (ri.Category.Id == 0)) ? "" : ri.Category.Name;
                dr["CategoryId"]  = (ri.Category == null) ? 0 : ri.Category.Id;
                dr["ActionVS"]    = String.Format("<a href=\"{0}\"><img width='16' height='16' align='absmiddle' border='0' src='{1}' title='{2}'/></a>",
                                                  String.Format("javascript:FolderSecurity({0});", ri.Id),
                                                  ResolveUrl("~/layouts/images/icon-key.gif"),
                                                  LocRM.GetString("tSecurity"));
                switch (ri.Type)
                {
                case Mediachase.IBN.Business.UserReport.UserReportType.Global:
                    dr["Type"] = LocRM.GetString("tGlobalType");
                    break;

                case Mediachase.IBN.Business.UserReport.UserReportType.Personal:
                    dr["Type"] = LocRM.GetString("tPersonalType");
                    break;

                case Mediachase.IBN.Business.UserReport.UserReportType.Project:
                    dr["Type"] = LocRM.GetString("tProjectType");
                    break;

                default:
                    break;
                }
                dt.Rows.Add(dr);
            }

            DataView dv = dt.DefaultView;

            dv.Sort = pc["rep_Config_Sort"].ToString();

            if (pc["rep_Config_PageSize"] == null)
            {
                pc["rep_Config_PageSize"] = "10";
            }
            grdMain.PageSize = int.Parse(pc["rep_Config_PageSize"].ToString());

            if (pc["rep_Config_Page"] == null)
            {
                pc["rep_Config_Page"] = "0";
            }
            int PageIndex = int.Parse(pc["rep_Config_Page"].ToString());
            int ppi       = dv.Count / grdMain.PageSize;

            if (dv.Count % grdMain.PageSize == 0)
            {
                ppi = ppi - 1;
            }
            if (PageIndex <= ppi)
            {
                grdMain.CurrentPageIndex = PageIndex;
            }
            else
            {
                grdMain.CurrentPageIndex = 0;
                pc["rep_Config_Page"]    = "0";
            }

            grdMain.DataSource = dv;
            grdMain.DataBind();

            foreach (DataGridItem dgi in grdMain.Items)
            {
                DropDownList ddl = (DropDownList)dgi.FindControl("ddCategory");
                if (ddl != null)
                {
                    ddl.Items.Add(new ListItem(LocRM.GetString("tNotSet"), "0"));
                    ReportCategoryInfo[] _ci = ReportStorage.GetCategories();
                    foreach (ReportCategoryInfo ci in _ci)
                    {
                        ddl.Items.Add(new ListItem(ci.Name, ci.Id.ToString()));
                    }
                }
            }
        }
Esempio n. 15
0
        public ReportController(IConfiguration Configuration)
        {
            string dbCon = Configuration.GetConnectionString("DefaultConnection");

            reportStorage = new ReportStorage(dbCon);
        }