Beispiel #1
0
        /// <summary>
        /// Show dialog & process results
        /// </summary>
        /// <returns></returns>

        public static DialogResult ShowDialog(
            ref GroupingTypeEnum timePeriodType)
        {
            if (Instance == null)
            {
                Instance = new DateGroupingDialog();
            }
            DateGroupingDialog i = Instance;

            i.TimePeriodType = timePeriodType;
            i.Setup(timePeriodType);

            DialogResult dr = i.ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.OK)
            {
                timePeriodType = i.TimePeriodType;
            }

            return(dr);
        }
Beispiel #2
0
        /// <summary>
        /// Render the view into the specified results control
        /// </summary>

        public override void ConfigureRenderingControl()
        {
            Query         q;
            ResultsFormat rf = ResultsFormat;

            ResultsTable rt;
            QueryTable   qt;
            MetaTable    mt;

            ResultsField rfld;

            Mobius.Data.QueryColumn qc;
            MetaColumn mc;

            PivotGridField pgf;

            bool includeActivityClass = true;

            if (!BuildUnpivotedResults(includeActivityClass))
            {
                return;
            }

            PivotGridPropertiesMx p = PivotGridPropertiesMx;

            if (p == null)
            {
                return;
            }

            if (p.PivotFields == null)             // if not defined then configure
            {
                PivotGridCtl.Fields.Clear();       // clear any prev display
                PivotGridCtl.Groups.Clear();

                if (DataIncludesDates)
                {
                    DialogResult dr = DateGroupingDialog.ShowDialog(ref DateGroupInterval);
                }

                p.PivotFields = new List <PivotGridFieldMx>();

                foreach (ResultsTable rt0 in rf.Tables)                 // determine visible fields
                {
                    rt = rt0;
                    qt = rt.QueryTable;
                    mt = qt.MetaTable;
                    if (Lex.Eq(mt.Name, MultiDbAssayDataNames.CombinedNonSumTableName))
                    {
                        if ((rfld = rt.GetResultsFieldByName("activity_bin")) != null)
                        {
                            pgf = PivotGridView.AddField(rfld, p.PivotFields, PivotArea.RowArea, true, null, GroupingTypeEnum.EqualValues);
                        }

                        if ((rfld = rt.GetResultsFieldByName("run_dt")) != null &&
                            DataIncludesDates && DateGroupInterval != GroupingTypeEnum.EqualValues)
                        {
                            GroupingTypeEnum pgi = DateGroupInterval;

                            int  intervalCnt = 0;
                            bool week = false, month = false, year = false;                             // include larger date units up to year
                            if (pgi == GroupingTypeEnum.DateDayOfWeek)
                            {
                                week        = month = year = true;
                                intervalCnt = 3;
                            }

                            else if (pgi == GroupingTypeEnum.DateWeekOfMonth)
                            {
                                intervalCnt = 3;

                                month = year = true;
                            }

                            else if (pgi == GroupingTypeEnum.DateMonth ||
                                     pgi == GroupingTypeEnum.DateQuarter)
                            {
                                year = true;
                            }

                            PivotGridGroup g = null;

                            if (intervalCnt > 1)
                            {
                                g = new PivotGridGroup();
                                PivotGridCtl.Groups.Add(g);
                            }

                            if (year)
                            {
                                PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, GroupingTypeEnum.DateYear);
                            }
                            if (month)
                            {
                                PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, GroupingTypeEnum.DateMonth);
                            }
                            if (week)
                            {
                                PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, GroupingTypeEnum.DateWeekOfMonth);
                            }
                            PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, g, pgi);
                        }

                        if ((rfld = rt.GetResultsFieldByName("assy_nm")) != null)
                        {
                            pgf = PivotGridView.AddField(rfld, p.PivotFields, PivotArea.ColumnArea, true, null, GroupingTypeEnum.EqualValues);
                        }

                        if ((rfld = rt.GetResultsFieldByName("rslt_val")) != null)
                        {
                            pgf = PivotGridView.AddField(rfld, p.PivotFields, PivotArea.DataArea, true, null, GroupingTypeEnum.EqualValues);
                        }
                    }

                    else                     // tables other than the standard pivoted table
                    {
                        foreach (ResultsField rfld0 in rt.Fields)
                        {
                            rfld = rfld0;
                            qc   = rfld.QueryColumn;
                            mc   = qc.MetaColumn;
                        }
                    }
                }
            }                                                             // done defining initial set of fields

            SyncMxFieldListWithSourceQuery(BaseQuery, ref p.PivotFields); // be sure main grid & pivot view fields are in synch

            ConfigurePivotGridControl();                                  // configure the control to display the data

            PivotGridCtl.DataSource = Qm.DataTableManager.DataSource;     // set the data table to start rendering

            return;
        }