コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        email = QueryHelper.GetString(Server.UrlDecode("email"), String.Empty);
        Guid subscriptionGUID = QueryHelper.GetGuid("guid", Guid.Empty);
        rsi = ReportSubscriptionInfoProvider.GetReportSubscriptionInfo(subscriptionGUID);
        if (rsi != null)
        {
            ri = ReportInfoProvider.GetReportInfo(rsi.ReportSubscriptionReportID);
            if (ri != null)
            {
                // Set info label based by subscription's report
                lblInfo.Text = String.Format(GetString("reportsubscription.unsubscription.info"), email, ri.ReportDisplayName);
            }
        }
        else
        {
            ShowError(GetString("reportsubscription.notfound"));
            pnlInfo.Visible = false;
            btnUnsubscribe.Enabled = false;
        }

        btnUnsubscribe.Text = GetString("reportsubscription.unsubscribe");
        Title = GetString("reportsubscription.unsubscribe.title");

        CurrentMaster.Title.TitleText = GetString("reportsubscription.unsubscribe.title");
        CurrentMaster.Title.TitleImage = GetImageUrl("/CMSModules/CMS_Reporting/Subscription24.png");
    }
コード例 #2
0
ファイル: ReportInfoTests.cs プロジェクト: mparsin/Elements
        public void SerializationTest()
        {
            const string ReportName = "Report";
            const string KeyName = "item ";
            const string ValueName = "value ";
            const int ParamCount = 2;

            var reportParameters = new Dictionary<string, object>();
            for (var i = 0; i < ParamCount; i++)
            {
                reportParameters.Add(KeyName + i, ValueName + i);
            }

            var report = new ReportInfo(ReportName, reportParameters);

            var serializedReport = report.ToString();

            var deserializedReport = serializedReport.ToReportInfo();

            Assert.AreEqual(deserializedReport.ReportName, ReportName);

            for (var i = 0; i < ParamCount; i++)
            {
                Assert.AreEqual(deserializedReport.ReportParametres[KeyName + i], ValueName + i);
            }
        }
コード例 #3
0
        public MsReportForm(string reportInfoName)
            : this()
        {
            m_reportInfo = ADInfoBll.Instance.GetReportInfo(reportInfoName);
            if (m_reportInfo == null)
            {
                throw new ArgumentException("不存在名为" + reportInfoName + "的ReportInfo!");
            }

            string reportFile = ReportHelper.CreateMsReportFile(m_reportInfo.ReportDocument);
            this.reportViewer1.LocalReport.ReportPath = reportFile;
            m_dataSet = ReportHelper.CreateDataset(m_reportInfo.DatasetName);
            foreach (DataTable dt in m_dataSet.Tables)
            {
                this.reportViewer1.LocalReport.DataSources.Add(
                    new Microsoft.Reporting.WinForms.ReportDataSource(m_dataSet.DataSetName + "_" + dt.TableName, dt));
            }
            m_reportDataInfos = ADInfoBll.Instance.GetReportDataInfo(m_reportInfo.Name);

            foreach (ReportDataInfo reportDataInfo in m_reportDataInfos)
            {
                if (string.IsNullOrEmpty(reportDataInfo.SearchManagerClassName))
                {
                    throw new ArgumentException("ReportDataInfo of " + reportDataInfo.Name + " 's SearchManagerClassName must not be null!");
                }

                ISearchManager sm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(reportDataInfo.SearchManagerClassName, reportDataInfo.SearchManagerClassParams);

                sm.EnablePage = false;

                m_sms.Add(sm);
            }

            this.FormClosed += new FormClosedEventHandler(MsReportForm_FormClosed);
        }
コード例 #4
0
ファイル: ReportInfoTest.cs プロジェクト: spiffydudex/navbot
        public void ItemName()
        {
            ReportInfo reportInfo = new ReportInfo("SomePath\\Logs\\MarketTestInput - Kernite - 2007.01.28 112233.txt");
            Assert.AreEqual("Kernite", reportInfo.ItemName);

            reportInfo = new ReportInfo("SomePath\\Logs\\MarketTestInput-Kernite-2007.01.28 112233.txt");
            Assert.AreEqual("Kernite", reportInfo.ItemName);
        }
コード例 #5
0
ファイル: ReportInfoTest.cs プロジェクト: spiffydudex/navbot
        public void Region()
        {
            ReportInfo reportInfo = new ReportInfo("SomePath\\Logs\\FunnyRegion - Kernite - 2007.01.28 112233.txt");
            Assert.AreEqual("FunnyRegion", reportInfo.Region);

            reportInfo = new ReportInfo("SomePath\\Logs\\FunnyRegion-Kernite-2007.01.28 112233.txt");
            Assert.AreEqual("FunnyRegion", reportInfo.Region);
        }
コード例 #6
0
    /// <summary>
    /// Returns true if graph belongs to report.
    /// </summary>
    /// <param name="report">Report to validate</param>
    public override bool IsValid(ReportInfo report)
    {
        ReportValueInfo rvi = ValueInfo;

        if ((report != null) && (rvi != null) && (report.ReportID == rvi.ValueReportID))
        {
            return true;
        }

        return false;
    }
コード例 #7
0
ファイル: ReportInfoTest.cs プロジェクト: spiffydudex/navbot
        public void ItemsWithDashesInTheirName()
        {
            ReportInfo reportInfo = new ReportInfo("Lonetrek - Limited Ocular Filter - Beta - 2007.05.04 144310.txt");
            Assert.AreEqual("Limited Ocular Filter - Beta", reportInfo.ItemName);

            reportInfo = new ReportInfo("Lonetrek - Limited Ocular Filter 'Gunslinger' - TXL-1 - 2007.05.04 144310.txt");
            Assert.AreEqual("Limited Ocular Filter 'Gunslinger' - TXL-1", reportInfo.ItemName);

            reportInfo = new ReportInfo("Lonetrek-Limited Ocular Filter 'Gunslinger' - TXL-1-2007.05.04 144310.txt");
            Assert.AreEqual("Limited Ocular Filter 'Gunslinger' - TXL-1", reportInfo.ItemName);
        }
コード例 #8
0
ファイル: ReportInfoTest.cs プロジェクト: spiffydudex/navbot
        public void ItemDateIsInTheFuture()
        {
            ReportInfo reportInfo = new ReportInfo("SomePath\\Logs\\MarketTestInput - Kernite - 5007.01.01 010101.txt");
            // dates from the future should be clamped to the current date/time (accurate to the minute is good enough)
            string expected = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
            Assert.AreEqual(expected, reportInfo.Date.ToShortDateString() + " " + reportInfo.Date.ToShortTimeString());

            reportInfo = new ReportInfo("SomePath\\Logs\\MarketTestInput-Kernite-5007.01.01 010101.txt");
            // dates from the future should be clamped to the current date/time (accurate to the minute is good enough)
            Assert.AreEqual(expected, reportInfo.Date.ToShortDateString() + " " + reportInfo.Date.ToShortTimeString());
        }
コード例 #9
0
ファイル: ReportInfoTest.cs プロジェクト: spiffydudex/navbot
        public void ItemDate()
        {
            DateTime expected = new DateTime(2007, 01, 14, 9, 30, 13);
            ReportInfo reportInfo = new ReportInfo("SomePath\\Logs\\MarketTestInput - Kernite - 2007.01.14 093013.txt");
            // dates should be reported in local time
            Assert.AreEqual(TimeZone.CurrentTimeZone.ToLocalTime(expected), reportInfo.Date);

            reportInfo = new ReportInfo("SomePath\\Logs\\MarketTestInput-Kernite-2007.01.14 093013.txt");
            // dates should be reported in local time
            Assert.AreEqual(TimeZone.CurrentTimeZone.ToLocalTime(expected), reportInfo.Date);
        }
コード例 #10
0
        public MyReportForm(string reportInfoName)
            : this()
        {
            m_reportInfo = ADInfoBll.Instance.GetReportInfo(reportInfoName);
            if (m_reportInfo == null)
            {
                throw new ArgumentException("不存在名为" + reportInfoName + "的ReportInfo!");
            }

            ReportDocument reportDocument = ReportHelper.CreateReportDocument(m_reportInfo.ReportDocument);
            this.crystalReportViewer1.CrystalHelper.ReportSource = reportDocument;
            this.crystalReportViewer1.TemplateDataSet = ReportHelper.CreateDataset(m_reportInfo.DatasetName);

            m_reportDataInfos = ADInfoBll.Instance.GetReportDataInfo(m_reportInfo.Name);
            //FillDataSet(data, this.TemplateDataSet);
            //if (m_reportInfo.AfterProcess != null)
            //{
            //    ADUtils.ExecuteProcess(ADInfoBll.Instance.GetProcessInfo(m_reportInfo.AfterProcess.Name),
            //       new Dictionary<string, object> { { "masterForm", this } });
            //}

            foreach (ReportDataInfo reportDataInfo in m_reportDataInfos)
            {
                if (string.IsNullOrEmpty(reportDataInfo.SearchManagerClassName))
                {
                    throw new ArgumentException("ReportDataInfo of " + reportDataInfo.Name + " 's SearchManagerClassName must not be null!");
                }

                ISearchManager sm = ServiceProvider.GetService<IManagerFactory>().GenerateSearchManager(reportDataInfo.SearchManagerClassName, reportDataInfo.SearchManagerClassParams);

                sm.EnablePage = false;

                m_sms.Add(sm);
            }

            this.FormClosed += new FormClosedEventHandler(MyReportForm_FormClosed);
        }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope = ReportInfo.OBJECT_TYPE;
        ConnectionStringRow.Visible = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQueryQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        txtQueryQuery.Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries");

        versionList.OnAfterRollback += versionList_onAfterRollback;

        // Register script for resize and rollback
        RegisterResizeAndRollbackScript("divFooter", divScrolable.ClientID);

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.general")
        });

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.preview")
        });

        tabControlElem.UsePostback = true;

        Title = "ReportGraph Edit";
        PageTitle.HelpTopicName = HELP_TOPIC_LINK;

        rfvCodeName.ErrorMessage = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        Save += (s, ea) =>
        {
            if (SetData(true))
            {
                ltlScript.Text += ScriptHelper.GetScript("window.RefreshContent();CloseDialog();");
            }
        };

        int reportId = QueryHelper.GetInteger("reportid", 0);
        bool isPreview = QueryHelper.GetBoolean("preview", false);

        // If preview by URL -> select preview tab
        if (isPreview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
        }

        if (reportId > 0)
        {
            mReportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (PersistentEditedObject == null)
        {
            if (mReportInfo != null) //must be valid reportid parameter
            {
                int id = QueryHelper.GetInteger("objectid", 0);

                // Try to load graph name from hidden field (adding new graph & preview)
                if (id == 0)
                {
                    id = ValidationHelper.GetInteger(txtNewGraphHidden.Value, 0);
                }

                if (id > 0)
                {
                    PersistentEditedObject = ReportGraphInfoProvider.GetReportGraphInfo(id);
                    mReportGraphInfo = PersistentEditedObject as ReportGraphInfo;
                }
            }
        }
        else
        {
            mReportGraphInfo = PersistentEditedObject as ReportGraphInfo;
        }

        if (mReportInfo != null)
        {
            ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;
        }

        if (mReportGraphInfo != null)
        {
            PageTitle.TitleText = GetString("Reporting_ReportGraph_EditHTML.TitleText");
            mGraphId = mReportGraphInfo.GraphID;

            if (ObjectVersionManager.DisplayVersionsTab(mReportGraphInfo))
            {
                tabControlElem.TabItems.Add(new UITabItem
                {
                    Text = GetString("objectversioning.tabtitle")
                });

                versionList.Object = mReportGraphInfo;
                versionList.IsLiveSite = false;
            }
        }
        else
        {
            PageTitle.TitleText = GetString("Reporting_ReportGraph_EditHTML.NewItemTitleText");
            mNewReport = true;
        }

        if (!RequestHelper.IsPostBack())
        {
            // Load default data for new report
            if (mNewReport)
            {
                ucSelectString.Value = String.Empty;
                txtQueryNoRecordText.Text = GetString("attachmentswebpart.nodatafound");
                txtItemValueFormat.Text = "{%yval%}";
                txtSeriesItemTooltip.Text = "{%ser%}";
                chkExportEnable.Checked = true;
                chkSubscription.Checked = true;
            }
            // Otherwise load saved data
            else
            {
                LoadData();
            }
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
        CurrentMaster.PanelContent.RemoveCssClass("ModalDialogContent");
    }
コード例 #12
0
        public ReportInfo Decode(string qrinfo)
        {
            int key = 0;

            try
            {
                key = Convert.ToInt32(qrinfo.Substring(qrinfo.Length - 3, 3));
                key = key - 256;
            }
            catch (Exception)
            {
                return(null);
            }
            string values = qrinfo.Substring(0, qrinfo.Length - 3);

            values = Reverse(values);
            string     info   = UnicodeToString(StringToUnicode(values, key));
            ReportInfo result = null;

            if (info.IndexOf("|") != -1)
            {
                result = new ReportInfo();
                string[] str = info.Split('|');
                for (int i = 0; i < str.Length; i++)
                {
                    switch (i)
                    {
                    case 0:
                        result.ReportNum = str[i];
                        break;

                    case 1:
                        result.ProjectName = str[i];
                        break;

                    case 2:
                        result.StructPart = str[i];
                        break;

                    case 3:
                        result.CheckItem = str[i];
                        break;

                    case 4:
                        result.CheckParam = str[i];
                        break;

                    case 5:
                        if (!str[i].Equals("C") && !str[i].Equals(""))
                        {
                            result.Conclusion = "详见" + result.ReportNum + "报告";
                        }
                        else
                        {
                            result.Conclusion = "详见" + str[i] + "报告";
                        }
                        break;

                    case 6:
                        result.ReportDate = str[i];
                        break;

                    case 7:
                        result.AntiFakeLabel = str[i];
                        break;

                    case 8:
                        result.ItemCode = str[i];
                        break;

                    case 9:
                        result.UnitCode = str[i];
                        break;

                    default:
                        break;
                    }
                }
            }
            return(result);
        }
コード例 #13
0
ファイル: Default.aspx.cs プロジェクト: KuduApps/Kentico
    /// <summary>
    /// Gets and bulk updates reports. Called when the "Get and bulk update reports" button is pressed.
    /// Expects the CreateReport method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateReports()
    {
        // Prepare the parameters
        string where = "ReportName LIKE N'MyNewReport%'";
        string orderby = "";
        int topN = 0;
        string columns = "";

        // Get the data
        DataSet reports = ReportInfoProvider.GetReports(where, orderby, topN, columns);
        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Loop through the individual items
            foreach (DataRow reportDr in reports.Tables[0].Rows)
            {
                // Create object from DataRow
                ReportInfo modifyReport = new ReportInfo(reportDr);

                // Update the properties
                modifyReport.ReportDisplayName = modifyReport.ReportDisplayName.ToUpper();

                // Save the changes
                ReportInfoProvider.SetReportInfo(modifyReport);
            }

            return true;
        }

        return false;
    }
コード例 #14
0
        public override void Execute(ReportInfo RI)
        {
            string reportsResultFolder           = string.Empty;
            HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault();

            if (WorkSpace.Instance.RunsetExecutor.RunSetConfig.RunsetExecLoggerPopulated)
            {
                string runSetFolder = string.Empty;
                if (WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null)
                {
                    runSetFolder = WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder;
                    AutoLogProxy.UserOperationStart("Online Report");
                }
                else
                {
                    runSetFolder = ExecutionLogger.GetRunSetLastExecutionLogFolderOffline();
                    AutoLogProxy.UserOperationStart("Offline Report");
                }
                if (!string.IsNullOrEmpty(selectedHTMLReportTemplateID.ToString()))
                {
                    ObservableList <HTMLReportConfiguration> HTMLReportConfigurations = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>();
                    if ((isHTMLReportFolderNameUsed) && (HTMLReportFolderName != null) && (HTMLReportFolderName != string.Empty))
                    {
                        string currentHTMLFolderName = string.Empty;
                        if (!isHTMLReportPermanentFolderNameUsed)
                        {
                            currentHTMLFolderName = HTMLReportFolderNameCalculated + "\\" + System.IO.Path.GetFileName(runSetFolder);
                        }
                        else
                        {
                            currentHTMLFolderName = HTMLReportFolderNameCalculated;
                        }
                        reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder),
                                                                                                                                false,
                                                                                                                                HTMLReportConfigurations.Where(x => (x.ID == selectedHTMLReportTemplateID)).FirstOrDefault(),
                                                                                                                                currentHTMLFolderName,
                                                                                                                                isHTMLReportPermanentFolderNameUsed, currentConf.HTMLReportConfigurationMaximalFolderSize);
                    }
                    else
                    {
                        reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder),
                                                                                                                                false,
                                                                                                                                HTMLReportConfigurations.Where(x => (x.ID == selectedHTMLReportTemplateID)).FirstOrDefault(),
                                                                                                                                null,
                                                                                                                                isHTMLReportPermanentFolderNameUsed);
                    }
                }
                else
                {
                    reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder),
                                                                                                                            false,
                                                                                                                            null,
                                                                                                                            null,
                                                                                                                            isHTMLReportPermanentFolderNameUsed);
                }
            }
            else
            {
                Errors = "In order to get HTML report, please, perform executions before";
                Reporter.HideStatusMessage();
                Status = Ginger.Run.RunSetActions.RunSetActionBase.eRunSetActionStatus.Failed;
                return;
            }
        }
