Пример #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int id = Int32.Parse(HttpContext.Current.Request.QueryString.Get(0));

            NPersonalInfo[] personalInfos = NPersonalInfo.CreateCompanyInfo();
            NPersonalInfo   personalInfo  = null;

            // find the personal info by id

            for (int i = 0; i < personalInfos.Length; i++)
            {
                if (personalInfos[i].Id == id)
                {
                    personalInfo = personalInfos[i];
                    break;
                }
            }

            if (personalInfo != null)
            {
                NameLabel.Text         = "This is the personal page of: " + personalInfo.Name;
                PositionLabel.Text     = "Position in company: " + personalInfo.Position;
                BiographyLabel.Text    = "Bigoraphy: " + personalInfo.Biography;
                PersonPicture.ImageUrl = personalInfo.Picture;
            }
        }
        protected void CreateScene()
        {
            // configure title
            NTextShape title = new NTextShape("The Business Company", 0, 0, Document.Width, 60);

            Document.ActiveLayer.AddChild(title);

            NTextStyle textStyle = title.ComposeTextStyle().Clone() as NTextStyle;

            textStyle.FontStyle.InitFromFont(new Font("Arial Black", 22, FontStyle.Bold | FontStyle.Italic));

            // set gradient fill style
            textStyle.FillStyle = new NGradientFillStyle(
                GradientStyle.Horizontal,
                GradientVariant.Variant1,
                Color.FromArgb(241, 100, 34),
                Color.FromArgb(255, 247, 151));

            // add shadow
            textStyle.ShadowStyle = new NShadowStyle(
                ShadowType.GaussianBlur,
                Color.FromArgb(50, 122, 122, 122),
                new Nevron.GraphicsCore.NPointL(5, 5),
                1,
                new NLength(3));

            title.Style.TextStyle = textStyle;

            NPersonalInfo[] personalInfos = NPersonalInfo.CreateCompanyInfo();


            // create an Org chart shape for each person in the Org chart
            NCompositeShape presidentShape = CreateOrgChartShape(personalInfos[0]);

            NCompositeShape vpMarketingShape  = CreateOrgChartShape(personalInfos[1]);
            NCompositeShape vpSalesShape      = CreateOrgChartShape(personalInfos[2]);
            NCompositeShape vpProductionShape = CreateOrgChartShape(personalInfos[3]);

            NCompositeShape mm01Shape = CreateOrgChartShape(personalInfos[4]);
            NCompositeShape mm02Shape = CreateOrgChartShape(personalInfos[5]);

            NCompositeShape sm01Shape = CreateOrgChartShape(personalInfos[6]);
            NCompositeShape sm02Shape = CreateOrgChartShape(personalInfos[7]);

            NCompositeShape pm01Shape = CreateOrgChartShape(personalInfos[8]);
            NCompositeShape pm02Shape = CreateOrgChartShape(personalInfos[9]);

            //	connect the Org chart shapes
            // 1. President to VPs
            NShape ge = null;

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpMarketingShape.Ports.GetChildByName("Top", 0) as NPort);

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpSalesShape.Ports.GetChildByName("Top", 0) as NPort);

            ge = new NStep3Connector(true, 50, 0, true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(presidentShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(vpProductionShape.Ports.GetChildByName("Top", 0) as NPort);

            // 1. VPs to managers
            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpMarketingShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(mm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpMarketingShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(mm02Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpSalesShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(sm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpSalesShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(sm02Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpProductionShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(pm01Shape.Ports.GetChildByName("Left", 0) as NPort);

            ge = new NStep2Connector(true);
            Document.ActiveLayer.AddChild(ge);
            ge.StartPlug.Connect(vpProductionShape.Ports.GetChildByName("Bottom", 0) as NPort);
            ge.EndPlug.Connect(pm02Shape.Ports.GetChildByName("Left", 0) as NPort);
        }