Ejemplo n.º 1
0
        public ActionResult GetTreeData(string keyValue)
        {
            var data = courseChapterApp.GetChapterList("-1", keyValue);
            List <TreeDataModel> treelist = new List <TreeDataModel>();

            foreach (var item in data)
            {
                TreeDataModel treemodel = new TreeDataModel();

                bool hasChildren = data.Count(t => t.PID == item.ID) == 0 ? false : true;
                if (hasChildren)
                {
                    treemodel.name = item.ChapterName;
                    treemodel.code = item.ID;
                    treemodel.icon = "icon-th";
                    List <ChildDataModel> childlist = new List <ChildDataModel>();
                    var childdatas = courseChapterApp.GetChapterList(item.ID);
                    foreach (var key in childdatas)
                    {
                        ChildDataModel childmodel = new ChildDataModel();
                        childmodel.name       = key.ChapterName;
                        childmodel.code       = key.ID;
                        childmodel.icon       = "icon-minus-sign";
                        childmodel.parentCode = key.PID;
                        childmodel.child      = null;
                        childlist.Add(childmodel);
                    }
                    treemodel.child = childlist;
                    treelist.Add(treemodel);
                }
            }
            var a = treelist.ToJson();

            return(Content(treelist.ToJson()));
        }
Ejemplo n.º 2
0
        public override void childPaint(System.Drawing.Graphics g, Model.DataModel Data, System.Drawing.Pen linePen, System.Drawing.Brush lineBrush, System.Drawing.Brush TextBrush, System.Drawing.Brush DataBrush, System.Drawing.Font font_Text, System.Drawing.Font font_Data)
        {
            if (isFirst)
            {
                oldColor = linePen.Color;
                isFirst  = false;
            }
            if (Data != null)
            {
                ///建议把绘制的直接写在这里
                if (Data.Area.IsMouseIn)
                {
                    linePen.Color = ReportViewUtils.perferRed;
                }
                else
                {
                    linePen.Color = oldColor;
                }
                ChildDataModel data = Data as ChildDataModel;
                //圆点的大小
                int        startX      = data.Area.left;
                int        startY      = data.Area.top;
                int        width       = data.Area.right - startX;
                int        height      = data.Area.bottom - startY;
                int        CircleRaius = 10;
                SolidBrush sbrush1     = new SolidBrush(Color.FromArgb(150, 1, 77, 103));
                SolidBrush sf          = new SolidBrush(linePen.Color);
                Rectangle  rect        = new Rectangle(startX, startY, width, height);
                float      realAngle   = 360 * data.mainData * 1.0f / MaxNum;
                //顺时针绘制
                float startAngle = 360 - realAngle;
                g.DrawArc(linePen, rect, startAngle, realAngle);
                //绘制圆弧内的字体
                ReportViewUtils.drawStringWithLimiteText(g, LocationModel.Location_Down, data.mainText, font_Text, TextBrush, startX, startY, width, height / 2, 5);
                //绘制圆弧内的数据
                ReportViewUtils.drawStringWithLimiteText(g, LocationModel.Location_Up, data.mainData + "", font_Data, DataBrush, startX, startY + height / 2, width, height / 2, 5);

                //绘制圆弧外的字体
                Rectangle    Arc_Out = new Rectangle(startX, startY + height + height / 2, width, 30);
                GraphicsPath path    = ReportViewUtils.CreateRoundedRectanglePath(Arc_Out, 15);
                g.FillPath(sbrush1, path);
                path.Dispose();
                ReportViewUtils.drawStringWithLimiteText(g, LocationModel.Location_Center, data.childText + "" + data.childData, font_Data, DataBrush, startX, startY + height + height / 2, width, 30, 8);


                //定位圆点
                int       y           = (int)(Math.Sin(startAngle / 180 * Math.PI) * width / 2);
                int       x           = (int)(Math.Cos(startAngle / 180 * Math.PI) * height / 2);
                Rectangle rect_Circle = new Rectangle(startX + width / 2 - CircleRaius / 2 + x, startY + height / 2 - CircleRaius / 2 + y, CircleRaius, CircleRaius);
                //绘制圆点
                g.FillEllipse(sf, rect_Circle);

                sf.Dispose();
                sbrush1.Dispose();
            }
        }