コード例 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope               = ReportInfo.OBJECT_TYPE;
        ConnectionStringRow.Visible        = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        txtQuery.Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries");

        versionList.OnAfterRollback += versionList_onAfterRollback;

        // Register common resize and refresh scripts
        RegisterScripts("divFooter", divScrolable.ClientID);

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.general")
        });

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.preview")
        });

        tabControlElem.UsePostback = true;

        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        Save += (s, ea) =>
        {
            if (SetData(true))
            {
                ltlScript.Text += ScriptHelper.GetScript("window.RefreshContent();CloseDialog();");
            }
        };

        int  reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview  = QueryHelper.GetBoolean("preview", false);

        if (reportId > 0)
        {
            mReportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        // If preview by URL -> select preview tab
        bool isPreview = QueryHelper.GetBoolean("preview", false);

        if (isPreview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
        }

        if (PersistentEditedObject == null)
        {
            if (mReportInfo != null) // Must be valid reportid parameter
            {
                int id = QueryHelper.GetInteger("objectid", 0);

                // Try to load tableName from hidden field (adding new graph & preview)
                if (id == 0)
                {
                    id = ValidationHelper.GetInteger(txtNewTableHidden.Value, 0);
                }

                if (id > 0)
                {
                    PersistentEditedObject = ReportTableInfoProvider.GetReportTableInfo(id);
                    mReportTableInfo       = PersistentEditedObject as ReportTableInfo;
                }
            }
        }
        else
        {
            mReportTableInfo = PersistentEditedObject as ReportTableInfo;
        }

        if (mReportInfo != null)
        {
            ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;

            // Control text initializations
            if (mReportTableInfo != null)
            {
                PageTitle.TitleText = GetString("Reporting_ReportTable_Edit.TitleText");
                mTableId            = mReportTableInfo.TableID;

                if (ObjectVersionManager.DisplayVersionsTab(mReportTableInfo))
                {
                    tabControlElem.TabItems.Add(new UITabItem
                    {
                        Text = GetString("objectversioning.tabtitle")
                    });

                    versionList.Object     = mReportTableInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else // New item
            {
                PageTitle.TitleText = GetString("Reporting_ReportTable_Edit.NewItemTitleText");
                if (!RequestHelper.IsPostBack())
                {
                    ucSelectString.Value      = String.Empty;
                    txtPageSize.Text          = "15";
                    txtQueryNoRecordText.Text = GetString("attachmentswebpart.nodatafound");
                    chkExportEnable.Checked   = true;
                    chkSubscription.Checked   = true;
                }
            }

            if (!RequestHelper.IsPostBack())
            {
                ControlsHelper.FillListControlWithEnum <PagerButtons>(drpPageMode, "PagerButtons");
                // Preselect page numbers paging
                drpPageMode.SelectedValue = ((int)PagerButtons.Numeric).ToString();

                LoadData();
            }
        }

        if ((preview) && (!RequestHelper.IsPostBack()))
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }

        // In case of preview paging without saving table
        if (RequestHelper.IsPostBack() && tabControlElem.SelectedTab == 1)
        {
            // Reload default parameters
            FormInfo fi = new FormInfo(mReportInfo.ReportParameters);

            // Get datarow with required columns
            ctrlReportTable.ReportParameters = fi.GetDataRow(false);
            fi.LoadDefaultValues(ctrlReportTable.ReportParameters, true);

            // Collect data and put them in table info
            SetData();
            ctrlReportTable.TableInfo = mReportTableInfo;
        }
    }
コード例 #16
0
    /// <summary>
    /// Returns report graph.
    /// </summary>
    private void GetReportGraph(ReportGraphInfo reportGraph)
    {
        // Check whether report graph is defined
        if (reportGraph == null)
        {
            return;
        }

        report = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);
        if (report == null)
        {
            return;
        }

        // Check graph security settings
        if (!(CheckReportAccess(report) && CheckEmailModeSubscription(report, ValidationHelper.GetBoolean(ReportGraphInfo.GraphSettings["SubscriptionEnabled"], true))))
        {
            Visible = false;
            return;
        }

        // Prepare query attributes
        QueryText = reportGraph.GraphQuery;
        QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;

        // Init parameters
        InitParameters(report.ReportParameters);

        // Init macro resolver
        InitResolver();

        // Indicaates whether exception was throw during data loading
        errorOccurred = false;

        // Create graph data
        try
        {
            // Load data
            DataSource = LoadData();
        }
        catch (Exception ex)
        {
            EventLogProvider.LogException("Get report graph", "E", ex);
            lblError.Text = ex.Message;
            lblError.Visible = true;
            errorOccurred = true;
        }

        if (DataHelper.DataSourceIsEmpty(DataSource) && EmailMode && SendOnlyNonEmptyDataSource)
        {
            Visible = false;
            return;
        }
    }
コード例 #17
0
ファイル: ReportPrinter.cs プロジェクト: kozlov-d/QSProjects
 public ReportPrinter(ReportInfo info)
 {
     ReportInfo = info;
 }
コード例 #18
0
    /// <summary>
    /// Sets data to database.
    /// </summary>
    protected void SaveReport()
    {
        // Check 'Modify' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
        {
            RedirectToAccessDenied("cms.reporting", "Modify");
        }
        string errorMessage = new Validator().NotEmpty(txtReportDisplayName.Text.Trim(), rfvReportDisplayName.ErrorMessage).NotEmpty(txtReportName.Text.Trim(), rfvReportName.ErrorMessage).Result;

        if ((errorMessage == "") && (!ValidationHelper.IsCodeName(txtReportName.Text.Trim())))
        {
            errorMessage = GetString("general.invalidcodename");
        }

        ReportAccessEnum reportAccess = ReportAccessEnum.All;

        if (!chkReportAccess.Checked)
        {
            reportAccess = ReportAccessEnum.Authenticated;
        }

        if (String.IsNullOrEmpty(errorMessage))
        {
            ReportInfo reportInfo = ReportInfoProvider.GetReportInfo(reportId);
            ReportInfo nri        = ReportInfoProvider.GetReportInfo(txtReportName.Text.Trim());

            // If report with given name already exists show error message
            if ((nri != null) && (nri.ReportID != reportInfo.ReportID))
            {
                ShowError(GetString("Report_New.ReportAlreadyExists"));
                return;
            }

            if (reportInfo != null)
            {
                reportInfo.ReportLayout = htmlTemplateBody.ResolvedValue;

                // If there was a change in report code name change codenames in layout
                if (reportInfo.ReportName != txtReportName.Text.Trim())
                {
                    // part of old macro
                    string oldValue = "?" + reportInfo.ReportName + ".";
                    string newValue = "?" + txtReportName.Text.Trim() + ".";

                    reportInfo.ReportLayout = reportInfo.ReportLayout.Replace(oldValue, newValue);

                    // Set updated text back to HTML editor
                    htmlTemplateBody.ResolvedValue = reportInfo.ReportLayout;
                }
                int categoryID = ValidationHelper.GetInteger(selectCategory.Value, reportInfo.ReportCategoryID);

                // If there was a change in display name refresh category tree
                if ((reportInfo.ReportDisplayName != txtReportDisplayName.Text.Trim()) || (reportInfo.ReportCategoryID != categoryID))
                {
                    ltlScript.Text += ScriptHelper.GetScript(@"if ((parent != null) && (parent.Refresh != null)) {parent.Refresh();}");
                }

                reportInfo.ReportDisplayName        = txtReportDisplayName.Text.Trim();
                reportInfo.ReportName               = txtReportName.Text.Trim();
                reportInfo.ReportAccess             = reportAccess;
                reportInfo.ReportCategoryID         = categoryID;
                reportInfo.ReportEnableSubscription = chkEnableSubscription.Checked;
                reportInfo.ReportConnectionString   = ValidationHelper.GetString(ucSelectString.Value, String.Empty);

                ReportInfoProvider.SetReportInfo(reportInfo);

                ShowChangesSaved();

                // Reload header if changes were saved
                ScriptHelper.RefreshTabHeader(Page, GetString("general.general"));
            }
        }
        else
        {
            ShowError(errorMessage);
        }
    }
コード例 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope        = PredefinedObjectType.REPORT;
        pnlConnectionString.Visible = CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        Title = "Report General";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ReloadPage", ScriptHelper.GetScript("function ReloadPage() { \n" + Page.ClientScript.GetPostBackEventReference(btnHdnReload, null) + "}"));

        reportId = ValidationHelper.GetInteger(Request.QueryString["reportId"], 0);

        // control initializations
        rfvReportDisplayName.ErrorMessage = GetString("Report_New.EmptyDisplayName");
        rfvReportName.ErrorMessage        = GetString("Report_New.EmptyCodeName");

        lblReportDisplayName.Text = GetString("Report_New.DisplayNameLabel");
        lblReportName.Text        = GetString("Report_New.NameLabel");
        lblReportCategory.Text    = GetString("Report_General.CategoryLabel");
        lblLayout.Text            = GetString("Report_General.LayoutLabel");
        lblGraphs.Text            = GetString("Report_General.GraphsLabel") + ":";
        lblHtmlGraphs.Text        = GetString("Report_General.HtmlGraphsLabel") + ":";
        lblTables.Text            = GetString("Report_General.TablesLabel") + ":";
        lblValues.Text            = GetString("Report_General.TablesValues") + ":";
        lblReportAccess.Text      = GetString("Report_General.ReportAccessLabel");

        actionsElem.ActionsList.Add(new SaveAction(Page));
        actionsElem.ActionPerformed += new CommandEventHandler(actionsElem_ActionPerformed);

        AttachmentTitle.TitleText = GetString("general.attachments");

        attachmentList.AllowPasteAttachments = true;
        attachmentList.ObjectID   = reportId;
        attachmentList.ObjectType = ReportingObjectType.REPORT;
        attachmentList.Category   = MetaFileInfoProvider.OBJECT_CATEGORY_LAYOUT;

        // Get report info
        ri = ReportInfoProvider.GetReportInfo(reportId);

        if (!RequestHelper.IsPostBack())
        {
            LoadData();
        }

        htmlTemplateBody.AutoDetectLanguage = false;
        htmlTemplateBody.DefaultLanguage    = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        htmlTemplateBody.EditorAreaCSS      = "";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ReportingHTML", ScriptHelper.GetScript(" var reporting_htmlTemplateBody = '" + htmlTemplateBody.ClientID + "'"));

        // initialize item list controls
        ilGraphs.Report     = ri;
        ilTables.Report     = ri;
        ilValues.Report     = ri;
        ilHtmlGraphs.Report = ri;

        ilGraphs.EditUrl     = "ReportGraph_Edit.aspx";
        ilTables.EditUrl     = "ReportTable_Edit.aspx";
        ilValues.EditUrl     = "ReportValue_Edit.aspx";
        ilHtmlGraphs.EditUrl = "ReportHtmlGraph_Edit.aspx";

        ilGraphs.ItemType     = ReportItemType.Graph;
        ilTables.ItemType     = ReportItemType.Table;
        ilValues.ItemType     = ReportItemType.Value;
        ilHtmlGraphs.ItemType = ReportItemType.HtmlGraph;

        // Refresh script
        string script = "function RefreshWOpener(w) { if (w.refreshPageOnClose){ " + ControlsHelper.GetPostBackEventReference(this, "arg") + " }}";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ReportingRefresh", ScriptHelper.GetScript(script));
    }
コード例 #20
0
ファイル: RunSetActionBase.cs プロジェクト: ramizil/Ginger
 public abstract void Execute(ReportInfo RI);
コード例 #21
0
ファイル: RunSetActionBase.cs プロジェクト: ramizil/Ginger
        internal void ExecuteWithRunPageBFES()
        {
            ReportInfo RI = new ReportInfo(App.RunsetExecutor.RunsetExecutionEnvironment, App.RunsetExecutor);

            RunAction(RI);
        }
コード例 #22
0
    /// <summary>
    /// Returns report graph.
    /// </summary>
    private void GetReportGraph(ReportGraphInfo reportGraph)
    {
        Visible         = true;
        ucChart.Visible = true;

        int correctWidth = 0;

        if (ComputedWidth != 0)
        {
            correctWidth = ModifyGraphInfo();
        }

        if (Width != String.Empty)
        {
            int graphWidth = ValidationHelper.GetInteger(Width, 0);
            if (graphWidth != 0)
            {
                reportGraph.GraphWidth = graphWidth;
            }
        }

        if (Height != 0)
        {
            reportGraph.GraphHeight = Height;
        }

        ReportGraph graph = new ReportGraph();

        graph.ChartControl = ucChart;

        report = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);
        if (report == null)
        {
            return;
        }

        // Check graph security settings
        if (report.ReportAccess != ReportAccessEnum.All)
        {
            if (!CMSContext.CurrentUser.IsAuthenticated())
            {
                Visible = false;
                return;
            }
        }

        // Set default parametrs directly if not set
        if (ReportParameters == null)
        {
            // Load ReportInfo
            if (report != null)
            {
                FormInfo fi = new FormInfo(report.ReportParameters);

                // Get datarow with required columns
                ReportParameters = fi.GetDataRow(false);
                fi.LoadDefaultValues(ReportParameters, true);
            }
        }

        // If used via widget - this function ensure showing specific interval from actual time (f.e. last 6 weeks)
        ApplyTimeParameters();

        // Only use base parameters in case of stored procedure
        if (QueryIsStoredProcedure)
        {
            AllParameters = SpecialFunctions.ConvertDataRowToParams(ReportParameters, null);
        }

        ContextResolver resolver = CMSContext.CurrentResolver.CreateContextChild();

        errorOccurred = false;

        // Create graph image
        try
        {
            // Resolve parameters in query
            resolver.SourceParameters = AllParameters.ToArray();

            // Resolve dynamic data macros
            if (DynamicMacros != null)
            {
                for (int i = 0; i <= DynamicMacros.GetUpperBound(0); i++)
                {
                    resolver.AddDynamicParameter(DynamicMacros[i, 0], DynamicMacros[i, 1]);
                }
            }

            // Prepare query attributes
            QueryText = resolver.ResolveMacros(reportGraph.GraphQuery);
            QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;

            // LoadData
            DataSet dsGraphData = LoadData();

            // Empty dataset, and flag not send empty dataset is set
            if (SendOnlyNonEmptyDataSource && EmailMode && DataHelper.DataSourceIsEmpty(dsGraphData))
            {
                Visible = false;
                return;
            }

            // Test if dataset is empty
            if (DataHelper.DataSourceIsEmpty(dsGraphData))
            {
                string noRecordText = CMSContext.ResolveMacros(ValidationHelper.GetString(reportGraph.GraphSettings["QueryNoRecordText"], String.Empty));
                if (noRecordText != String.Empty)
                {
                    ltlEmail.Text   = noRecordText;
                    lblInfo.Text    = noRecordText;
                    ucChart.Visible = false;
                    menuCont.MenuID = String.Empty;
                    EnableExport    = false;
                    plcInfo.Visible = true;
                }
                else
                {
                    Visible = false;
                }
            }
            else
            {
                // Create Chart
                graph.CorrectWidth = correctWidth;
                if (EmailMode)
                {
                    byte[] data = graph.CreateChart(reportGraph, dsGraphData, resolver, true);
                    ltlEmail.Text = "##InlineImage##" + reportGraph.GraphName + "##InlineImage##";
                    ReportSubscriptionSender.AddToRequest(report.ReportName, "g" + reportGraph.GraphName, data);
                }
                else
                {
                    graph.CreateChart(reportGraph, dsGraphData, resolver);
                }
            }

            // Check if subscription is allowed
            EnableSubscription = (EnableSubscription && ValidationHelper.GetBoolean(ReportGraphInfo.GraphSettings["SubscriptionEnabled"], true) && report.ReportEnableSubscription);
            if (EmailMode && !EnableSubscription)
            {
                this.Visible = false;
                return;
            }
        }
        catch (Exception ex)
        {
            EventLogProvider ev = new EventLogProvider();
            ev.LogEvent("Get report graph", "E", ex);
            graph.CorrectWidth = correctWidth;
            graph.CreateInvalidDataGraph(reportGraph, "Reporting.Graph.InvalidDataGraph", false);
            errorOccurred = true;
        }
    }
