コード例 #1
0
        private void WriteTextReport(ReportSettings repSettings, SessionSettings sesSettings, AdvancedListView2 markerList, AdvancedListView2 itemList, AdvancedListView2 controlItemList)
        {
            bool[]            markerColumnFlags, itemColumnFlags;
            Identifiable[]    selectedAnnotationTypes;
            ResultTable       resultMatrix;
            DataTable         pairwiseTable, annotationTable, plateTable, groupTable, singleTable;
            DataColumn        idColumn;
            AdvancedListView2 annotationList, plateList, groupList, singleList;
            FileServer        fs;

            fs = new FileServer();
            try
            {
                //Program name and version.
                if (repSettings.Get(ReportSettings.Bools.IncludeSourceInfo))
                {
                    PrepareNextSection(fs, SECTION_HEADER_VERSION, repSettings);
                    fs.AppendStringToFile(this.GetApplicationVersionDescription());
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Plates section.
                if (repSettings.Get(ReportSettings.Bools.IncludeSelectedPlates))
                {
                    plateTable = MyDataServer.GetPlatesInSelection();
                    plateList  = new AdvancedListView2();
                    plateList.ShowFormattedTable(plateTable);
                    PrepareNextSection(fs, SECTION_HEADER_PLATES, repSettings);
                    fs.AppendStringToFile(plateList.GetListAsString(true, true));
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Groups section.
                if (repSettings.Get(ReportSettings.Bools.IncludeSelectedGroups))
                {
                    groupTable = MyDataServer.GetGroupsInSelection();
                    groupList  = new AdvancedListView2();
                    groupList.ShowFormattedTable(groupTable);
                    PrepareNextSection(fs, SECTION_HEADER_GROUPS, repSettings);
                    fs.AppendStringToFile(groupList.GetListAsString(true, true));
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Detailed filter section.
                if (repSettings.Get(ReportSettings.Bools.IncludeSelectedDetailedFilter))
                {
                    singleTable = MyDataServer.GetDetailedFilter();
                    singleList  = new AdvancedListView2();
                    singleList.ShowFormattedTable(singleTable);
                    PrepareNextSection(fs, SECTION_HEADER_DETAILS, repSettings);
                    fs.AppendStringToFile(singleList.GetListAsString(true, true));
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Control item statistics section.
                if (repSettings.Get(ReportSettings.Bools.IncludeControlItemStat))
                {
                    PrepareNextSection(fs, SECTION_HEADER_CTRL_ITEM_STAT, repSettings);
                    fs.AppendStringToFile(controlItemList.GetListAsString(true, true));
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Experiment statistics section.
                if (repSettings.Get(ReportSettings.Bools.IncludeExperimentStat))
                {
                    markerColumnFlags = repSettings.Get(ReportSettings.BoolArrays.ExperimentStatFlags);
                    PrepareNextSection(fs, SECTION_HEADER_EXP_STAT, repSettings);
                    fs.AppendStringToFile(markerList.GetListAsString(true, true, markerColumnFlags));
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Marker annotations section.
                if (repSettings.Get(ReportSettings.Bools.IncludeAnnotations))
                {
                    selectedAnnotationTypes = repSettings.Get(ReportSettings.Identifiables.AnnotationTypes);
                    annotationTable         = MyDataServer.GetMarkerAnnotations(selectedAnnotationTypes, sesSettings);
                    annotationList          = new AdvancedListView2();
                    annotationList.ShowFormattedTable(annotationTable);
                    PrepareNextSection(fs, SECTION_HEADER_ANNOTATIONS, repSettings);
                    fs.AppendStringToFile(annotationList.GetListAsString(true, true));
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Item statistics section.
                if (repSettings.Get(ReportSettings.Bools.IncludeItemStat))
                {
                    itemColumnFlags = repSettings.Get(ReportSettings.BoolArrays.ItemStatFlags);
                    PrepareNextSection(fs, SECTION_HEADER_ITEM_STAT, repSettings);
                    fs.AppendStringToFile(itemList.GetListAsString(true, true, itemColumnFlags));
                    fs.AppendStringToFile(Environment.NewLine);
                }

                //Result section.
                if (repSettings.Get(ReportSettings.Bools.IncludeResults))
                {
                    PrepareNextSection(fs, SECTION_HEADER_RESULTS, repSettings);
                    if (repSettings.Get(ReportSettings.Strings.ResultTableType) == ReportSettings.ResultTableTypeExpmRows)
                    {
                        resultMatrix = new ResultTable(MyDataServer, ResultTable.Mode.ExperimentByItem, repSettings.Get(ReportSettings.Strings.EmptyResultString));
                        fs.AppendStringToFile(resultMatrix.GetTabDelimited());
                    }
                    else if (repSettings.Get(ReportSettings.Strings.ResultTableType) == ReportSettings.ResultTableTypeExpmCol)
                    {
                        resultMatrix = new ResultTable(MyDataServer, ResultTable.Mode.ItemByExperiment, repSettings.Get(ReportSettings.Strings.EmptyResultString));
                        fs.AppendStringToFile(resultMatrix.GetTabDelimited());
                    }
                    else if (repSettings.Get(ReportSettings.Strings.ResultTableType) == ReportSettings.ResultTableTypePairAll)
                    {
                        pairwiseTable = MyDataServer.GetApprovedResultFormattedOuter(true, repSettings.Get(ReportSettings.Strings.EmptyResultString));
                        //Remove the ID column.
                        idColumn = pairwiseTable.Columns[0];
                        pairwiseTable.Columns.Remove(idColumn);

                        fs.AppendStringToFile(TabDelimiter.GetString(pairwiseTable, true));
                    }
                    else if (repSettings.Get(ReportSettings.Strings.ResultTableType) == ReportSettings.ResultTableTypePairApp)
                    {
                        pairwiseTable = MyDataServer.GetApprovedResultFormatted();
                        //Remove the ID column.
                        idColumn = pairwiseTable.Columns[0];
                        pairwiseTable.Columns.Remove(idColumn);
                        fs.AppendStringToFile(TabDelimiter.GetString(pairwiseTable, true));
                    }
                    fs.AppendStringToFile(Environment.NewLine);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (fs != null)
                {
                    fs.CloseFile();
                }
            }
        }