Пример #1
0
 public void PrepForReportGeneration(Measurement m, char separator)
 {
     this.meas   = m;
     t           = new TabularReport(NC.App.Loggers);
     t.Separator = separator;
     sections    = new List <Section>(200);
 }
Пример #2
0
        public void GenerateReport(LMDAQ.HVControl.HVCalibrationParameters hvc, List <HVControl.HVStatus> HVSteps, DateTime time, String instId)
        {
            TabularReport t = new TabularReport(typeof(HVVals), NC.App.Loggers);  // default file output type is CSV

            try
            {
                t.CreateOutputFile(NC.App.Opstate.Measurement.AcquireState.lm.Results, instId + " HV " + time.ToString("yyyyMMddHHmmss"), null);

                t.rows = new Row[HVSteps.Count + 4 + 2];  // header, steps, space, header, current params, space, header, config
                // first, the column header
                int cols = System.Enum.GetValues(typeof(HVVals)).Length;
                int i    = 0;

                // now for each hvcalib row
                for (i = 0; i < HVSteps.Count; i++)
                {
                    HVControl.HVStatus h = HVSteps[i];
                    Row row = CreateRow(h, i);
                    t.rows[i] = row;
                }

                // then do the current parameters
                t.rows[i++] = new Row();
                t.rows[i]   = new Row(); t.rows[i++].GenFromEnum(typeof(HVCalibVals));
                t.rows[i++] = CreateRow(hvc, i);
                t.rows[i++] = new Row();

                // lastly, add the full software version state
                t.rows[i] = new Row(); t.rows[i++].Add(0, "Software application configuration details");
                Row[] temp = AnalysisDefs.SimpleReport.GenSoftwareConfigRows();
                Array.Resize(ref t.rows, temp.Length + t.rows.Length + 2);
                Array.Copy(temp, 0, t.rows, i, temp.Length);

                t.CreateReport(3);
            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            finally
            {
                t.CloseOutputFile();
            }
        }
Пример #3
0
        private object PrepareTabularReportForExport(TabularReport tabularReport, string company)
        {
            var report = new {
                title             = tabularReport.Report.Title,
                company           = company,
                columnDefinitions = tabularReport.Report.ColumnDefinitions.Where(cl => (bool)cl["IsVisible"]).Select(cl => new { title = cl["Title"].ToString(), fieldName = cl["FieldName"].ToString() })
            };

            var data = tabularReport.Data.Select(d => {
                var dataDict = ((IDictionary <string, object>)d);
                IDictionary <string, object> obj = new ExpandoObject();

                obj.Add("columnDefinitions", report.columnDefinitions);
                foreach (var col in report.columnDefinitions)
                {
                    var fieldName = col.fieldName.ToString();
                    obj.Add(fieldName, dataDict[fieldName]);
                }
                return(obj);
            });

            return(new { report = report, data = data });
        }
Пример #4
0
        private TabularReport ConvertToTabularReport(Report report, bool includeData = false, IList <Filter> filters = null)
        {
            TabularReport tabularReport = new TabularReport();

            tabularReport.Report  = report;
            tabularReport.Filters = report.FilterColumns.Select(s => s.ToObject <Filter> ()).ToList();

            foreach (var filter in tabularReport.Filters)
            {
                if (!string.IsNullOrWhiteSpace(filter.Query))
                {
                    var filterData = _dataProvider.GetData(filter.Query);
                    filter.Data = filterData;
                }
            }

            if (includeData)
            {
                var reportData = _dataProvider.GetData(report.Query, filters != null && filters.Count() > 0 ? filters : tabularReport.Filters);
                tabularReport.Data = reportData;
            }

            return(tabularReport);
        }
Пример #5
0
 public void PrepForReportGeneration(Measurement m, char separator)
 {
     this.meas = m;
     t = new TabularReport(NC.App.Loggers);
     t.Separator = separator;
     sections = new List<Section>(200);
 }
Пример #6
0
        public void GenerateReport(LMDAQ.HVControl.HVCalibrationParameters hvc, List<HVControl.HVStatus> HVSteps, DateTime time, String instId)
        {

            TabularReport t = new TabularReport(typeof(HVVals), NC.App.Loggers);  // default file output type is CSV
            try
            {
                t.CreateOutputFile(NC.App.Opstate.Measurement.AcquireState.lm.Results, instId + " HV " + time.ToString("yyyyMMddHHmmss"), null);

                t.rows = new Row[HVSteps.Count + 4 + 2];  // header, steps, space, header, current params, space, header, config
               // first, the column header
                int cols = System.Enum.GetValues(typeof(HVVals)).Length;
                int i = 0;

                // now for each hvcalib row
                for (i = 0; i < HVSteps.Count; i++)
                {
                    HVControl.HVStatus h = HVSteps[i];
                    Row row = CreateRow(h, i);
                    t.rows[i] = row;
                }

                // then do the current parameters
                t.rows[i++] = new Row(); 
                t.rows[i] = new Row(); t.rows[i++].GenFromEnum(typeof(HVCalibVals));
                t.rows[i++] = CreateRow(hvc, i);
                t.rows[i++] = new Row(); 

                // lastly, add the full software version state
                t.rows[i] = new Row(); t.rows[i++].Add(0, "Software application configuration details");
                Row[] temp = AnalysisDefs.SimpleReport.GenSoftwareConfigRows();
                Array.Resize(ref  t.rows, temp.Length + t.rows.Length + 2);
                Array.Copy(temp, 0, t.rows, i, temp.Length);

                t.CreateReport(3);

            }
            catch (Exception e)
            {
                ctrllog.TraceException(e);
            }
            finally
            {
                t.CloseOutputFile();
            }
        }