コード例 #23
0
    /// <summary>
    /// Returns report graph.
    /// </summary>
    private void GetReportGraph(ReportGraphInfo reportGraph)
    {
        Visible         = true;
        ucChart.Visible = true;

        int correctWidth = 0;

        if (ComputedWidth != 0)
        {
            correctWidth = GetGraphWidth();
        }

        if (Width != String.Empty)
        {
            int graphWidth = ValidationHelper.GetInteger(Width, 0);
            if (graphWidth != 0)
            {
                reportGraph.GraphWidth = graphWidth;
            }
        }

        if (Height != 0)
        {
            reportGraph.GraphHeight = Height;
        }

        ReportGraph graph = new ReportGraph()
        {
            Colors = Colors
        };

        graph.ChartControl = ucChart;

        mReport = ReportInfoProvider.GetReportInfo(reportGraph.GraphReportID);
        if (mReport == null)
        {
            return;
        }

        // Check graph security settings
        if (!(CheckReportAccess(mReport) && CheckEmailModeSubscription(mReport, ValidationHelper.GetBoolean(ReportGraphInfo.GraphSettings["SubscriptionEnabled"], true))))
        {
            Visible = false;
            return;
        }

        // Prepare query attributes
        QueryText = reportGraph.GraphQuery;
        QueryIsStoredProcedure = reportGraph.GraphQueryIsStoredProcedure;

        // Init parameters
        InitParameters(mReport.ReportParameters);

        // Init macro resolver
        InitResolver();

        mErrorOccurred = false;
        DataSet dsGraphData = null;

        // Ensure report item name for caching
        if (String.IsNullOrEmpty(ReportItemName))
        {
            ReportItemName = String.Format("{0};{1}", mReport.ReportName, reportGraph.GraphName);
        }

        // Create graph image
        try
        {
            // LoadData
            dsGraphData = LoadData();
        }
        catch (Exception ex)
        {
            EventLogProvider.LogException("Get report graph", "E", ex);
            graph.CorrectWidth = correctWidth;
            graph.CreateInvalidDataGraph(reportGraph, "Reporting.Graph.InvalidDataGraph", false);
            mErrorOccurred = true;
        }

        // Test if dataset is empty
        if (DataHelper.DataSourceIsEmpty(dsGraphData))
        {
            if (EmailMode && SendOnlyNonEmptyDataSource)
            {
                // Empty dataset, and flag not send empty dataset is set
                Visible = false;
                return;
            }

            string noRecordText = ResolveMacros(ValidationHelper.GetString(reportGraph.GraphSettings["QueryNoRecordText"], String.Empty));
            if (noRecordText != String.Empty)
            {
                ltlEmail.Text   = noRecordText;
                lblInfo.Text    = noRecordText;
                ucChart.Visible = false;
                menuCont.MenuID = String.Empty;
                EnableExport    = false;
                lblInfo.Visible = true;
            }
            else
            {
                Visible = false;
            }
        }
        else
        {
            // Create chart
            graph.CorrectWidth = correctWidth;
            if (EmailMode)
            {
                byte[] data = graph.CreateChart(reportGraph, dsGraphData, ContextResolver, true);
                ltlEmail.Text = "##InlineImage##" + reportGraph.GraphName + "##InlineImage##";
                ReportSubscriptionSender.AddToRequest(mReport.ReportName, "g" + reportGraph.GraphName, data);
            }
            else
            {
                graph.CreateChart(reportGraph, dsGraphData, ContextResolver);
            }
        }
    }
コード例 #24
0
 public override void Execute(ReportInfo RI)
 {
     //TODO: check number of chars and show err if more or update Errors field
     SMSEmail.Send();
 }
    /// <summary>
    /// Returns true if graph belongs to report.
    /// </summary>
    /// <param name="report">Report to validate</param>
    public override bool IsValid(ReportInfo report)
    {
        ReportTableInfo rti = TableInfo;

        if ((report != null) && (rti != null) && (report.ReportID == rti.TableReportID))
        {
            return true;
        }

        return false;
    }