Ejemplo n.º 3
0
        public override void childPaint(System.Drawing.Graphics g, Model.DataModel Data, System.Drawing.Pen linePen, System.Drawing.Brush lineBrush, System.Drawing.Brush TextBrush, System.Drawing.Brush DataBrush, System.Drawing.Font font_Text, System.Drawing.Font font_Data)
        {
            if (isFirst)
            {
                oldColor = linePen.Color;
                isFirst  = false;
            }
            if (Data != null)
            {
                ///建议把绘制的直接写在这里
                if (Data.Area.IsMouseIn)
                {
                    linePen.Color = ReportViewUtils.perferRed;
                }
                else
                {
                    linePen.Color = oldColor;
                }
                ChildDataModel data = (ChildDataModel)Data;
                utils.drawReportView(g, RePortViewStyle.Arc_rectangle, Data.Area.left, Data.Area.top, Data.Area.right - Data.Area.left, Data.Area.bottom - Data.Area.top, linePen.Color, Data.mainText, Data.mainData, 200, data.childText, data.childData, 10, 16);
                int startX = Data.Area.left;

                //圆点的大小
                //int CircleRaius = 10;
                //SolidBrush sbrush1 = new SolidBrush(Color.FromArgb(150, 1, 77, 103));
                //Rectangle rect = new Rectangle(startX, startY, width, height);
                //float realAngle = 360 * Data_InArc * 1.0f / Data_InArc_Max;
                ////顺时针绘制
                //float startAngle = 360 - realAngle;
                //g.DrawArc(myPen, rect, startAngle, realAngle);
                ////绘制圆弧内的字体
                //g.DrawString(Text_InArc, font_Text, myBrush, (width - TextSize * (Text_InArc.Length + 2)) / 2 + startX, height / 2 - 2 * padding + startY);
                ////绘制圆弧内的数据
                //g.DrawString(Data_InArc + "", font_Data, DataBrush, (width - DataSize * (Data_InArc.ToString().Length)) / 2 + startX, height / 2 + padding + startY);

                ////绘制圆弧外的字体
                //Rectangle Arc_Out = new Rectangle(startX, startY + height + 4 * padding / 3, width, 30);
                //g.FillEllipse(sbrush1, Arc_Out);
                //g.DrawString(Text_OutArc + Data_OutArc + "%", font_Text, TextBrush, (width - TextSize * (Text_InArc.Length + Data_OutArc.ToString().Length + 3)) / 2 + startX, height + 2 * padding + startY);


                ////定位圆点
                //int y = (int)(Math.Sin(startAngle / 180 * Math.PI) * width / 2);
                //int x = (int)(Math.Cos(startAngle / 180 * Math.PI) * width / 2);
                //Rectangle rect_Circle = new Rectangle(startX + width / 2 - CircleRaius / 2 + x, startY + height / 2 - CircleRaius / 2 + y, CircleRaius, CircleRaius);
                ////绘制圆点
                //g.FillEllipse(myBrush, rect_Circle);

                //sbrush1.Dispose();
            }
        }
Ejemplo n.º 4
0
 /// <inheritdoc />
 protected override void InitCommands()
 {
     base.InitCommands();
     TraceMethodName();
     RebindCommand  = new RelayCommand(
         () => Data = new ChildDataModel
     {
         Firstname = "First",
         Lastname  = "Last",
         Age       = 20
     });
     OkCommand     = new RelayCommand(() => ShowMessageBox("OK"), () => IsOk);
     CancelCommand = new RelayCommand(CloseWindow);
 }