Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            ProcessProgress.Current.RegisterResponser(ShowOrgChartProgressResponser.Instance);

            using (StreamWriter writer = new StreamWriter(context.Response.OutputStream))
            {
                writer.WriteLine("<!DOCTYPE html>");

                WriteProgressBar(writer);
            }

            OrgTreeNode root = BuildOguTree(WebUtility.GetRequestQueryString("ou", string.Empty));

            ResponseHideProgressContainerScript();

            using (StreamWriter writer = new StreamWriter(context.Response.OutputStream))
            {
                if (root != null)
                {
                    TreeGraph graph = root.GenerateGraph();
                    graph.WriteHtmlGraph(writer);
                }
            }
        }
Example #2
0
        private static OrgTreeNode PrepareOguTree(SCOrganization organization)
        {
            OrgTreeNode node = new OrgTreeNode(organization);

            ProcessProgress.Current.Increment();
            ProcessProgress.Current.Response(string.Format("已经处理了{0}个组织", ProcessProgress.Current.CurrentStep));

            foreach (SchemaObjectBase obj in organization.CurrentChildren)
            {
                if (obj is SCOrganization)
                {
                    ProcessProgress.Current.MaxStep += 1;
                    node.Children.Add(PrepareOguTree((SCOrganization)obj));
                }
            }

            return(node);
        }
Example #3
0
        private static OrgTreeNode BuildOguTree(string ouID)
        {
            OrgTreeNode result = null;

            if (ouID.IsNotEmpty())
            {
                ProcessProgress.Current.MaxStep += 1;

                SCOrganization root = (SCOrganization)SchemaObjectAdapter.Instance.Load(ouID, TimePointContext.Current.SimulatedTime);

                if (root != null)
                {
                    result = PrepareOguTree(root);
                }
            }

            return(result);
        }