コード例 #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope               = ReportInfo.OBJECT_TYPE;
        ConnectionStringRow.Visible        = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        txtQuery.Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries");

        versionList.OnAfterRollback += versionList_onAfterRollback;

        PageTitle.HelpTopicName = HELP_TOPIC_LINK;

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.general")
        });

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.preview")
        });

        tabControlElem.UsePostback = true;

        RegisterResizeAndRollbackScript("divFooter", divScrolable.ClientID);

        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        int  reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview  = QueryHelper.GetBoolean("preview", false);

        if (reportId > 0)
        {
            mReportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (mReportInfo != null) //must be valid reportid parameter
        {
            ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;

            // If preview by URL -> select preview tab
            bool isPreview = QueryHelper.GetBoolean("preview", false);
            if (isPreview && !RequestHelper.IsPostBack())
            {
                tabControlElem.SelectedTab = 1;
            }

            if (PersistentEditedObject == null)
            {
                int id = QueryHelper.GetInteger("objectid", 0);
                if (id > 0)
                {
                    PersistentEditedObject = ReportValueInfoProvider.GetReportValueInfo(id);
                    mReportValueInfo       = PersistentEditedObject as ReportValueInfo;
                }
            }
            else
            {
                mReportValueInfo = PersistentEditedObject as ReportValueInfo;
            }

            if (mReportValueInfo != null)
            {
                PageTitle.TitleText = GetString("Reporting_ReportValue_Edit.TitleText");
                mValueId            = mReportValueInfo.ValueID;

                if (ObjectVersionManager.DisplayVersionsTab(mReportValueInfo))
                {
                    tabControlElem.TabItems.Add(new UITabItem
                    {
                        Text = GetString("objectversioning.tabtitle")
                    });

                    versionList.Object     = mReportValueInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else //new item
            {
                PageTitle.TitleText     = GetString("Reporting_ReportValue_Edit.NewItemTitleText");
                chkSubscription.Checked = true;

                if (!RequestHelper.IsPostBack())
                {
                    ucSelectString.Value = String.Empty;
                }
            }

            if (!RequestHelper.IsPostBack())
            {
                LoadData();
            }
        }
        else
        {
            ShowError(GetString("Reporting_ReportValue_Edit.InvalidReportId"));
        }

        Save += (s, ea) =>
        {
            if (SetData(true))
            {
                ltlScript.Text += ScriptHelper.GetScript("window.RefreshContent();CloseDialog();");
            }
        };

        if (preview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
        CurrentMaster.PanelContent.RemoveCssClass("ModalDialogContent");
    }
コード例 #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Test permission for query
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries"))
        {
            txtQuery.Enabled = false;
        }
        else
        {
            txtQuery.Enabled = true;
        }

        versionList.OnAfterRollback += new EventHandler(versionList_onAfterRollback);

        string[,] tabs = new string[4, 4];
        tabs[0, 0]     = GetString("general.general");
        tabs[0, 1]     = "SetHelpTopic('helpTopic', 'report_value_properties')";
        tabs[1, 0]     = GetString("general.preview");
        tabs[0, 1]     = "SetHelpTopic('helpTopic', 'report_value_properties')";

        tabControlElem.Tabs               = tabs;
        tabControlElem.UsePostback        = true;
        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "report_value_properties";
        CurrentMaster.Title.TitleCssClass = "PageTitleHeader";

        RegisterResizeAndRollbackScript(divFooter.ClientID, divScrolable.ClientID);

        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        int  reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview  = QueryHelper.GetBoolean("preview", false);

        if (reportId > 0)
        {
            reportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (reportInfo != null) //must be valid reportid parameter
        {
            if (PersistentEditedObject == null)
            {
                string valueName = ValidationHelper.GetString(Request.QueryString["itemname"], "");
                if (ValidationHelper.IsIdentifier(valueName))
                {
                    PersistentEditedObject = ReportValueInfoProvider.GetReportValueInfo(reportInfo.ReportName + "." + valueName);
                    valueInfo = PersistentEditedObject as ReportValueInfo;
                }
            }
            else
            {
                valueInfo = PersistentEditedObject as ReportValueInfo;
            }

            if (valueInfo != null)
            {
                CurrentMaster.Title.TitleText  = GetString("Reporting_ReportValue_Edit.TitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportValue/object.png");

                valueId = valueInfo.ValueID;

                if (ObjectVersionManager.DisplayVersionsTab(valueInfo))
                {
                    tabs[2, 0]             = GetString("objectversioning.tabtitle");
                    tabs[2, 1]             = "SetHelpTopic('helpTopic', 'objectversioning_general');";
                    versionList.Object     = valueInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else //new item
            {
                CurrentMaster.Title.TitleText  = GetString("Reporting_ReportValue_Edit.NewItemTitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportValue/new.png");

                newValue = true;
            }

            // set help key
            CurrentMaster.Title.HelpTopicName = "report_value_properties";

            if (!RequestHelper.IsPostBack())
            {
                LoadData();
            }
        }
        else
        {
            btnOk.Visible    = false;
            lblError.Visible = true;
            lblError.Text    = GetString("Reporting_ReportValue_Edit.InvalidReportId");
        }
        btnOk.Text     = GetString("General.OK");
        btnCancel.Text = GetString("General.Cancel");
        btnApply.Text  = GetString("General.Apply");

        if (preview)
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }
    }
コード例 #28
0
        public ReportInfo _reportInfo; // Setting this to private will cause it not to be visible for inheritated classes

        public void FeedReportInfo(ReportInfo info)
        {
            _reportInfo = info;
        }
コード例 #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Test permission for query
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries"))
        {
            txtQueryQuery.Enabled = false;
        }
        else
        {
            txtQueryQuery.Enabled = true;
        }

        versionList.OnAfterRollback += new EventHandler(versionList_onAfterRollback);

        // Own javascript tab change handling -> because tab control raises changetab after prerender - too late
        // Own selected tab change handling
        RegisterTabScript(hdnSelectedTab.ClientID, tabControlElem);

        // Register script for resize and rolback
        RegisterResizeAndRollbackScript(divFooter.ClientID, divScrolable.ClientID);

        string[,] tabs = new string[4, 4];
        tabs[0, 0] = GetString("general.general");
        tabs[0, 1] = "SetHelpTopic('helpTopic', 'report_htmlgraph_properties')";
        tabs[1, 0] = GetString("general.preview");
        tabs[1, 1] = "SetHelpTopic('helpTopic', 'report_htmlgraph_properties');";

        tabControlElem.Tabs = tabs;
        tabControlElem.UsePostback = true;

        CurrentMaster.Title.TitleCssClass = "PageTitleHeader";
        CurrentMaster.Title.HelpTopicName = "report_htmlgraph_properties";
        CurrentMaster.Title.HelpName = "helpTopic";
        Title = "ReportGraph Edit";

        btnOk.Text = GetString("General.OK");
        btnCancel.Text = GetString("General.Cancel");
        btnApply.Text = GetString("General.apply");

        rfvCodeName.ErrorMessage = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        int reportId = QueryHelper.GetInteger("reportid", 0);
        bool isPreview = QueryHelper.GetBoolean("preview", false);

        // If preview by URL -> select preview tab
        if (isPreview && !RequestHelper.IsPostBack())
        {
            SelectedTab = 1;
        }

        if (reportId > 0)
        {
            reportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (PersistentEditedObject == null)
        {
            if (reportInfo != null) //must be valid reportid parameter
            {
                string graphName = QueryHelper.GetString("itemname", "");

                // try to load graphname from hidden field (adding new graph & preview)
                if (graphName == String.Empty)
                {
                    graphName = txtNewGraphHidden.Value;
                }

                if (ValidationHelper.IsCodeName(graphName))
                {
                    PersistentEditedObject = ReportGraphInfoProvider.GetReportGraphInfo(reportInfo.ReportName + "." + graphName);
                    graphInfo = PersistentEditedObject as ReportGraphInfo;
                }
            }
        }
        else
        {
            graphInfo = PersistentEditedObject as ReportGraphInfo;
        }

        if (graphInfo != null)
        {
            CurrentMaster.Title.TitleText = GetString("Reporting_ReportGraph_EditHTML.TitleText");
            CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportGraph/object.png");

            graphId = graphInfo.GraphID;

            if (ObjectVersionManager.DisplayVersionsTab(graphInfo))
            {
                tabs[2, 0] = GetString("objectversioning.tabtitle");
                tabs[2, 1] = "SetHelpTopic('helpTopic', 'objectversioning_general');";
                versionList.Object = graphInfo;
                versionList.IsLiveSite = false;
            }
        }
        else
        {
            CurrentMaster.Title.TitleText = GetString("Reporting_ReportGraph_EditHTML.NewItemTitleText");
            CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportGraph/new.png");

            newReport = true;
        }

        if (!RequestHelper.IsPostBack())
        {
            // Load default data for new report
            if (newReport)
            {
                txtQueryNoRecordText.Text = GetString("attachmentswebpart.nodatafound");
                txtItemValueFormat.Text = "{%yval%}";
                txtSeriesItemTooltip.Text = "{%ser%}";
                chkExportEnable.Checked = true;
            }
            // Otherwise load saved data
            else
            {
                LoadData();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        bool newReport = false;

        ucSelectString.Scope                    = ReportInfo.OBJECT_TYPE;
        ConnectionStringRow.Visible             = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQueryQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        txtQueryQuery.Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries");

        versionList.OnAfterRollback += versionList_onAfterRollback;

        // Register script for resize and rollback
        RegisterScripts("divFooter", divScrolable.ClientID);

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.general")
        });

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.preview")
        });

        tabControlElem.UsePostback = true;

        Title = "ReportGraph Edit";

        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        Save += (s, ea) =>
        {
            if (SetData(true))
            {
                ltlScript.Text += ScriptHelper.GetScript("window.RefreshContent();CloseDialog();");
            }
        };

        int  reportId  = QueryHelper.GetInteger("reportid", 0);
        bool isPreview = QueryHelper.GetBoolean("preview", false);

        // If preview by URL -> select preview tab
        if (isPreview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
        }

        if (reportId > 0)
        {
            mReportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (PersistentEditedObject == null)
        {
            if (mReportInfo != null) //must be valid reportid parameter
            {
                int id = QueryHelper.GetInteger("objectid", 0);

                // Try to load graph name from hidden field (adding new graph & preview)
                if (id == 0)
                {
                    id = ValidationHelper.GetInteger(txtNewGraphHidden.Value, 0);
                }

                if (id > 0)
                {
                    PersistentEditedObject = ReportGraphInfoProvider.GetReportGraphInfo(id);
                    mReportGraphInfo       = PersistentEditedObject as ReportGraphInfo;
                }
            }
        }
        else
        {
            mReportGraphInfo = PersistentEditedObject as ReportGraphInfo;
        }

        if (mReportInfo != null)
        {
            ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;
        }

        if (mReportGraphInfo != null)
        {
            PageTitle.TitleText = GetString("Reporting_ReportGraph_EditHTML.TitleText");
            mGraphId            = mReportGraphInfo.GraphID;

            if (ObjectVersionManager.DisplayVersionsTab(mReportGraphInfo))
            {
                tabControlElem.TabItems.Add(new UITabItem
                {
                    Text = GetString("objectversioning.tabtitle")
                });

                versionList.Object     = mReportGraphInfo;
                versionList.IsLiveSite = false;
            }
        }
        else
        {
            PageTitle.TitleText = GetString("Reporting_ReportGraph_EditHTML.NewItemTitleText");
            newReport           = true;
        }

        if (!RequestHelper.IsPostBack())
        {
            // Load default data for new report
            if (newReport)
            {
                ucSelectString.Value      = String.Empty;
                txtQueryNoRecordText.Text = GetString("attachmentswebpart.nodatafound");
                txtItemValueFormat.Text   = "{%yval%}";
                txtSeriesItemTooltip.Text = "{%ser%}";
                chkExportEnable.Checked   = true;
                chkSubscription.Checked   = true;
            }
            // Otherwise load saved data
            else
            {
                LoadData();
            }
        }
    }
コード例 #31
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope               = PredefinedObjectType.REPORT;
        ConnectionStringRow.Visible        = CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries"))
        {
            txtQuery.Enabled = false;
        }
        else
        {
            txtQuery.Enabled = true;
        }

        versionList.OnAfterRollback += new EventHandler(versionList_onAfterRollback);

        string[,] tabs = new string[4, 4];
        tabs[0, 0]     = GetString("general.general");
        tabs[0, 1]     = "SetHelpTopic('helpTopic', 'report_value_properties')";
        tabs[1, 0]     = GetString("general.preview");
        tabs[0, 1]     = "SetHelpTopic('helpTopic', 'report_value_properties')";

        tabControlElem.Tabs               = tabs;
        tabControlElem.UsePostback        = true;
        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "report_value_properties";
        CurrentMaster.Title.TitleCssClass = "PageTitleHeader";

        // Own javascript tab change handling -> because tab control raises changetab after prerender - too late
        // Own selected tab change handling
        RegisterTabScript(hdnSelectedTab.ClientID, tabControlElem);

        RegisterResizeAndRollbackScript(divFooter.ClientID, divScrolable.ClientID);

        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        int  reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview  = QueryHelper.GetBoolean("preview", false);

        if (reportId > 0)
        {
            reportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (reportInfo != null) //must be valid reportid parameter
        {
            ucSelectString.DefaultConnectionString = reportInfo.ReportConnectionString;

            // If preview by URL -> select preview tab
            bool isPreview = QueryHelper.GetBoolean("preview", false);
            if (isPreview && !RequestHelper.IsPostBack())
            {
                SelectedTab = 1;
            }

            if (PersistentEditedObject == null)
            {
                int id = QueryHelper.GetInteger("itemid", 0);
                if (id > 0)
                {
                    PersistentEditedObject = ReportValueInfoProvider.GetReportValueInfo(id);
                    valueInfo = PersistentEditedObject as ReportValueInfo;
                }
            }
            else
            {
                valueInfo = PersistentEditedObject as ReportValueInfo;
            }

            if (valueInfo != null)
            {
                CurrentMaster.Title.TitleText  = GetString("Reporting_ReportValue_Edit.TitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportValue/object_light.png");

                valueId = valueInfo.ValueID;

                if (ObjectVersionManager.DisplayVersionsTab(valueInfo))
                {
                    tabs[2, 0]             = GetString("objectversioning.tabtitle");
                    tabs[2, 1]             = "SetHelpTopic('helpTopic', 'objectversioning_general');";
                    versionList.Object     = valueInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else //new item
            {
                CurrentMaster.Title.TitleText  = GetString("Reporting_ReportValue_Edit.NewItemTitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportValue/new_light.png");

                chkSubscription.Checked = true;
                newValue = true;

                if (!RequestHelper.IsPostBack())
                {
                    ucSelectString.Value = String.Empty;
                }
            }

            // set help key
            CurrentMaster.Title.HelpTopicName = "report_value_properties";

            if (!RequestHelper.IsPostBack())
            {
                LoadData();
            }
        }
        else
        {
            btnOk.Visible = false;
            ShowError(GetString("Reporting_ReportValue_Edit.InvalidReportId"));
        }
        btnOk.Text     = GetString("General.OK");
        btnCancel.Text = GetString("General.Cancel");
        btnApply.Text  = GetString("General.Apply");

        if (preview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }
    }
コード例 #32
0
        private void AddEndHistoryItem(ReportInfo info)
        {
            if(historyItem == null) {
                throw new Exception("History item not added.");
            }

            if(session != null) {
                historyItem.Statistics = session.Statistics;
                historyItem.Statistics.Errors += session.BeforeWipeErrors.Count + session.AfterWipeErrors.Count;
            }

            historyItem.EndTime = DateTime.Now;
            historyItem.ReportInfo = info;
            historyItem.Failed = historyItem.Statistics == null ||
                                 historyItem.Statistics.FailedObjects > 0 ||
                                 historyItem.Statistics.Errors > 0;

            if(_historyManager.SaveHistory(SecureDeleteLocations.GetScheduleHistoryFile()) == false) {
                Debug.ReportError("Failed to save history items");
            }
        }
    /// <summary>
    /// OnInit.
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        ScriptHelper.RegisterWOpenerScript(Page);
        PageTitle.TitleText = GetString("rep.webparts.reportparameterstitle");
        // Load data for this form
        int reportID = QueryHelper.GetInteger("ReportID", 0);

        hdnGuid.Value = QueryHelper.GetString("GUID", String.Empty);
        ReportInfo ri = ReportInfoProvider.GetReportInfo(reportID);

        if (ri == null)
        {
            return;
        }

        FormInfo fi = new FormInfo(ri.ReportParameters);

        bfParameters.FormInformation      = fi;
        bfParameters.SubmitButton.Visible = false;
        bfParameters.Mode = FormModeEnum.Update;

        // Get dataset from cache
        DataSet ds = (DataSet)WindowHelper.GetItem(hdnGuid.Value);
        DataRow dr = fi.GetDataRow(false);

        fi.LoadDefaultValues(dr, true);

        if (ds == null)
        {
            if (dr.ItemArray.Length > 0)
            {
                // Set up grid
                bfParameters.DataRow = RequestHelper.IsPostBack() ? fi.GetDataRow(false) : dr;
            }
        }


        // Set data set given from cache
        if ((ds != null) && (ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0))
        {
            //Merge with default data from report
            MergeDefaultValuesWithData(dr, ds.Tables[0].Rows[0]);
            //Set row to basic form
            bfParameters.DataRow = dr;
        }

        // Test if there is any item visible in report parameters
        bool itemVisible = false;
        List <IDataDefinitionItem> items = fi.ItemsList;

        foreach (IDataDefinitionItem item in items)
        {
            FormFieldInfo ffi = item as FormFieldInfo;
            if (ffi != null && ffi.Visible)
            {
                itemVisible = true;
                break;
            }
        }

        if (!itemVisible)
        {
            ShowInformation(GetString("rep.parameters.noparameters"));
        }

        base.OnInit(e);
    }
コード例 #34
0
ファイル: FileManager.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Gets the report stream.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="reportName">Name of the report.</param>
        /// <returns>MemoryStream.</returns>
        private MemoryStream GetReportStream(IEditableRoot item, string reportName)
        {
            var dict = GetReportParametersDict(item);

            var reportProcessor = new ReportProcessor();
            reportProcessor.Error += ReportProcessorError;

            var reportInfo = new ReportInfo(string.Format(CultureInfo.InvariantCulture, "?<customReport title=\"\" description=\"\" fileName=\"{0}\" />", reportName), dict);

            var reportSource = TheReportResolver.Resolve(reportInfo.ToString());

            Telerik.Reporting.Processing.RenderingResult result;

            // Mq1ReportResolver changes the principal, so we'll have to restore it later.
            var user = ApplicationContext.User;
            try
            {
                result = reportProcessor.RenderReport("PDF", reportSource, null);
            }
            finally
            {
                ApplicationContext.User = user;
            }

            return new MemoryStream(result.DocumentBytes);
        }
コード例 #35
0
ファイル: ReportsToggle.cs プロジェクト: OlegGelezcov/boscs
 private void OnReportCountChanged(int oldCount, int newCount, ReportInfo report)
 {
     UpdateAlert(report);
 }
コード例 #36
0
    /// <summary>
    /// Reload data.
    /// </summary>
    public override void ReloadData(bool forceLoad)
    {
        // Load value info object
        ReportValueInfo rvi = ValueInfo;

        if (rvi == null)
        {
            return;
        }

        ri = ReportInfoProvider.GetReportInfo(rvi.ValueReportID);
        if (ri == null)
        {
            return;
        }

        // Check security settings
        if (!(CheckReportAccess(ri) && CheckEmailModeSubscription(ri, ValidationHelper.GetBoolean(ValueInfo.ValueSettings["SubscriptionEnabled"], true))))
        {
            Visible = false;
            return;
        }

        // Prepare query attributes
        QueryIsStoredProcedure = rvi.ValueQueryIsStoredProcedure;
        QueryText = rvi.ValueQuery;

        // Init parameters
        InitParameters(ri.ReportParameters);

        // Init macro resolver
        InitResolver();

        DataSet ds = null;

        // Ensure report item name for caching
        if (String.IsNullOrEmpty(ReportItemName))
        {
            ReportItemName = String.Format("{0};{1}", ri.ReportName, rvi.ValueName);
        }

        try
        {
            // Load data
            ds = LoadData();
        }
        catch (Exception ex)
        {
            // Display error message, if data load fail
            lblError.Visible = true;
            lblError.Text    = "[ReportValue.ascx] Error loading the data: " + ex.Message;
            EventLogProvider.LogException("Report value", "E", ex);
        }

        // If datasource is emptry, create empty dataset
        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            // Set literal text
            string value = rvi.ValueFormatString;
            if (String.IsNullOrEmpty(value))
            {
                value = ValidationHelper.GetString(ds.Tables[0].Rows[0][0], String.Empty);
            }
            else
            {
                value = string.Format(value, ds.Tables[0].Rows[0].ItemArray);
            }

            if (EmailMode)
            {
                ltlEmail.Text    = HTMLHelper.HTMLEncode(ResolveMacros(value));
                ltlEmail.Visible = true;
                menuCont.Visible = false;
            }
            else
            {
                lblValue.Text = HTMLHelper.HTMLEncode(ResolveMacros(value));
            }
        }
        else if (EmailMode && SendOnlyNonEmptyDataSource)
        {
            Visible = false;
        }
    }
コード例 #37
0
ファイル: ReportingSteps.cs プロジェクト: mattq314/SpecFlow
 public ReportingSteps(InputProjectDriver inputProjectDriver, ProjectSteps projectSteps, SpecFlowConfigurationDriver specFlowConfigurationDriver, ExecutionSteps executionSteps, ReportInfo reportInfo)
 {
     this.inputProjectDriver          = inputProjectDriver;
     this.reportInfo                  = reportInfo;
     this.executionSteps              = executionSteps;
     this.projectSteps                = projectSteps;
     this.specFlowConfigurationDriver = specFlowConfigurationDriver;
 }
コード例 #38
0
        public static ReportPage GetSampleReportPage(string Xaml)
        {
            BusinessFlow BF1 = new BusinessFlow()
            {
                Name = "BF1 - Create Customer", Description = "Create any type of customer: Business/Residential..."
            };

            BF1.Active     = true;
            BF1.RunStatus  = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed;
            BF1.Activities = new ObservableList <Activity>();
            BF1.Elapsed    = 2364;

            //Activity 1
            Activity a1 = new Activity()
            {
                ActivityName = "Launch Application & Login", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed
            };

            BF1.Activities.Add(a1);

            ActGotoURL act1 = new ActGotoURL()
            {
                Description = "Goto URL www.abcd.com", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 3124
            };

            a1.Acts.Add(act1);

            ActReturnValue ARV1 = new ActReturnValue();

            ARV1.Param    = "RC";
            ARV1.Expected = "123";
            ARV1.Actual   = "123";
            ARV1.Status   = ActReturnValue.eStatus.Passed;
            act1.ReturnValues.Add(ARV1);

            ActTextBox act2 = new ActTextBox()
            {
                Description = "Enter User ID", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 230
            };
            // Add sample screen shot
            Bitmap tempBmp = new Bitmap(Ginger.Properties.Resources.ScreenShot1);

            act2.ScreenShots.Add(GingerCore.General.BitmapImageToFile(tempBmp));
            a1.Acts.Add(act2);

            ActTextBox act3 = new ActTextBox()
            {
                Description = "Enter Password", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 112
            };

            a1.Acts.Add(act3);

            ActSubmit act4 = new ActSubmit()
            {
                Description = "Click Submit Button", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 1282
            };

            a1.Acts.Add(act4);

            //Activity 2
            Activity a2 = new Activity()
            {
                ActivityName = "Create New customer", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed
            };

            BF1.Activities.Add(a2);

            ActTextBox acta21 = new ActTextBox()
            {
                Description = "Enter First Name", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 325
            };

            a2.Acts.Add(acta21);

            ActTextBox acta22 = new ActTextBox()
            {
                Description = "Enter Last Name", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed, Elapsed = 302
            };

            a2.Acts.Add(acta22);

            ActTextBox acta23 = new ActTextBox()
            {
                Description = "Enter City", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed, Elapsed = 820, Error = "Error: Element not found by ID 'City'", ExInfo = "Cannot find element"
            };

            a2.Acts.Add(acta23);

            ActSubmit acta24 = new ActSubmit()
            {
                Description = "Click Create Button", Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending
            };

            a2.Acts.Add(acta24);

            //Add Variables
            BF1.Variables = new ObservableList <VariableBase>();

            VariableString v1 = new VariableString()
            {
                Name = "FirstName", Value = "David Smith"
            };

            BF1.Variables.Add(v1);

            VariableRandomNumber v2 = new VariableRandomNumber()
            {
                Name = "Random 1", Min = 1, Max = 100, Value = "55"
            };

            BF1.Variables.Add(v2);

            //Add a few simple BFs
            BusinessFlow BF2 = new BusinessFlow()
            {
                Name = "BF2 - Customer Order Product", Description = "", Active = true
            };

            BF2.Activities = new ObservableList <Activity>();
            BF2.RunStatus  = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
            BF2.Elapsed    = 1249;

            ProjEnvironment env = new ProjEnvironment()
            {
                Name = "Env1"
            };
            //TODO: add more env info

            //cretae dummy GR, GMR
            RunsetExecutor GMR = new RunsetExecutor();
            GingerRunner   GR  = new GingerRunner();

            GR.BusinessFlows.Add(BF1);
            GR.BusinessFlows.Add(BF2);
            GR.CurrentSolution = App.UserProfile.Solution;
            GMR.Runners.Add(GR);
            ReportInfo RI = new ReportInfo(env, GMR);
            ReportPage RP = new ReportPage(RI, Xaml);

            return(RP);
        }
コード例 #39
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Test permission for query
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries"))
        {
            txtQuery.Enabled = false;
        }
        else
        {
            txtQuery.Enabled = true;
        }

        versionList.OnAfterRollback += new EventHandler(versionList_onAfterRollback);

        // Own javascript tab change handling -> because tab control raises changetab after prerender - too late
        // Own selected tab change handling
        RegisterTabScript(hdnSelectedTab.ClientID, tabControlElem);

        // Register common resize and refresh scripts
        RegisterResizeAndRollbackScript(divFooter.ClientID, divScrolable.ClientID);

        string[,] tabs = new string[4, 4];
        tabs[0, 0] = GetString("general.general");
        tabs[0, 1] = "SetHelpTopic('helpTopic', 'report_table_properties')";
        tabs[1, 0] = GetString("general.preview");
        tabs[0, 1] = "SetHelpTopic('helpTopic', 'report_table_properties')";

        tabControlElem.Tabs = tabs;
        tabControlElem.UsePostback = true;
        CurrentMaster.Title.HelpName = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "report_table_properties";
        CurrentMaster.Title.TitleCssClass = "PageTitleHeader";

        rfvCodeName.ErrorMessage = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");
        btnApply.Text = GetString("General.apply");
        btnOk.Text = GetString("General.OK");
        btnCancel.Text = GetString("General.Cancel");

        int reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview = QueryHelper.GetBoolean("preview", false);
        if (reportId > 0)
        {
            reportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        // If preview by URL -> select preview tab
        bool isPreview = QueryHelper.GetBoolean("preview", false);
        if (isPreview && !RequestHelper.IsPostBack())
        {
            SelectedTab = 1;
        }

        if (PersistentEditedObject == null)
        {
            if (reportInfo != null) // Must be valid reportid parameter
            {
                string tableName = ValidationHelper.GetString(Request.QueryString["itemname"], "");

                // Try to load tableName from hidden field (adding new graph & preview)
                if (tableName == String.Empty)
                {
                    tableName = txtNewTableHidden.Value;
                }

                if (ValidationHelper.IsIdentifier(tableName))
                {
                    PersistentEditedObject = ReportTableInfoProvider.GetReportTableInfo(reportInfo.ReportName + "." + tableName);
                    tableInfo = PersistentEditedObject as ReportTableInfo;
                }
            }
        }
        else
        {
            tableInfo = PersistentEditedObject as ReportTableInfo;
        }

        if (reportInfo != null)
        {
            // Control text initializations
            if (tableInfo != null)
            {
                CurrentMaster.Title.TitleText = GetString("Reporting_ReportTable_Edit.TitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportTable/object.png");

                tableId = tableInfo.TableID;

                if (ObjectVersionManager.DisplayVersionsTab(tableInfo))
                {
                    tabs[2, 0] = GetString("objectversioning.tabtitle");
                    tabs[2, 1] = "SetHelpTopic('helpTopic', 'objectversioning_general');";

                    versionList.Object = tableInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else // New item
            {
                CurrentMaster.Title.TitleText = GetString("Reporting_ReportTable_Edit.NewItemTitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportTable/new.png");

                if (!RequestHelper.IsPostBack())
                {
                    txtPageSize.Text = "15";
                    txtQueryNoRecordText.Text = GetString("attachmentswebpart.nodatafound");
                    chkExportEnable.Checked = true;
                }

                newTable = true;
            }

            // Set help key
            CurrentMaster.Title.HelpTopicName = "report_table_properties";

            if (!RequestHelper.IsPostBack())
            {
                DataHelper.FillListControlWithEnum(typeof(PagerButtons), drpPageMode, "PagerButtons.", null);
                // Preselect page numbers paging
                drpPageMode.SelectedValue = ((int)PagerButtons.Numeric).ToString();

                LoadData();
            }
        }

        if ((preview) && (!RequestHelper.IsPostBack()))
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }

        // In case of preview paging without saving table
        if (RequestHelper.IsPostBack() && tabControlElem.SelectedTab == 1)
        {
            // Reload deafult parameters
            FormInfo fi = new FormInfo(reportInfo.ReportParameters);
            // Get datarow with required columns
            ctrlReportTable.ReportParameters = fi.GetDataRow();
            fi.LoadDefaultValues(ctrlReportTable.ReportParameters, true);

            // Colect data and put them in talbe info
            Save(false);
            ctrlReportTable.TableInfo = tableInfo;
        }
    }
コード例 #40
0
    protected override void OnPreRender(EventArgs e)
    {
        pnlReports.Attributes.Add("style", "margin-bottom:3px");

        string reportName = ValidationHelper.GetString(usReports.Value, String.Empty);

        mReportInfo = ReportInfoProvider.GetReportInfo(reportName);
        if (mReportInfo != null)
        {
            usItems.Enabled = true;

            // Test if there is any item visible in report parameters
            FormInfo fi = new FormInfo(mReportInfo.ReportParameters);

            // Get dataset from cache
            DataSet ds = (DataSet)WindowHelper.GetItem(CurrentGuid());
            DataRow dr = fi.GetDataRow(false);
            fi.LoadDefaultValues(dr, true);
            bool          itemVisible = false;
            List <IField> items       = fi.ItemsList;
            foreach (IField item in items)
            {
                FormFieldInfo ffi = item as FormFieldInfo;
                if (ffi != null)
                {
                    if (ffi.Visible)
                    {
                        itemVisible = true;
                        break;
                    }
                }
            }

            ReportID = mReportInfo.ReportID;

            if (!itemVisible)
            {
                plcParametersButtons.Visible = false;
            }
            else
            {
                plcParametersButtons.Visible = true;
            }
        }
        else
        {
            if (ReportID == 0)
            {
                plcParametersButtons.Visible = false;
                usItems.Enabled = false;
            }
        }

        ltlScript.Text = ScriptHelper.GetScript("function refresh () {" + ControlsHelper.GetPostBackEventReference(pnlUpdate, String.Empty) + "}");
        usReports.DropDownSingleSelect.AutoPostBack = true;

        if (!mDisplay)
        {
            pnlReports.Visible           = false;
            plcParametersButtons.Visible = false;
            usItems.Enabled = true;
        }

        if (!ShowItemSelector)
        {
            pnlItems.Visible = false;
        }

        usItems.IsLiveSite                 = IsLiveSite;
        usReports.IsLiveSite               = IsLiveSite;
        ugParameters.GridName              = "~/CMSModules/Reporting/FormControls/ReportParametersList.xml";
        ugParameters.ZeroRowsText          = String.Empty;
        ugParameters.PageSize              = "##ALL##";
        ugParameters.Pager.DefaultPageSize = -1;

        BuildConditions();

        if (mReportInfo == null)
        {
            usItems.SpecialFields.Add(new SpecialField()
            {
                Text = "(" + mFirstItemText + ")", Value = "0"
            });
        }

        if (ShowItemSelector)
        {
            ReloadItems();
        }

        if (mSetValues)
        {
            WindowHelper.Add(CurrentGuid(), CurrentDataSet);
            ScriptHelper.RegisterDialogScript(Page);
            ScriptHelper.RegisterStartupScript(Page, typeof(Page), "OpenModalWindowReportItem", ScriptHelper.GetScript("modalDialog('" + ResolveUrl("~/CMSModules/Reporting/Dialogs/ReportParametersSelector.aspx?ReportID=" + ReportID + "&guid=" + CurrentGuid().ToString()) + "','ReportParametersDialog', 700, 500);"));
            mKeepDataInWindowsHelper = true;
        }

        // Apply reportid condition if report was selected via uniselector
        if (mReportInfo != null)
        {
            DataSet ds = CurrentDataSet;

            ViewState["ParametersXmlData"]   = null;
            ViewState["ParametersXmlSchema"] = null;

            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                ViewState["ParametersXmlData"]   = ds.GetXml();
                ViewState["ParametersXmlSchema"] = ds.GetXmlSchema();
            }

            if (!mKeepDataInWindowsHelper)
            {
                WindowHelper.Remove(CurrentGuid().ToString());
            }

            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                ds = DataHelper.DataSetPivot(ds, new string[] { "ParameterName", "ParameterValue" });
                ugParameters.DataSource = ds;
                ugParameters.ReloadData();
                pnlParameters.Visible = true;
            }
            else
            {
                pnlParameters.Visible = false;
            }
        }
        else
        {
            pnlParameters.Visible = false;
        }

        base.OnPreRender(e);
    }
コード例 #41
0
ファイル: Default.aspx.cs プロジェクト: KuduApps/Kentico
    /// <summary>
    /// Creates report. Called when the "Create report" button is pressed.
    /// </summary>
    private bool CreateReport()
    {
        // Get the report category
        ReportCategoryInfo category = ReportCategoryInfoProvider.GetReportCategoryInfo("MyNewCategory");
        if (category != null)
        {
            // Create new report object
            ReportInfo newReport = new ReportInfo();

            // Set the properties
            newReport.ReportDisplayName = "My new report";
            newReport.ReportName = "MyNewReport";
            newReport.ReportCategoryID = category.CategoryID;
            newReport.ReportAccess = ReportAccessEnum.All;
            newReport.ReportLayout = "";
            newReport.ReportParameters = "";

            // Save the report
            ReportInfoProvider.SetReportInfo(newReport);

            return true;
        }
        return false;
    }
コード例 #42
0
 protected void VerifyReportsImported(ViewGroup viewGroup, ReportInfo reportInfo)
 {
     foreach (var expectedReport in reportInfo.ReportOrViewSpecs)
     {
         var foundReports = Settings.Default.PersistedViews.GetViewSpecList(viewGroup.Id).ViewSpecs
             .Where(viewSpec => viewSpec.Name == expectedReport.Name)
             .ToArray();
         Assert.AreEqual(1, foundReports.Length);
     }
 }
コード例 #43
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Test permission for query
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries"))
        {
            txtQuery.Enabled = false;
        }
        else
        {
            txtQuery.Enabled = true;
        }

        versionList.OnAfterRollback += new EventHandler(versionList_onAfterRollback);

        string[,] tabs = new string[4, 4];
        tabs[0, 0] = GetString("general.general");
        tabs[0, 1] = "SetHelpTopic('helpTopic', 'report_value_properties')";
        tabs[1, 0] = GetString("general.preview");
        tabs[0, 1] = "SetHelpTopic('helpTopic', 'report_value_properties')";

        tabControlElem.Tabs = tabs;
        tabControlElem.UsePostback = true;
        CurrentMaster.Title.HelpName = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "report_value_properties";
        CurrentMaster.Title.TitleCssClass = "PageTitleHeader";

        RegisterResizeAndRollbackScript(divFooter.ClientID, divScrolable.ClientID);

        rfvCodeName.ErrorMessage = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        int reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview = QueryHelper.GetBoolean("preview", false);
        if (reportId > 0)
        {
            reportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (reportInfo != null) //must be valid reportid parameter
        {
            if (PersistentEditedObject == null)
            {

                string valueName = ValidationHelper.GetString(Request.QueryString["itemname"], "");
                if (ValidationHelper.IsCodeName(valueName))
                {
                    PersistentEditedObject = ReportValueInfoProvider.GetReportValueInfo(reportInfo.ReportName + "." + valueName);
                    valueInfo = PersistentEditedObject as ReportValueInfo;
                }
            }
            else
            {
                valueInfo = PersistentEditedObject as ReportValueInfo;
            }

            if (valueInfo != null)
            {
                CurrentMaster.Title.TitleText = GetString("Reporting_ReportValue_Edit.TitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportValue/object.png");

                valueId = valueInfo.ValueID;

                if (ObjectVersionManager.DisplayVersionsTab(valueInfo))
                {
                    tabs[2, 0] = GetString("objectversioning.tabtitle");
                    tabs[2, 1] = "SetHelpTopic('helpTopic', 'objectversioning_general');";
                    versionList.Object = valueInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else //new item
            {
                CurrentMaster.Title.TitleText = GetString("Reporting_ReportValue_Edit.NewItemTitleText");
                CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportValue/new.png");

                newValue = true;
            }

            // set help key
            CurrentMaster.Title.HelpTopicName = "report_value_properties";

            if (!RequestHelper.IsPostBack())
            {
                LoadData();
            }
        }
        else
        {
            btnOk.Visible = false;
            lblError.Visible = true;
            lblError.Text = GetString("Reporting_ReportValue_Edit.InvalidReportId");
        }
        btnOk.Text = GetString("General.OK");
        btnCancel.Text = GetString("General.Cancel");
        btnApply.Text = GetString("General.Apply");

        if (preview)
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope = ReportInfo.OBJECT_TYPE;
        ConnectionStringRow.Visible = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQueryQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        txtQueryQuery.Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries");

        versionList.OnAfterRollback += versionList_onAfterRollback;

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.general")
        });

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.preview")
        });

        tabControlElem.UsePostback = true;

        Title = "ReportGraph Edit";
        PageTitle.HelpTopicName = HELP_TOPIC_LINK;

        RegisterClientScript();

        rfvCodeName.ErrorMessage = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        Save += (s, ea) =>
        {
            if (SetData(true))
            {
                ltlScript.Text += ScriptHelper.GetScript("window.RefreshContent();CloseDialog();");
            }
        };

        int reportId = QueryHelper.GetInteger("reportid", 0);
        bool isPreview = QueryHelper.GetBoolean("preview", false);

        // If preview by URL -> select preview tab
        if (isPreview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
        }

        if (reportId > 0)
        {
            // Get report info
            mReportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        // Must be valid reportid parameter
        if (PersistentEditedObject == null)
        {
            if (mReportInfo != null)
            {
                int id = QueryHelper.GetInteger("objectid", 0);

                // Try to load graph name from hidden field (adding new graph & preview)
                if (id == 0)
                {
                    id = ValidationHelper.GetInteger(txtNewGraphHidden.Value, 0);
                }

                if (id > 0)
                {
                    PersistentEditedObject = ReportGraphInfoProvider.GetReportGraphInfo(id);
                    mReportGraphInfo = PersistentEditedObject as ReportGraphInfo;
                }
            }
        }
        else
        {
            mReportGraphInfo = PersistentEditedObject as ReportGraphInfo;
        }

        if (mReportInfo != null)
        {
            ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;
        }

        if (mReportGraphInfo != null)
        {
            // Set title text and image
            PageTitle.TitleText = GetString("Reporting_ReportGraph_Edit.TitleText");
            mGraphId = mReportGraphInfo.GraphID;

            // Show versions tab
            if (ObjectVersionManager.DisplayVersionsTab(mReportGraphInfo))
            {
                tabControlElem.TabItems.Add(new UITabItem
                {
                    Text = GetString("objectversioning.tabtitle")
                });

                versionList.Object = mReportGraphInfo;
                versionList.IsLiveSite = false;
            }
        }
        else
        {
            // Current report graph is new object
            PageTitle.TitleText = GetString("Reporting_ReportGraph_Edit.NewItemTitleText");
            mNewReport = true;
        }

        if (!RequestHelper.IsPostBack())
        {
            // Fill border styles
            FillBorderStyle(drpLegendBorderStyle);
            FillBorderStyle(drpChartAreaBorderStyle);
            FillBorderStyle(drpPlotAreaBorderStyle);
            FillBorderStyle(drpSeriesBorderStyle);
            FillBorderStyle(drpSeriesLineBorderStyle);

            // Fill gradient styles
            FillGradientStyle(drpChartAreaGradient);
            FillGradientStyle(drpPlotAreaGradient);
            FillGradientStyle(drpSeriesGradient);

            // Fill axis's position
            FillPosition(drpYAxisTitlePosition);
            FillPosition(drpXAxisTitlePosition);
            FillTitlePosition(drpTitlePosition);

            // Fill legend's position
            FillLegendPosition(drpLegendPosition);

            // Fill font type
            FillChartType(drpChartType);

            // Fill Chart type controls
            FillBarType(drpBarDrawingStyle);
            FillStackedBarType(drpStackedBarDrawingStyle);
            FillPieType(drpPieDrawingStyle);
            FillDrawingDesign(drpPieDrawingDesign);
            FillLabelStyle(drpPieLabelStyle);
            FillPieRadius(drpPieDoughnutRadius);
            FillLineDrawingStyle(drpLineDrawingStyle);
            FillOrientation(drpBarOrientation);
            FillOrientation(drpBarStackedOrientation);
            FillBorderSkinStyle();

            // FillSymbos
            FillSymbols(drpSeriesSymbols);
            if (!mNewReport)
            {
                LoadData();
            }
            // Load default data
            else
            {
                chkExportEnable.Checked = ReportGraphDefaults.ExportEnable;
                chkSubscription.Checked = ReportGraphDefaults.Subscription;

                ucSelectString.Value = ReportGraphDefaults.SelectConnectionString;

                // Set default values for some controls
                txtQueryNoRecordText.Text = ResHelper.GetString("attachmentswebpart.nodatafound");
                drpPieLabelStyle.SelectedValue = ReportGraphDefaults.PieLabelStyle;
                drpPieDoughnutRadius.SelectedValue = ReportGraphDefaults.PieDoughnutRadius;
                drpSeriesBorderStyle.SelectedValue = ReportGraphDefaults.SeriesBorderStyle;
                drpSeriesLineBorderStyle.SelectedValue = ReportGraphDefaults.SeriesLineBorderStyle;
                drpLegendBorderStyle.SelectedValue = ReportGraphDefaults.LegendBorderStyle;
                drpChartAreaBorderStyle.SelectedValue = ReportGraphDefaults.ChartAreaBorderStyle;
                drpPlotAreaBorderStyle.SelectedValue = ReportGraphDefaults.PlotAreaBorderStyle;

                // Border size
                txtSeriesLineBorderSize.Text = ReportGraphDefaults.SeriesLineBorderSize.ToString();
                txtSeriesBorderSize.Text = ReportGraphDefaults.SeriesBorderSize.ToString();
                txtChartAreaBorderSize.Text = ReportGraphDefaults.ChartAreaBorderSize.ToString();
                txtPlotAreaBorderSize.Text = ReportGraphDefaults.PlotAreaBorderSize.ToString();
                txtLegendBorderSize.Text = ReportGraphDefaults.LegendBorderSize.ToString();

                // Border color
                ucPlotAreaBorderColor.SelectedColor = ReportGraphDefaults.PlotAreaBorderColor;
                ucChartAreaBorderColor.SelectedColor = ReportGraphDefaults.ChartAreaBorderColor;
                ucLegendBorderColor.SelectedColor = ReportGraphDefaults.LegendBorderColor;
                ucSeriesBorderColor.SelectedColor = ReportGraphDefaults.SeriesBorderColor;

                // Other values
                ucChartAreaPrBgColor.SelectedColor = ReportGraphDefaults.ChartAreaPrBgColor;
                ucChartAreaSecBgColor.SelectedColor = ReportGraphDefaults.ChartAreaSecBgColor;
                drpChartAreaGradient.SelectedValue = ReportGraphDefaults.ChartAreaGradient;
                ucTitleColor.SelectedColor = ReportGraphDefaults.TitleColor;
                drpBorderSkinStyle.SelectedValue = ReportGraphDefaults.BorderSkinStyle;
                txtChartWidth.Text = ReportGraphDefaults.ChartWidth.ToString();
                txtChartHeight.Text = ReportGraphDefaults.ChartHeight.ToString();
                chkShowGrid.Checked = ReportGraphDefaults.ShowGrid;
                chkYAxisUseXSettings.Checked = ReportGraphDefaults.YAxisUseXSettings;
                ucXAxisTitleColor.SelectedColor = ReportGraphDefaults.XAxisTitleColor;
                ucYAxisTitleColor.SelectedColor = ReportGraphDefaults.YAxisTitleColor;
                drpSeriesSymbols.SelectedValue = ReportGraphDefaults.SeriesSymbols;

                drpBarDrawingStyle.SelectedValue = ReportGraphDefaults.BarDrawingStyle;
                chkSeriesDisplayItemValue.Checked = ReportGraphDefaults.SeriesDisplayItemValue;
                txtXAxisInterval.Text = ReportGraphDefaults.XAxisInterval.ToString();
                chkXAxisSort.Checked = ReportGraphDefaults.XAxisSort;
                drpPieDrawingStyle.SelectedValue = ReportGraphDefaults.PieDrawingStyle;
                drpPieDrawingDesign.SelectedValue = ReportGraphDefaults.PieDrawingDesign;
                drpStackedBarDrawingStyle.SelectedValue = ReportGraphDefaults.StackedBarDrawingStyle;
            }
        }

        HideChartTypeControls(drpChartType.SelectedIndex);
        ucXAxisTitleFont.SetOnChangeAttribute("xAxixTitleFontChanged ()");

        // Font settings
        ucTitleFont.DefaultSize = 14;
        ucTitleFont.DefaultStyle = "bold";
        ucXAxisTitleFont.DefaultSize = 11;
        ucXAxisTitleFont.DefaultStyle = "bold";
        ucYAxisTitleFont.DefaultSize = 11;
        ucYAxisTitleFont.DefaultStyle = "bold";

        txtRotateX.Enabled = chkShowAs3D.Checked;
        txtRotateY.Enabled = chkShowAs3D.Checked;
        chkBarOverlay.Enabled = chkShowAs3D.Checked;

        // Doughnut settings
        drpPieDoughnutRadius.Enabled = drpPieDrawingStyle.SelectedValue == "Doughnut";

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope = ReportInfo.OBJECT_TYPE;
        ConnectionStringRow.Visible = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        txtQuery.Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries");

        versionList.OnAfterRollback += versionList_onAfterRollback;

        PageTitle.HelpTopicName = HELP_TOPIC_LINK;

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.general")
        });

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.preview")
        });

        tabControlElem.UsePostback = true;

        RegisterResizeAndRollbackScript("divFooter", divScrolable.ClientID);

        rfvCodeName.ErrorMessage = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        int reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview = QueryHelper.GetBoolean("preview", false);
        if (reportId > 0)
        {
            mReportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        if (mReportInfo != null) //must be valid reportid parameter
        {
            ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;

            // If preview by URL -> select preview tab
            bool isPreview = QueryHelper.GetBoolean("preview", false);
            if (isPreview && !RequestHelper.IsPostBack())
            {
                tabControlElem.SelectedTab = 1;
            }

            if (PersistentEditedObject == null)
            {
                int id = QueryHelper.GetInteger("objectid", 0);
                if (id > 0)
                {
                    PersistentEditedObject = ReportValueInfoProvider.GetReportValueInfo(id);
                    mReportValueInfo = PersistentEditedObject as ReportValueInfo;
                }
            }
            else
            {
                mReportValueInfo = PersistentEditedObject as ReportValueInfo;
            }

            if (mReportValueInfo != null)
            {
                PageTitle.TitleText = GetString("Reporting_ReportValue_Edit.TitleText");
                mValueId = mReportValueInfo.ValueID;

                if (ObjectVersionManager.DisplayVersionsTab(mReportValueInfo))
                {
                    tabControlElem.TabItems.Add(new UITabItem
                    {
                        Text = GetString("objectversioning.tabtitle")
                    });

                    versionList.Object = mReportValueInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else //new item
            {
                PageTitle.TitleText = GetString("Reporting_ReportValue_Edit.NewItemTitleText");
                chkSubscription.Checked = true;

                if (!RequestHelper.IsPostBack())
                {
                    ucSelectString.Value = String.Empty;
                }
            }

            if (!RequestHelper.IsPostBack())
            {
                LoadData();
            }
        }
        else
        {
            ShowError(GetString("Reporting_ReportValue_Edit.InvalidReportId"));
        }

        Save += (s, ea) =>
        {
            if (SetData(true))
            {
                ltlScript.Text += ScriptHelper.GetScript("window.RefreshContent();CloseDialog();");
            }
        };

        if (preview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
    }
コード例 #46
0
ファイル: Program.cs プロジェクト: uvbs/CSGO.Report
        public static void ProcessSubmitReport(HttpListenerContext context, IDictionary <string, string> data)
        {
            IDictionary <string, object> result = new Dictionary <string, object>()
            {
                { "success", false }
            };

            if (!data.ContainsKey("id") || !data.ContainsKey("match") || !data.ContainsKey("account") || !data.ContainsKey("flags") || !int.TryParse(data["flags"], out int flags))
            {
                result["message"] = "参数错误";
            }
            else if (!data["account"].Split(',').All(accountManager.Accounts.ContainsKey))
            {
                result["message"] = "账户不存在";
            }
            else
            {
                SteamID steamID = SteamIdUtil.Parse(data["id"]);
                ulong   matchID = 0;
                if (data["match"].StartsWith("steam://"))
                {
                    matchID = ShareCode.Decode(data["match"].Substring(61)).MatchId;
                }
                else if (data["match"].StartsWith("CSGO-"))
                {
                    matchID = ShareCode.Decode(data["match"]).MatchId;
                }
                else
                {
                    ulong.TryParse(data["match"], out matchID);
                }
                if (steamID != null)
                {
                    if (matchID == 0)
                    {
                        result["message"] = "请提供有效的Match ID.";
                    }
                    else if (AccountManager.IsWhitelisted(steamID))
                    {
                        result["message"] = "举报目标在我们的白名单中,这通常说明举报目标不会作弊或是我们的机器人账号之一.";
                    }
                    else
                    {
                        var info = new ReportInfo()
                        {
                            SteamID      = steamID,
                            MatchID      = matchID,
                            AbusiveText  = (flags & FLAG_ABUSIVE_TEXT) == FLAG_ABUSIVE_TEXT,
                            AbusiveVoice = (flags & FLAG_ABUSIVE_VOICE) == FLAG_ABUSIVE_VOICE,
                            Griefing     = (flags & FLAG_GRIEFING) == FLAG_GRIEFING,
                            AimHacking   = (flags & FLAG_AIM_HACKING) == FLAG_AIM_HACKING,
                            WallHacking  = (flags & FLAG_WALL_HACKING) == FLAG_WALL_HACKING,
                            OtherHacking = (flags & FLAG_OTHER_HACKING) == FLAG_OTHER_HACKING
                        };
                        var submitted = data["account"].Split(',');
                        var accounts  = accountManager.Accounts.Where((kv) => submitted.Contains(kv.Key));
                        foreach (var kv in accounts)
                        {
                            kv.Value.QueueAction(info);
                        }
                        result["matchid"] = matchID;
                        result["success"] = true;
                        result["message"] = "Abusive Text:" + info.AbusiveText + "<br />" +
                                            "Abusive Voice:" + info.AbusiveVoice + "<br />" +
                                            "Griefing:" + info.Griefing + "<br />" +
                                            "Aim Hacking:" + info.AimHacking + "<br />" +
                                            "Wall Hacking:" + info.WallHacking + "<br />" +
                                            "Other Hacking:" + info.OtherHacking;
                    }
                }
                else
                {
                    result["message"] = "无法解析Steam ID,请提供有效的SteamID,SteamID3或SteamID64.";
                }
            }
            Server.SendResult(context, Body: JsonConvert.SerializeObject(result));
        }
    /// <summary>
    /// Reload data.
    /// </summary>
    public override void ReloadData(bool forceLoad)
    {
        if ((TableInfo == null) || ((GraphImageWidth != 0) && (ComputedWidth == 0)))
        {
            // Graph width is computed no need to create graph
            return;
        }

        Visible = true;

        EnsureChildControls();

        LoadTable();

        mReportInfo = ReportInfoProvider.GetReportInfo(TableInfo.TableReportID);
        if (mReportInfo == null)
        {
            return;
        }

        // Check security settings
        if (!(CheckReportAccess(mReportInfo) && CheckEmailModeSubscription(mReportInfo, ValidationHelper.GetBoolean(TableInfo.TableSettings["SubscriptionEnabled"], true))))
        {
            Visible = false;
            return;
        }

        // Prepare query attributes
        QueryIsStoredProcedure = TableInfo.TableQueryIsStoredProcedure;
        QueryText = TableInfo.TableQuery;

        // Init parameters
        InitParameters(mReportInfo.ReportParameters);

        // Init macro resolver
        InitResolver();

        mErrorOccurred = false;
        DataSet ds = null;

        try
        {
            // Load data
            ds = LoadData();
        }
        catch (Exception ex)
        {
            // Display error message, if data load fail
            lblError.Visible = true;
            lblError.Text = "[ReportTable.ascx] Error loading the data: " + ex.Message;
            EventLogProvider.LogException("Report table", "E", ex);
            mErrorOccurred = true;
        }

        // If no data load, set empty dataset
        if (DataHelper.DataSourceIsEmpty(ds))
        {
            if (EmailMode && SendOnlyNonEmptyDataSource)
            {
                Visible = false;
                return;
            }

            string noRecordText = ValidationHelper.GetString(TableInfo.TableSettings["QueryNoRecordText"], String.Empty);
            if (!String.IsNullOrEmpty(noRecordText))
            {
                UIGridViewObject.Visible = false;
                lblInfo.Text = ResolveMacros(noRecordText);
                lblInfo.Visible = true;
                EnableExport = false;
                return;
            }

            if (!EmailMode)
            {
                Visible = false;
                return;
            }
        }
        else
        {
            UIGridViewObject.Visible = true;
            // Resolve macros in column names
            int i = 0;
            foreach (DataColumn dc in ds.Tables[0].Columns)
            {
                if (dc.ColumnName == "Column" + (i + 1))
                {
                    dc.ColumnName = ResolveMacros(ds.Tables[0].Rows[0][i].ToString());
                }
                else
                {
                    dc.ColumnName = ResolveMacros(dc.ColumnName);
                }
                i++;
            }

            // Resolve macros in dataset
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                foreach (DataColumn dc in ds.Tables[0].Columns)
                {
                    if (dc.DataType.FullName.ToLowerCSafe() == "system.string")
                    {
                        dr[dc.ColumnName] = ResolveMacros(ValidationHelper.GetString(dr[dc.ColumnName], String.Empty));
                    }
                }
            }

            if (EmailMode)
            {
                // For some email formats, export data in csv format
                EmailFormatEnum format = EmailHelper.GetEmailFormat(ReportSubscriptionSiteID);

                if ((format == EmailFormatEnum.Both) || (format == EmailFormatEnum.PlainText))
                {
                    using (MemoryStream ms = MemoryStream.New())
                    {
                        DataExportHelper deh = new DataExportHelper(ds);
                        byte[] data = deh.ExportToCSV(ds, 0, ms, true);
                        ReportSubscriptionSender.AddToRequest(mReportInfo.ReportName, "t" + TableInfo.TableName, data);
                    }
                }

                // For plain text email show table only as attachment
                if (format == EmailFormatEnum.PlainText)
                {
                    menuCont.Visible = false;
                    ltlEmail.Visible = true;
                    ltlEmail.Text = String.Format(GetString("reportsubscription.attachment"), TableInfo.TableName);
                    return;
                }

                GenerateTableForEmail(ds);
                menuCont.Visible = false;
                return;
            }
        }

        // Databind to gridview control
        UIGridViewObject.DataSource = ds;
        EnsurePageIndex();
        UIGridViewObject.DataBind();

        if ((TableFirstColumnWidth != Unit.Empty) && (UIGridViewObject.Rows.Count > 0))
        {
            UIGridViewObject.Rows[0].Cells[0].Width = TableFirstColumnWidth;
        }
    }
コード例 #48
0
        public override void Execute(ReportInfo RI)
        {
            try
            {
                if (!string.IsNullOrEmpty(SaveResultsInSolutionFolderName))
                {
                    Reporter.ToStatus(eStatusMsgKey.SaveItem, null, SaveResultsInSolutionFolderName, "Execution Summary");
                    string folder = Path.Combine(WorkSpace.Instance.Solution.Folder, @"ExecutionResults");
                    if (!Directory.Exists(folder))
                    {
                        Directory.CreateDirectory(folder);
                    }
                    folder = Path.Combine(folder, SaveResultsInSolutionFolderName);
                    if (!Directory.Exists(folder))
                    {
                        Directory.CreateDirectory(folder);
                    }
                    SaveBFResults(RI, folder);

                    Reporter.HideStatusMessage();
                }

                if (!string.IsNullOrEmpty(SaveResultstoFolderName))
                {
                    Reporter.ToStatus(eStatusMsgKey.SaveItem, null, SaveResultstoFolderName, "Execution Summary");
                    SaveBFResults(RI, SaveResultstoFolderName);
                    Reporter.HideStatusMessage();
                }

                //****----- condition  to check each business flow  ***////
                if (!string.IsNullOrEmpty(SaveResultsInSolutionFolderName) || !string.IsNullOrEmpty(SaveResultstoFolderName))
                {
                    if (SaveindividualBFReport)
                    {
                        ObservableList <BusinessFlow> BFs = new ObservableList <BusinessFlow>();

                        foreach (GingerRunner GR in WorkSpace.RunsetExecutor.Runners)
                        {
                            foreach (BusinessFlow bf in GR.BusinessFlows)
                            {
                                if (bf.Active == true)
                                {
                                    if (bf.RunStatus.ToString() == nameof(eRunStatus.Passed) || bf.RunStatus.ToString() == nameof(eRunStatus.Failed) || bf.RunStatus.ToString() == nameof(eRunStatus.Stopped))
                                    {
                                        // !!!!!!!!!!!!!!!!!!!
                                        ReportInfo BFRI = new ReportInfo(WorkSpace.AutomateTabGingerRunner.ProjEnvironment, bf);

                                        string TempRepFileName = RepositoryItemHelper.RepositoryItemFactory.GenerateTemplate(TemplateName, BFRI);
                                        String RepFileName     = DateTime.Now.ToString("dMMMyyyy_HHmmss_fff") + "_" + WorkSpace.RunsetExecutor.RunSetConfig.Name + "_" + GR.Name + "_" + bf.Name + "_" + WorkSpace.RunsetExecutor.RunsetExecutionEnvironment.Name;

                                        while (RepFileName.Length > 250)
                                        {
                                            RepFileName = RepFileName.Substring(0, 250);
                                        }

                                        RepFileName = RepFileName + ".pdf";

                                        if (!string.IsNullOrEmpty(SaveResultsInSolutionFolderName))
                                        {
                                            System.IO.File.Copy(TempRepFileName, SaveResultsInSolutionFolderName + "\\" + RepFileName);
                                        }

                                        if (SaveResultsInSolutionFolderName != SaveResultstoFolderName)
                                        {
                                            if (!string.IsNullOrEmpty(SaveResultstoFolderName))
                                            {
                                                System.IO.File.Copy(TempRepFileName, SaveResultstoFolderName + "\\" + RepFileName);
                                            }
                                        }
                                        if (System.IO.File.Exists(Path.GetTempPath() + RepFileName))
                                        {
                                            System.IO.File.Delete(Path.GetTempPath() + RepFileName);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    Errors = "Folder path not provided";
                    Reporter.HideStatusMessage();
                    Status = RunSetActionBase.eRunSetActionStatus.Failed;
                }
            }
            catch (Exception ex)
            {
                Errors = "Failed: " + ex.Message;
                Reporter.HideStatusMessage();
                Status = RunSetActionBase.eRunSetActionStatus.Failed;
            }
        }
コード例 #49
0
ファイル: QueryReportDB.cs プロジェクト: wlxawlx/MyFiles
        /// <summary>
        /// 查询报告单列表(根据病人ID)
        /// </summary>
        /// <param name="brid">病人ID</param>
        /// <param name="brlx">病人类型 1:门诊病人 2:住院病人</param>
        /// <param name="values">报告单信息</param>
        /// <param name="msg">出错信息</param>
        /// <returns>0:成功  大于0:出错  小于0:异常</returns>
        public int DB_QueryReportJCListByBRID(string brid, string brlx, out ArrayList values, out string msg)
        {
            string oracleConStr = GetJCReportDBConStr();
            string hm = brid;
            values = new ArrayList();

            if (WebConfigParameter.HospitalName() == AppUtils.HOSPITALNAME.WZSZXYJHYY || 
                WebConfigParameter.HospitalName() == AppUtils.HOSPITALNAME.WZSCNXDSRMYY ||
                WebConfigParameter.HospitalName() == AppUtils.HOSPITALNAME.WZSCNXDERMYY)
            {
                if (ConvertToBkhm(brid, brlx, out hm, out msg) != 0)
                {
                    return 3;
                }
            }
            else if (WebConfigParameter.HospitalName() == AppUtils.HOSPITALNAME.WZSDEYY && null != brlx && brlx.Equals("2"))
            {
                if (ConvertToMZBridForWzsdeyy(brid, brlx, out hm, out msg) != 0)
                {
                    return 3;
                }
            }

            OracleConnection connection = new OracleConnection(oracleConStr);
            OracleDataReader dr = null;
            values = new ArrayList();

            try
            {
                bool _flag = false;

                string sql = _builder.GetSqlReportJCList(hm, brlx, out _flag, out msg);

                if (!_flag)
                {
                    return 10;
                }

                int ret = -99;
                msg = "";
                dr = DbHelperOra.ExecuteReader(sql, connection);
                if (dr.HasRows)
                {

                    while (dr.Read())
                    {
                        ReportInfo ri = new ReportInfo();
                        ri.bgdh = !dr.IsDBNull(0) ? Convert.ToString(dr.GetInt32(0)) : " ";
                        ri.sjmd = !dr.IsDBNull(1) ? dr.GetString(1) : "";
                        ri.cjsj = !dr.IsDBNull(2) ? dr.GetString(2) : "";
                        ri.sjr = !dr.IsDBNull(3) ? dr.GetString(3) : "";
                        ri.jysj = !dr.IsDBNull(4) ? dr.GetString(4) : "";
                        ri.jyr = !dr.IsDBNull(5) ? dr.GetString(5) : "";
                        ri.shr = !dr.IsDBNull(6) ? dr.GetString(6) : "";
                        ri.jzch = !dr.IsDBNull(7) ? dr.GetString(7) : "";
                        ri.zdjg = !dr.IsDBNull(8) ? dr.GetString(8) : "";
                        ri.bbmc = !dr.IsDBNull(9) ? dr.GetString(9) : "";
                        ri.mzbz = !dr.IsDBNull(10) ? dr.GetString(10) : "";
                        ri.dyjb = !dr.IsDBNull(11) ? dr.GetString(11) : "";
                        ri.bz = !dr.IsDBNull(12) ? dr.GetString(12) : "";
                        ri.hzbh = !dr.IsDBNull(13) ? dr.GetString(13) : "";
                        ri.sbm = !dr.IsDBNull(14) ? dr.GetString(14) : "";
                        ri.brxm = !dr.IsDBNull(15) ? dr.GetString(15) : "";
                        ri.jgmc = WebConfigParameter.HospitalChinaName();

                        values.Add(ri);
                    }

                    ret = 0;
                }
                else
                {
                    values = null;
                    msg = "未能找到报告单";
                    ret = 2;

                }

                return ret;
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                values = null;
                msg = GetExceptionInfo(ex);
                return AppUtils.Default_Exception_Code;
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }
コード例 #50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope = PredefinedObjectType.REPORT;
        pnlConnectionString.Visible = CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        Title = "Report General";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ReloadPage", ScriptHelper.GetScript("function ReloadPage() { \n" + Page.ClientScript.GetPostBackEventReference(btnHdnReload, null) + "}"));

        reportId = ValidationHelper.GetInteger(Request.QueryString["reportId"], 0);

        // control initializations
        rfvReportDisplayName.ErrorMessage = GetString("Report_New.EmptyDisplayName");
        rfvReportName.ErrorMessage = GetString("Report_New.EmptyCodeName");

        lblReportDisplayName.Text = GetString("Report_New.DisplayNameLabel");
        lblReportName.Text = GetString("Report_New.NameLabel");
        lblReportCategory.Text = GetString("Report_General.CategoryLabel");
        lblLayout.Text = GetString("Report_General.LayoutLabel");
        lblGraphs.Text = GetString("Report_General.GraphsLabel") + ":";
        lblHtmlGraphs.Text = GetString("Report_General.HtmlGraphsLabel") + ":";
        lblTables.Text = GetString("Report_General.TablesLabel") + ":";
        lblValues.Text = GetString("Report_General.TablesValues") + ":";
        lblReportAccess.Text = GetString("Report_General.ReportAccessLabel");

        actionsElem.ActionsList.Add(new SaveAction(Page));
        actionsElem.ActionPerformed += new CommandEventHandler(actionsElem_ActionPerformed);

        AttachmentTitle.TitleText = GetString("general.attachments");

        attachmentList.AllowPasteAttachments = true;
        attachmentList.ObjectID = reportId;
        attachmentList.ObjectType = ReportingObjectType.REPORT;
        attachmentList.Category = MetaFileInfoProvider.OBJECT_CATEGORY_LAYOUT;

        // Get report info
        ri = ReportInfoProvider.GetReportInfo(reportId);

        if (!RequestHelper.IsPostBack())
        {
            LoadData();
        }

        htmlTemplateBody.AutoDetectLanguage = false;
        htmlTemplateBody.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        htmlTemplateBody.EditorAreaCSS = "";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ReportingHTML", ScriptHelper.GetScript(" var reporting_htmlTemplateBody = '" + htmlTemplateBody.ClientID + "'"));

        // initialize item list controls
        ilGraphs.Report = ri;
        ilTables.Report = ri;
        ilValues.Report = ri;
        ilHtmlGraphs.Report = ri;

        ilGraphs.EditUrl = "ReportGraph_Edit.aspx";
        ilTables.EditUrl = "ReportTable_Edit.aspx";
        ilValues.EditUrl = "ReportValue_Edit.aspx";
        ilHtmlGraphs.EditUrl = "ReportHtmlGraph_Edit.aspx";

        ilGraphs.ItemType = ReportItemType.Graph;
        ilTables.ItemType = ReportItemType.Table;
        ilValues.ItemType = ReportItemType.Value;
        ilHtmlGraphs.ItemType = ReportItemType.HtmlGraph;

        // Refresh script
        string script = "function RefreshWOpener(w) { if (w.refreshPageOnClose){ " + ControlsHelper.GetPostBackEventReference(this, "arg") + " }}";
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ReportingRefresh", ScriptHelper.GetScript(script));
    }
コード例 #51
0
    /// <summary>
    /// Reload data.
    /// </summary>
    public override void ReloadData(bool forceLoad)
    {
        try
        {
            // Load value info object
            ReportValueInfo rvi = ValueInfo;

            if (rvi != null)
            {
                //Test security
                ri = ReportInfoProvider.GetReportInfo(rvi.ValueReportID);
                if (ri.ReportAccess != ReportAccessEnum.All)
                {
                    if (!CMSContext.CurrentUser.IsAuthenticated())
                    {
                        Visible = false;
                        return;
                    }
                }

                EnableSubscription = (EnableSubscription && ValidationHelper.GetBoolean(ValueInfo.ValueSettings["SubscriptionEnabled"], true) && ri.ReportEnableSubscription);
                if (EmailMode && !EnableSubscription)
                {
                    this.Visible = false;
                    return;
                }

                ContextResolver resolver = CMSContext.CurrentResolver;
                // Resolve dynamic data macros
                if (DynamicMacros != null)
                {
                    for (int i = 0; i <= DynamicMacros.GetUpperBound(0); i++)
                    {
                        resolver.AddDynamicParameter(DynamicMacros[i, 0], DynamicMacros[i, 1]);
                    }
                }

                QueryIsStoredProcedure = rvi.ValueQueryIsStoredProcedure;
                QueryText = resolver.ResolveMacros(rvi.ValueQuery);

                //Set default parametrs directly if not set
                if (ReportParameters == null)
                {
                    if (ri != null)
                    {
                        FormInfo fi = new FormInfo(ri.ReportParameters);
                        // Get datarow with required columns
                        ReportParameters = fi.GetDataRow(false);
                        fi.LoadDefaultValues(ReportParameters, true);
                    }
                }
            }

            // Only use base parameters in case of stored procedure
            if (QueryIsStoredProcedure)
            {
                AllParameters = SpecialFunctions.ConvertDataRowToParams(ReportParameters, null);
            }

            // Load data
            DataSet ds = LoadData();

            // If datasource is emptry, create empty dataset
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                // Set literal text
                string value = rvi.ValueFormatString;
                if ((value == null) || (value == ""))
                {
                    value = ValidationHelper.GetString(ds.Tables[0].Rows[0][0], "");
                }
                else
                {
                    value = string.Format(value, ds.Tables[0].Rows[0].ItemArray);
                }

                if (EmailMode)
                {
                    ltlEmail.Text = HTMLHelper.HTMLEncode(ResolveMacros(value));
                    ltlEmail.Visible = true;
                    menuCont.Visible = false;
                }
                else
                {
                    lblValue.Text = HTMLHelper.HTMLEncode(ResolveMacros(value));
                }
            }
            else if (EmailMode && SendOnlyNonEmptyDataSource)
            {
                Visible = false;
            }
        }
        catch (Exception ex)
        {
            // Display error message, if data load fail
            lblError.Visible = true;
            lblError.Text = "[ReportValue.ascx] Error loading the data: " + ex.Message;
            EventLogProvider ev = new EventLogProvider();
            ev.LogEvent("Report value", "E", ex);
        }
    }
コード例 #52
0
ファイル: QueryReportDB.cs プロジェクト: wlxawlx/MyFiles
        /// <summary>
        /// 根据条形码或者报告单号报告明细
        /// </summary>
        /// <param name="code">条形码或者报告单号</param>
        /// <param name="lx">号码类型 1:报告单号 2条码查询</param>
        /// <param name="values">报告信息</param>
        /// <param name="msg">出错信息</param>
        /// <returns>0:成功  大于0:出错  小于0:异常</returns>
        public int DB_QueryReportJCListByCode(string code, string lx, string brxm, out ArrayList values, out string msg)
        {
            string oracleConStr = GetJCReportDBConStr();
            OracleConnection connection = new OracleConnection(oracleConStr);
            OracleDataReader dr = null;
            values = new ArrayList();
            try
            {
                bool _flag = false;
                string sql = _builder.GetSqlReportJCDetail(code, lx, brxm, out _flag, out msg);

                if (!_flag)
                {
                    return 10;
                }

                int ret = -99;
                msg = "";
                dr = DbHelperOra.ExecuteReader(sql, connection);
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        ReportInfo ri = new ReportInfo();
                        ri.bgdh = !dr.IsDBNull(0) ? Convert.ToString(dr.GetInt32(0)) : "";
                        ri.sjmd = !dr.IsDBNull(1) ? dr.GetString(1) : "";
                        ri.cjsj = !dr.IsDBNull(2) ? dr.GetString(2) : "";
                        ri.sjr = !dr.IsDBNull(3) ? dr.GetString(3) : "";
                        ri.jysj = !dr.IsDBNull(4) ? dr.GetString(4) : "";
                        ri.jyr = !dr.IsDBNull(5) ? dr.GetString(5) : "";
                        ri.shr = !dr.IsDBNull(6) ? dr.GetString(6) : "";
                        ri.jzch = !dr.IsDBNull(7) ? dr.GetString(7) : "";
                        ri.zdjg = !dr.IsDBNull(8) ? dr.GetString(8) : "";
                        ri.bbmc = !dr.IsDBNull(9) ? dr.GetString(9) : "";
                        ri.mzbz = !dr.IsDBNull(10) ? dr.GetString(10) : "";
                        ri.dyjb = !dr.IsDBNull(11) ? dr.GetString(11) : "";
                        ri.bz = !dr.IsDBNull(12) ? dr.GetString(12) : "";
                        ri.hzbh = !dr.IsDBNull(13) ? dr.GetString(13) : "";
                        ri.sbm = !dr.IsDBNull(14) ? dr.GetString(14) : "";
                        ri.brxm = !dr.IsDBNull(15) ? dr.GetString(15) : "";
                        ri.jgmc = WebConfigParameter.HospitalChinaName();

                        ICollection<ReportDetail> rds;
                        string child_msg;
                        int rtDetail;
                        if (AppUtils.HOSPITALNAME.WZSTXRMYY == WebConfigParameter.HospitalName()||
                            AppUtils.HOSPITALNAME.WZSRAZYY == WebConfigParameter.HospitalName())
                        {
                            rtDetail = DB_QueryReportJCDetail(ri.hzbh, out rds, out child_msg);
                        }
                        else
                        {
                            rtDetail = DB_QueryReportJCDetail(ri.bgdh, out rds, out child_msg);
                        }
                        if (rtDetail == 0)
                        {
                            ri.details = rds;
                        }
                        else
                        {
                            msg += "[单号" + ri.bgdh + "详细查询错误]" + child_msg + ";";
                            ret = 3;
                        }
                        values.Add(ri);
                    }

                    ret = 0;
                }
                else
                {
                    values = null;
                    msg = "未能找到该编号的报告单,请检查编号";
                    ret = 2;

                }

                return ret;
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);

                values = null;
                msg = GetExceptionInfo(ex);
                return AppUtils.Default_Exception_Code;
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }
コード例 #53
0
    /// <summary>
    /// Reload data.
    /// </summary>
    public override void ReloadData(bool forceLoad)
    {
        // Load value info object
        ReportValueInfo rvi = ValueInfo;
        if (rvi == null)
        {
            return;
        }

        ri = ReportInfoProvider.GetReportInfo(rvi.ValueReportID);
        if (ri == null)
        {
            return;
        }

        // Check security settings
        if (!(CheckReportAccess(ri) && CheckEmailModeSubscription(ri, ValidationHelper.GetBoolean(ValueInfo.ValueSettings["SubscriptionEnabled"], true))))
        {
            Visible = false;
            return;
        }

        // Prepare query attributes
        QueryIsStoredProcedure = rvi.ValueQueryIsStoredProcedure;
        QueryText = rvi.ValueQuery;

        // Init parameters
        InitParameters(ri.ReportParameters);

        // Init macro resolver
        InitResolver();

        DataSet ds = null;

        // Ensure report item name for caching
        if (String.IsNullOrEmpty(ReportItemName))
        {
            ReportItemName = String.Format("{0};{1}", ri.ReportName, rvi.ValueName);
        }

        try
        {
            // Load data
            ds = LoadData();
        }
        catch (Exception ex)
        {
            // Display error message, if data load fail
            lblError.Visible = true;
            lblError.Text = "[ReportValue.ascx] Error loading the data: " + ex.Message;
            EventLogProvider.LogException("Report value", "E", ex);
        }

        // If datasource is emptry, create empty dataset
        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            // Set literal text
            string value = rvi.ValueFormatString;
            if (String.IsNullOrEmpty(value))
            {
                value = ValidationHelper.GetString(ds.Tables[0].Rows[0][0], String.Empty);
            }
            else
            {
                value = string.Format(value, ds.Tables[0].Rows[0].ItemArray);
            }

            if (EmailMode)
            {
                ltlEmail.Text = HTMLHelper.HTMLEncode(ResolveMacros(value));
                ltlEmail.Visible = true;
                menuCont.Visible = false;
            }
            else
            {
                lblValue.Text = HTMLHelper.HTMLEncode(ResolveMacros(value));
            }
        }
        else if (EmailMode && SendOnlyNonEmptyDataSource)
        {
            Visible = false;
        }
    }
コード例 #54
0
        public override void Execute(ReportInfo RI)
        {
            if ((WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList != null) && (WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Count > 0))
            {
                Dictionary <Guid, Dictionary <string, string> > defectsForOpening = new Dictionary <Guid, Dictionary <string, string> >();

                ObservableList <ALMDefectProfile> ALMDefectProfiles = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ALMDefectProfile>();
                ALMDefectProfile defaultALMDefectProfile            = new ALMDefectProfile();
                if ((ALMDefectProfiles != null) && (ALMDefectProfiles.Count > 0))
                {
                    defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.ID == SelectedDefectsProfileID).ToList().FirstOrDefault();
                    if (defaultALMDefectProfile == null)
                    {
                        defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.IsDefault).ToList().FirstOrDefault();
                        if (defaultALMDefectProfile == null)
                        {
                            defaultALMDefectProfile = ALMDefectProfiles.FirstOrDefault();
                        }
                    }
                }

                if (DefectsOpeningModeForMarked)
                {
                    foreach (DefectSuggestion defectSuggestion in WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.AutomatedOpeningFlag == true).ToList())
                    {
                        Dictionary <string, string> currentALMDefectFieldsValues = new Dictionary <string, string>();
                        try
                        {
                            currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) ||
                                                                                                                z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&amp;") : x.SelectedValue = string.Empty)
                                                           .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.Description : w.Value)
                                                           .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value)
                                                           .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value);
                        }
                        catch (Exception ex)
                        {
                            currentALMDefectFieldsValues.Add("Summary", defectSuggestion.Summary);
                            currentALMDefectFieldsValues.Add("description", defectSuggestion.ErrorDetails);
                        }

                        currentALMDefectFieldsValues.Add("screenshots", String.Join(",", defectSuggestion.ScreenshotFileNames));

                        defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues);
                    }
                }
                else if (DefectsOpeningModeForAll)
                {
                    foreach (DefectSuggestion defectSuggestion in WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList)
                    {
                        Dictionary <string, string> currentALMDefectFieldsValues = new Dictionary <string, string>();
                        try
                        {
                            currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) ||
                                                                                                                z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&amp;") : x.SelectedValue = string.Empty)
                                                           .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.Description : w.Value)
                                                           .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value)
                                                           .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value);
                        }
                        catch (Exception ex)
                        {
                            currentALMDefectFieldsValues.Add("Summary", defectSuggestion.Summary);
                            currentALMDefectFieldsValues.Add("description", defectSuggestion.ErrorDetails);
                        }

                        currentALMDefectFieldsValues.Add("screenshots", String.Join(",", defectSuggestion.ScreenshotFileNames));

                        defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues);
                    }
                }
                else
                {
                    return;
                }
                var defectFields = defaultALMDefectProfile.ALMDefectProfileFields.Where(a => a.Mandatory || a.ToUpdate).ToList();
                //update alm type to open defect
                RepositoryItemHelper.RepositoryItemFactory.CreateNewALMDefects(defectsForOpening, defectFields, defaultALMDefectProfile.AlmType);
            }
        }
