コード例 #1
0
        public void BindChart(OrganizationChart chart, OrganizationChartTypeViews viewType)
        {
            try
            {
                this.customOrgChartDetails.BindData(chart);

                // set chart generation parameters
                ChartGenerationParameters chartParameters = new ChartGenerationParameters()
                {
                    ChartType = viewType
                };

                if (viewType == OrganizationChartTypeViews.InProcess)
                {
                    // get in process chart
                    int chartID = base.CurrentOrgChartID;
                    chartParameters.ID = chartID;

                    this.customDisplayChart.PreviewTitle = this.PreviewTitleInProcess;
                    OrganizationChartPositionCollection positionList = OrganizationChartPositionManager.Instance.GetOrganizationChartPositions(chartID);

                    // pass position list and starting point of the in-process chart
                    this.customDisplayChart.BindChart(chartParameters, positionList.ToList <IChartPosition>(), chart.StartPointWFPPositionID);
                }
                else if (viewType == OrganizationChartTypeViews.Published)
                {
                    int chartLogID = base.CurrentOrgChart.PublishedOrganizationChartLogID;
                    chartParameters.ID = chartLogID;
                    ChartGenerationParametersSessionWrapper.Parameters = chartParameters;

                    this.customDisplayChart.PreviewTitle = this.PreviewTitlePublished;

                    // Load up chart log based on most recent published version
                    OrganizationChartLog chartLog = OrganizationChartLogManager.Instance.GetByID(chartLogID);
                    IList <OrganizationChartPositionLog> positionList = OrganizationChartPositionLogManager.Instance.GetOrganizationChartPositionLogs(chartLogID);

                    // pass position list and starting point OF THE PUBLISHED CHART (not the in-process chart)
                    this.customDisplayChart.BindChart(chartParameters, positionList.ToList <IChartPosition>(), chartLog.StartPointWFPPositionID);
                }
            }
            catch (Exception ex)
            {
                base.HandleException(ex);
            }
        }
コード例 #2
0
        private void loadData()
        {
            if (Request.QueryString[CHARTIDKEY] == null)
            {
                printMessage(GetLocalResourceObject("NullIDKey").ToString());
            }
            else
            {
                int  tempID  = -1;
                bool paramOK = int.TryParse(Request.QueryString[CHARTIDKEY], out tempID);

                if (!paramOK)
                {
                    printMessage(GetLocalResourceObject("IDKeyNotAValidInteger").ToString());
                }
                else
                {
                    OrganizationChart chart = OrganizationChartManager.Instance.GetByID(tempID);

                    if (chart.OrganizationChartID == -1)
                    {
                        printMessage(GetLocalResourceObject("IDNotFoundMessage").ToString());
                    }
                    else
                    {
                        this.customDisplayChart.Visible = true;
                        this.Page.Title = string.Format(GetLocalResourceObject("PageTitle").ToString(), chart.OrganizationName, chart.OrgCode.OrganizationCodeValue);
                        IList <OrganizationChartPosition> positionList = OrganizationChartPositionManager.Instance.GetOrganizationChartPositions(chart.OrganizationChartID);

                        ChartGenerationParameters genParams = new ChartGenerationParameters()
                        {
                            ID        = chart.OrganizationChartID,
                            ChartType = OrganizationChartTypeViews.InProcess
                        };

                        this.customDisplayChart.BindChart(genParams, positionList.ToList <IChartPosition>(), chart.StartPointWFPPositionID);
                    }
                }
            }
        }
コード例 #3
0
        public void BindChart(ChartGenerationParameters generationParams, IList <IChartPosition> positionList, int rootNode)
        {
            try
            {
                // load resources
                loadResources();

                // get position list JSON
                StringBuilder scriptPositionList = this.getPositionListJSON(positionList, rootNode);

                // write to code block
                string varChartID   = string.Format("var ctrlDisplay_srvChartID = {0}; ", generationParams.ID);
                string varChartType = string.Format("var ctrlDisplay_srvChartType = {0}; ", (int)generationParams.ChartType);

                scriptChartBlock.Controls.Add(new LiteralControl(string.Format("<script language=\"javascript\" type=\"text/javascript\">{0}{1}{2}</script>",
                                                                               varChartID, varChartType, scriptPositionList.ToString())));
            }
            catch (Exception ex)
            {
                base.HandleException(ex);
            }
        }
コード例 #4
0
        private void loadData()
        {
            try
            {
                OrganizationChartLog chartLog = base.CurrentOrgChartLog;
                this.customPubOrgChartDetails.BindData(chartLog);

                // set chart generation parameters
                ChartGenerationParameters genParams = new ChartGenerationParameters()
                {
                    ID        = chartLog.OrganizationChartLogID,
                    ChartType = OrganizationChartTypeViews.Published
                };

                base.SetPageTitle(string.Format(GetLocalResourceObject("PageTitle").ToString(), chartLog.OrganizationName, chartLog.OrgCode.OrganizationCodeValue));
                IList <OrganizationChartPositionLog> positionList = OrganizationChartPositionLogManager.Instance.GetOrganizationChartPositionLogs(chartLog.OrganizationChartLogID);
                this.customDisplayChart.BindChart(genParams, positionList.ToList <IChartPosition>(), chartLog.StartPointWFPPositionID);
            }
            catch (Exception ex)
            {
                base.HandleException(ex);
            }
        }
コード例 #5
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                ChartGenerationParameters chartParameters = ChartGenerationParametersSessionWrapper.Parameters;

                if (UserSessionWrapper.CurrentUserID == -1 || chartParameters.ID == -1 || chartParameters.DocumentID == Guid.Empty || chartParameters.ChartType == OrganizationChartTypeViews.None)
                {
                    context.Response.Redirect(MyTrackerURL, false);
                }
                else
                {
                    int currentUserID = UserSessionWrapper.CurrentUserID;

                    // get TemporaryDocument by documentID and userID
                    TemporaryDocument currentDocument = TemporaryDocumentRepository.Instance.GetByID(chartParameters.DocumentID, currentUserID);

                    if (currentDocument.DocumentID == Guid.Empty)
                    {
                        context.Response.Redirect(MyTrackerURL, false);
                    }
                    else
                    {
                        // Get IOrganizationChart
                        IOrganizationChart chart = null;

                        if (chartParameters.ChartType == OrganizationChartTypeViews.InProcess)
                        {
                            // In-Process
                            chart = OrganizationChartManager.Instance.GetByID(chartParameters.ID);
                        }
                        else
                        {
                            // Published Chart -- This will have the "ApprovedBy", "OnBehalfOf" and "ApprovedDate"
                            chart = OrganizationChartLogManager.Instance.GetByID(chartParameters.ID);
                        }

                        // Pass to PDF Builder
                        OrganizationChartPDFBuilder builder = new OrganizationChartPDFBuilder(context, context.Server.MapPath(ConfigWrapper.OrgChartTemplateFilePath));
                        builder.BuildChart(chart, currentDocument);

                        try
                        {
                            // Delete temporary document from database
                            TemporaryDocumentRepository.Instance.Delete(chartParameters.DocumentID, currentUserID);
                        }
                        catch (Exception ex)
                        {
                            // log if there is an error, but don't prevent execution
                            base.LogExceptionOnly(ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException == null)
                {
                    base.LogExceptionOnly(ex);
                }
                else
                {
                    base.LogExceptionOnly(ex.InnerException);
                }

                // throw new Exception("Error Encountered");
                throw new Exception(ex.ToString());
            }

            context.Response.End();
        }