Esempio n. 1
0
        private void cmdConfig_Click(object sender, RoutedEventArgs e)
        {
            if (rpt == null)
            {
                return;
            }

            MReportConfig      cfg = rpt.GetReportConfig();
            WinFormConfigParam wc  = new WinFormConfigParam("", cfg);

            wc.ShowDialog();

            if (wc.IsOK)
            {
                cfg            = wc.Config;
                cfg.IsModified = true;

                rpt.UpdateReportConfig(wc.Config);
                cmdSave.IsEnabled = cfg.IsModified;

                rpt.UpdateReportConfig(cfg);
                rpt.isPageRange = false;
                rpt.SetDataSourceAndParam(dataSource, cfg);
                rpt.CreateFixedDocument();
                docViewer.Document = rpt.GetFixedDocument();

                //CUtil.LoadPageNavigateCombo(cboPageNo, rpt.PageCount);
                //CUtil.LoadPageCombo(cboFromPage, rpt.PageCount);
                //CUtil.LoadPageCombo(cboToPage, rpt.PageCount);
            }
        }
Esempio n. 2
0
        private void trvMain_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (!(e.NewValue is MReportFilter))
            {
                return;
            }

            if (isInLoad && IsConfigMode)
            {
                return;
            }

            MReportFilter mr    = (MReportFilter)e.NewValue;
            String        rptId = mr.ReportName;

            if (reportObjs.ContainsKey(rptId))
            {
                rpt = (CBaseReport)reportObjs[rptId];
            }
            else
            {
                CBaseReport r = createObject(rptId);
                CUtil.EnableForm(false, this);
                MReportConfig rptCfg = CReportConfigs.GetReportConfig(null, rptId);
                CUtil.EnableForm(true, this);
                MReportConfig defaultCfg = r.CreateDefaultConfigValues();
                defaultCfg.ReportName = rptId;

                if (rptCfg == null)
                {
                    rptCfg = defaultCfg;
                    CReportConfigs.SaveReportConfig(null, rptCfg);
                }
                else
                {
                    rptCfg.PopulateMissingValue(defaultCfg);
                }

                MBaseModel d = null;
                if (dataSource == null)
                {
                    d = r.CreateDefaultData();
                }
                else
                {
                    d = dataSource;
                }

                r.SetDataSourceAndParam(d, rptCfg);
                r.isPageRange = false;
                r.CreateFixedDocument();

                reportObjs.Add(rptId, r);
                rpt = r;
            }

            cmdSave.IsEnabled      = rpt.GetReportConfig().IsModified;
            cbxPageRange.IsEnabled = rpt.IsPageRangeSupport;

            this.Title         = mr.Description;
            docViewer.Document = rpt.GetFixedDocument();

            CUtil.LoadPageNavigateCombo(cboPageNo, rpt.PageCount);
            CUtil.LoadPageCombo(cboFromPage, rpt.PageCount);
            CUtil.LoadPageCombo(cboToPage, rpt.PageCount);
        }