コード例 #55
0
    /// <summary>
    /// Returns true if graph belongs to report.
    /// </summary>
    /// <param name="report">Report to validate</param>
    public override bool IsValid(ReportInfo report)
    {
        ReportGraphInfo rgi = ReportGraphInfo;
        // Test validity
        if ((report != null) && (rgi != null) && (report.ReportID == rgi.GraphReportID))
        {
            return true;
        }

        return false;
    }
コード例 #56
0
        public string GenerateTemplate(string templatename, object o)
        {
            ReportInfo reportInfo = (ReportInfo)o;

            return(ReportTemplate.GenerateReport(templatename, reportInfo));
        }
コード例 #57
0
    /// <summary>
    /// Sets data to database.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check 'Modify' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
        {
            RedirectToAccessDenied("cms.reporting", "Modify");
        }

        string errorMessage = new Validator().NotEmpty(txtReportDisplayName.Text.Trim(), rfvReportDisplayName.ErrorMessage).NotEmpty(txtReportName.Text.Trim(), rfvReportName.ErrorMessage).Result;

        if ((errorMessage == "") && (!ValidationHelper.IsCodeName(txtReportName.Text.Trim())))
        {
            errorMessage = GetString("general.invalidcodename");
        }

        if (ReportCategoryInfoProvider.GetReportCategoryInfo(categoryId) == null)
        {
            errorMessage = GetString("Report_General.InvalidReportCategory");
        }

        ReportAccessEnum reportAccess = ReportAccessEnum.All;
        if (!chkReportAccess.Checked)
        {
            reportAccess = ReportAccessEnum.Authenticated;
        }

        if (errorMessage == "")
        {
            //if report with given name already exists show error message
            if (ReportInfoProvider.GetReportInfo(txtReportName.Text.Trim()) != null)
            {
                lblError.Visible = true;
                lblError.Text = GetString("Report_New.ReportAlreadyExists");
                return;
            }

            ReportInfo ri = new ReportInfo();

            ri.ReportDisplayName = txtReportDisplayName.Text.Trim();
            ri.ReportName = txtReportName.Text.Trim();
            ri.ReportCategoryID = categoryId;
            ri.ReportLayout = "";
            ri.ReportParameters = "";
            ri.ReportAccess = reportAccess;

            ReportInfoProvider.SetReportInfo(ri);

            ltlScript.Text += "<script type=\"text/javascript\">";
            ltlScript.Text += @"if (parent.frames['reportcategorytree'])
                                {
                                    parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?reportid=" + ri.ReportID + @"';
                                }
                                if (parent.parent.frames['reportcategorytree'])
                                {
                                    parent.parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?reportid=" + ri.ReportID + @"';
                                }
                 this.location.href = 'Report_Edit.aspx?reportId=" + Convert.ToString(ri.ReportID) + @"&saved=1&categoryID=" + categoryId + @"'
                </script>";

        }
        else
        {
            lblError.Visible = true;
            lblError.Text = errorMessage;
        }
    }
コード例 #58
0
ファイル: GameUI.cs プロジェクト: Zeppar/Voice
    private void Update()
    {
        oxyText.text   = GameController.manager.oxyData;
        heartText.text = GameController.manager.heartData;
        if (gameEnd)
        {
            return;
        }


#if UNITY_EDITOR
        if (Input.GetKey(KeyCode.Space))
        {
            value += Time.deltaTime * 0.2f;
        }
        else
        {
            //value -= Time.deltaTime * 0.2f;
            //value = Mathf.Clamp01(value);
            value = 0;
        }
#else
        value = GetSliderValue(GetCurrentVolume());
#endif
        voiceSlider.fillAmount = Mathf.Lerp(voiceSlider.fillAmount, value, 0.1f);

        timer     += Time.deltaTime;
        fallTimer += Time.deltaTime;

        if (!GameController.manager.isPaint && GameController.manager.levelMan.selectInfo.index != 5 && timer >= 600.0f)
        {
            SoundManager.manager.PlayMusicByPath("09006");
            string r = resultList[UnityEngine.Random.Range(0, 6)];
            GameController.manager.infoAlert.ShowWithText(r, () => {
                // save TODO
                ReportInfo info = new ReportInfo();
                DateTime time   = DateTime.Now;
                info.name       = time.Year.ToString() + "-" + time.Month.ToString("00") + "-" + time.Day.ToString("00") + " "
                                  + time.Hour.ToString("00") + ":" + time.Minute.ToString("00") + ":" + time.Second.ToString("00");
                info.type     = 0;
                info.result   = info.name + "\n" + GameController.manager.accountMan.selfInfo.name + "\n" + GameController.manager.levelMan.selectInfo.name + "\n" + r;;
                info.username = GameController.manager.accountMan.selfInfo.username;
                GameController.manager.reportMan.AddReport(info);
                SceneManager.LoadScene(1);
                GameController.manager.enterFromGame = true;
            });
            gameEnd = true;
            return;
        }

        if (!GameController.manager.isPaint)
        {
            switch (GameController.manager.levelMan.selectInfo.index)
            {
            case 0:
                volumeParam = Mathf.Lerp(volumeParam, value, 0.02f);
                float scale = 1.0f + Mathf.Clamp01(volumeParam) * 3;
                ballImg.transform.localScale = new Vector3(scale, scale, 1.0f);
                break;

            case 1:
                //volumeParam = Mathf.Lerp(volumeParam, value, 0.02f);
                int index = Mathf.Clamp((int)(desertTimer / 3), 0, 3);
                desertSliderInner.fillAmount = index / 3.0f;
                backgroundImg.sprite         = game2Sps[index];
                break;

            case 2:
                // no end
                break;

            case 3:
                volumeParam = Mathf.Lerp(volumeParam, value * 80, 0.008f);
                windMillImg.transform.Rotate(new Vector3(0, 0, 1), volumeParam);
                break;

            case 4:
                if (fallTimer > 1.0f)
                {
                    fallTimer -= 1.0f;
                    fallSpawner.UpdateFallGo(value);
                }
                break;

            case 5:
                paintTimeText.text = Util.SecToTimeString(timer);
                break;

            case 6:
                if (value > 0.6)
                {
                    backgroundImg.sprite = game6SucSp;
                }
                break;

            default:
                break;
            }
            if (value > 0.1f)
            {
                startVoice     = true;
                noVoiceTimer   = 0;
                noVoiceTimes   = 0;
                showScoreTimer = 0;
                desertTimer   += Time.deltaTime;
            }
            else if (value < 0.006)
            {
                if (noVoiceTimer > 20.0f)
                {
                    desertTimer -= Time.deltaTime;
                    desertTimer  = Math.Max(0, desertTimer);
                }
                if (GameController.manager.levelMan.selectInfo.index != 1)
                {
                    showScoreTimer += Time.deltaTime;
                    if (showScoreTimer > 1.0f)
                    {
                        if (startVoice)
                        {
                            ShowScore(maxVolume);
                            if (maxVolume > 0.6f)
                            {
                                sucTime += 1;
                                if (GameController.manager.levelMan.selectInfo.index == 0)
                                {
                                    ballImg.GetComponent <Animator>().SetTrigger("boom");
                                }
                            }
                            else
                            {
                                sucTime = 0;
                            }
                            maxVolume = -1.0f;
                            if (!GameController.manager.isPaint && GameController.manager.levelMan.selectInfo.index == 6)
                            {
                                backgroundImg.sprite = game6NorSp;
                            }
                        }
                        startVoice     = false;
                        showScoreTimer = 0;
                    }
                }


                if (GameController.manager.isPaint ||
                    (!GameController.manager.isPaint && (GameController.manager.levelMan.selectInfo.index == 2 || GameController.manager.levelMan.selectInfo.index == 5)))
                {
                    // do nothing
                }
                else
                {
                    if (!stopGame)
                    {
                        noVoiceTimer += Time.deltaTime;
                    }
                    if (GameController.manager.levelMan.selectInfo.index != 1)
                    {
                        if (noVoiceTimer > 5.0f)
                        {
                            noVoiceTimer = 0;
                            noVoiceTimes++;
                            stopGame = true;
                            StopCoroutine("ResetStopFlag");
                            StartCoroutine("ResetStopFlag");
                            if (noVoiceTimes == 3)
                            {
                                SoundManager.manager.PlayMusicByPath(GameController.manager.accountMan.selfInfo.sex.ToString()
                                                                     + "9005");
                                gameEnd = true;
                                string r = resultList[UnityEngine.Random.Range(0, 6)];
                                GameController.manager.infoAlert.ShowWithText(r, () => {
                                    // save TODO
                                    ReportInfo info = new ReportInfo();
                                    DateTime time   = DateTime.Now;
                                    info.name       = time.Year.ToString() + "-" + time.Month.ToString("00") + "-" + time.Day.ToString("00") + " "
                                                      + time.Hour.ToString("00") + ":" + time.Minute.ToString("00") + ":" + time.Second.ToString("00");
                                    info.type     = 0;
                                    info.username = GameController.manager.accountMan.selfInfo.username;
                                    info.result   = info.name + "\n" + GameController.manager.accountMan.selfInfo.name + "\n" + GameController.manager.levelMan.selectInfo.name + "\n" + r;;
                                    GameController.manager.reportMan.AddReport(info);
                                    SceneManager.LoadScene(1);
                                    GameController.manager.enterFromGame = true;
                                });
                                StopCoroutine("EndGameOperation");
                                StartCoroutine("EndGameOperation");
                                return;
                            }
                            else
                            {
                                SoundManager.manager.PlayMusicByPath(GameController.manager.accountMan.selfInfo.sex.ToString() + GameController.manager.voiceType.ToString()
                                                                     + "00" + UnityEngine.Random.Range(0, 6));
                            }
                        }
                    }
                }
            }
            maxVolume = Mathf.Max(maxVolume, value);

            if (sucTime >= 3)
            {
                gameEnd = true;
                voiceSlider.fillAmount = 0;
                ballImg.gameObject.SetActive(false);
                fallSpawner.gameObject.SetActive(false);
                // save TODO
                SoundManager.manager.PlayMusicByPath(GameController.manager.accountMan.selfInfo.sex + "9004");
                string r = resultList[UnityEngine.Random.Range(0, 6)];
                GameController.manager.infoAlert.ShowWithText(r, () => {
                    // save TODOpaintiii
                    ReportInfo info = new ReportInfo();
                    DateTime time   = DateTime.Now;
                    info.name       = time.Year.ToString() + "-" + time.Month.ToString("00") + "-" + time.Day.ToString("00") + " "
                                      + time.Hour.ToString("00") + ":" + time.Minute.ToString("00") + ":" + time.Second.ToString("00");
                    info.type     = 0;
                    info.username = GameController.manager.accountMan.selfInfo.username;
                    info.result   = info.name + "\n" + GameController.manager.accountMan.selfInfo.name + "\n" + GameController.manager.levelMan.selectInfo.name + "\n" + r;;
                    GameController.manager.reportMan.AddReport(info);
                    SceneManager.LoadScene(1);
                    GameController.manager.enterFromGame = true;
                });
            }
        }

        if ((!GameController.manager.isPaint && GameController.manager.levelMan.selectInfo.index == 5) || GameController.manager.isPaint)
        {
#if UNITY_EDITOR
            if (Input.mousePosition.y > 200.0f && Input.mousePosition.y < Screen.height - 100.0f)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    var go = Instantiate(linePrefab, linePrefab.transform.position, transform.rotation);
                    go.transform.SetParent(lineParent, false);
                    line              = go.GetComponent <LineRenderer>();//获得该物体上的LineRender组件
                    line.startColor   = paintInfo.color;
                    line.endColor     = paintInfo.color;
                    line.startWidth   = paintInfo.width;
                    line.endWidth     = paintInfo.width;
                    line.sortingOrder = lineIndex;
                    lineIndex++;
                    touch1Idx = 0;
                }
                if (Input.GetMouseButton(0))
                {
                    touch1Idx++;
                    line.positionCount = touch1Idx;                                                                                                 //设置顶点数
                    line.SetPosition(touch1Idx - 1, Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 15))); //设置顶点位置
                    //line.enabled=false;
                }
            }
#else
            if (Input.touches.Length > 0)
            {
                var touch0 = Input.GetTouch(0);
                if (touch0.phase == TouchPhase.Began)
                {
                    var go = Instantiate(linePrefab, linePrefab.transform.position, transform.rotation);
                    go.transform.SetParent(lineParent, false);
                    line              = go.GetComponent <LineRenderer>();//获得该物体上的LineRender组件
                    line.startColor   = paintInfo.color;
                    line.endColor     = paintInfo.color;
                    line.startWidth   = paintInfo.width;
                    line.endWidth     = paintInfo.width;
                    line.sortingOrder = lineIndex;
                    lineIndex++;
                    touch1Idx = 0;
                }
                else if (touch0.phase == TouchPhase.Moved)
                {
                    touch1Idx++;
                    line.positionCount = touch1Idx;                                                                                                               //设置顶点数
                    line.SetPosition(touch1Idx - 1, Camera.main.ScreenToWorldPoint(new Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y, 15))); //设置顶点位置
                }
                if (Input.touches.Length > 1)
                {
                    var touch1 = Input.GetTouch(1);
                    if (touch1.phase == TouchPhase.Began)
                    {
                        var go = Instantiate(linePrefab, linePrefab.transform.position, transform.rotation);
                        go.transform.SetParent(lineParent, false);
                        line2              = go.GetComponent <LineRenderer>();//获得该物体上的LineRender组件
                        line2.startColor   = paintInfo.color;
                        line2.endColor     = paintInfo.color;
                        line2.startWidth   = paintInfo.width;
                        line2.endWidth     = paintInfo.width;
                        line2.sortingOrder = lineIndex;
                        lineIndex++;
                        touch2Idx = 0;
                    }
                    else if (touch1.phase == TouchPhase.Moved)
                    {
                        touch2Idx++;
                        line2.positionCount = touch2Idx;                                                                                                               //设置顶点数
                        line2.SetPosition(touch2Idx - 1, Camera.main.ScreenToWorldPoint(new Vector3(Input.GetTouch(1).position.x, Input.GetTouch(1).position.y, 15))); //设置顶点位置
                    }
                }
            }
#endif
        }
    }
コード例 #59
0
ファイル: Report_List.aspx.cs プロジェクト: KuduApps/Kentico
    /// <summary>
    /// Clones the given report (including attachment files).
    /// </summary>
    /// <param name="reportId">Report id</param>
    protected void Clone(int reportId)
    {
        // Check 'Modify' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
        {
            RedirectToAccessDenied("cms.reporting", "Modify");
        }

        // Try to get report info
        ReportInfo oldri = ReportInfoProvider.GetReportInfo(reportId);
        if (oldri == null)
        {
            return;
        }

        DataSet graph_ds = ReportGraphInfoProvider.GetGraphs(reportId);
        DataSet table_ds = ReportTableInfoProvider.GetTables(reportId);
        DataSet value_ds = ReportValueInfoProvider.GetValues(reportId);

        // Duplicate report info object
        ReportInfo ri = new ReportInfo(oldri, false);
        ri.ReportID = 0;
        ri.ReportGUID = Guid.NewGuid();

        // Duplicate report info
        string reportName = ri.ReportName;
        string oldReportName = ri.ReportName;

        string reportDispName = ri.ReportDisplayName;

        while (ReportInfoProvider.GetReportInfo(reportName) != null)
        {
            reportName = Increment(reportName, "_", "", 100);
            reportDispName = Increment(reportDispName, "(", ")", 450);
        }

        ri.ReportName = reportName;
        ri.ReportDisplayName = reportDispName;

        // Used to eliminate version from create object task
        using (CMSActionContext context = new CMSActionContext())
        {
            context.CreateVersion = false;
            ReportInfoProvider.SetReportInfo(ri);
        }

        string name;

        // Duplicate graph data
        if (!DataHelper.DataSourceIsEmpty(graph_ds))
        {
            foreach (DataRow dr in graph_ds.Tables[0].Rows)
            {
                // Duplicate the graph
                ReportGraphInfo rgi = new ReportGraphInfo(dr);
                rgi.GraphID = 0;
                rgi.GraphGUID = Guid.NewGuid();
                rgi.GraphReportID = ri.ReportID;
                name = rgi.GraphName;

                // Replace layout based on HTML or regular graph type
                ri.ReportLayout = ReplaceMacro(ri.ReportLayout, rgi.GraphIsHtml ? REP_HTMLGRAPH_MACRO : REP_GRAPH_MACRO, rgi.GraphName, name, oldReportName, reportName);
                rgi.GraphName = name;

                ReportGraphInfoProvider.SetReportGraphInfo(rgi);
            }
        }

        // Duplicate table data
        if (!DataHelper.DataSourceIsEmpty(table_ds))
        {
            foreach (DataRow dr in table_ds.Tables[0].Rows)
            {
                // Duplicate the table
                ReportTableInfo rti = new ReportTableInfo(dr);
                rti.TableID = 0;
                rti.TableGUID = Guid.NewGuid();
                rti.TableReportID = ri.ReportID;
                name = rti.TableName;

                ri.ReportLayout = ReplaceMacro(ri.ReportLayout, REP_TABLE_MACRO, rti.TableName, name, oldReportName, reportName);
                rti.TableName = name;

                ReportTableInfoProvider.SetReportTableInfo(rti);
            }
        }

        // Duplicate value data
        if (!DataHelper.DataSourceIsEmpty(value_ds))
        {
            foreach (DataRow dr in value_ds.Tables[0].Rows)
            {
                // Duplicate the value
                ReportValueInfo rvi = new ReportValueInfo(dr);
                rvi.ValueID = 0;
                rvi.ValueGUID = Guid.NewGuid();
                rvi.ValueReportID = ri.ReportID;
                name = rvi.ValueName;

                ri.ReportLayout = ReplaceMacro(ri.ReportLayout, REP_VALUE_MACRO, rvi.ValueName, name, oldReportName, reportName);
                rvi.ValueName = name;

                ReportValueInfoProvider.SetReportValueInfo(rvi);
            }
        }

        List<Guid> convTable = new List<Guid>();
        try
        {
            MetaFileInfoProvider.CopyMetaFiles(reportId, ri.ReportID, ReportingObjectType.REPORT, MetaFileInfoProvider.OBJECT_CATEGORY_LAYOUT, convTable);
        }
        catch (Exception e)
        {
            lblError.Visible = true;
            lblError.Text = e.Message;
            ReportInfoProvider.DeleteReportInfo(ri);
            return;
        }

        for (int i = 0; i < convTable.Count; i += 2)
        {
            Guid oldGuid = convTable[i];
            Guid newGuid = convTable[i + 1];
            ri.ReportLayout = ri.ReportLayout.Replace(oldGuid.ToString(), newGuid.ToString());
        }

        ReportInfoProvider.SetReportInfo(ri);

        // Refresh tree
        ltlScript.Text += "<script type=\"text/javascript\">";
        ltlScript.Text += @"if (parent.frames['reportcategorytree'])
                                {
                                    parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?reportid=" + ri.ReportID + @"';
                                }
                                if (parent.parent.frames['reportcategorytree'])
                                {
                                    parent.parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?reportid=" + ri.ReportID + @"';
                                }
                 this.location.href = 'Report_Edit.aspx?reportId=" + Convert.ToString(ri.ReportID) + @"&saved=1&categoryID=" + categoryId + @"'
                </script>";
    }
コード例 #60
0
 /// <summary>
 /// Updates report information.
 /// </summary>
 /// <param name="info"></param>
 public static void UpdateReportInfo(ReportInfo info)
 {
     _context.ReportInfo = info;
 }