示例#1
0
        //POST: Ticket Status Chart
        public JsonResult GetTicketStatusChartData()
        {
            var colorList = new List <string>();

            colorList.Add("#3bcc3e");
            colorList.Add("#3b42cc");
            colorList.Add("#f743b2");
            colorList.Add("#9741f2");
            colorList.Add("#3c8dbc");
            colorList.Add("#d2d6de");
            colorList.Add("#4287f5");
            colorList.Add("#e6f542");

            var rand = new Random();

            var pieChartVM = new PieChartVM();
            var statuses   = db.TicketStatus.ToList();

            var dataKey = 0;

            pieChartVM.Data.Add(dataKey);

            foreach (var status in statuses)
            {
                var count = db.Tickets.Where(t => t.TicketStatusId == status.Id).Count();
                count++;

                pieChartVM.Data.Add(count);
                pieChartVM.Labels.Add(status.Name);
                pieChartVM.Colors.Add(colorList[rand.Next(0, colorList.Count)]);
            }

            return(Json(pieChartVM));
        }
示例#2
0
        //POST: Ticket Type Chart
        public JsonResult GetTicketTypeChartData()
        {
            var colorList = new List <string>();

            colorList.Add("#f2453f");
            colorList.Add("#f7c23b");
            colorList.Add("#bde851");
            colorList.Add("#fca63d");
            colorList.Add("#4ee2f2");
            colorList.Add("#4070f5");
            colorList.Add("#b43bff");
            colorList.Add("#fc3d79");

            var rand = new Random();

            var pieChartVM = new PieChartVM();
            var types      = db.TicketTypes.ToList();


            foreach (var type in types)
            {
                var count = db.Tickets.Where(t => t.TicketTypeId == type.Id).Count();
                count++;

                pieChartVM.Data.Add(count);
                pieChartVM.Labels.Add(type.Name);
                pieChartVM.Colors.Add(colorList[rand.Next(0, colorList.Count)]);
            }

            return(Json(pieChartVM));
        }
示例#3
0
        //POST: Ticket Priority Chart
        public JsonResult GetTicketPriorityChartData()
        {
            var colorList = new List <string>();

            colorList.Add("#f56954");
            colorList.Add("#8d3efa");
            colorList.Add("#f39c12");
            colorList.Add("#fa3e47");
            colorList.Add("#3c8dbc");
            colorList.Add("#d2d6de");
            colorList.Add("#03fcf4");
            colorList.Add("#886896");

            var rand = new Random();

            var pieChartVM = new PieChartVM();
            var priorities = db.TicketPriorities.ToList();

            foreach (var priority in priorities)
            {
                var count = db.Tickets.Where(t => t.TicketPriorityId == priority.Id).Count();
                count++;

                pieChartVM.Data.Add(count);
                pieChartVM.Labels.Add(priority.Name);
                pieChartVM.Colors.Add(colorList[rand.Next(0, colorList.Count)]);
            }

            return(Json(pieChartVM));
        }
        public UserControl CreateElement(ReportElementVM element)
        {
            UserControl returningUserControl = null;
            string      type = element.Type;

            if (type.Equals("table"))
            {
                TableUserControl table   = new TableUserControl();
                TableVM          tableVm = new TableVM(element);
                table.DataContext    = tableVm;
                returningUserControl = table;
            }
            else if (type.Equals("linechart"))
            {
                LineChartUserControl lineChart   = new LineChartUserControl();
                LineChartVM          lineChartVm = new LineChartVM(element);
                lineChart.DataContext = lineChartVm;
                returningUserControl  = lineChart;
            }
            else if (type.Equals("piechart"))
            {
                PieChartUserControl pieChart   = new PieChartUserControl();
                PieChartVM          pieChartVm = new PieChartVM(element);
                pieChart.DataContext = pieChartVm;
                returningUserControl = pieChart;
            }
            else if (type.Equals("barchart"))
            {
                BarChartUserControl barChart   = new BarChartUserControl();
                BarChartVM          barChartVm = new BarChartVM(element);
                barChart.DataContext = barChartVm;
                returningUserControl = barChart;
            }
            else if (type.Equals("image"))
            {
                ImageUserControl image   = new ImageUserControl();
                ImageVM          imageVm = new ImageVM(element);
                image.DataContext    = imageVm;
                returningUserControl = image;
            }
            else if (type.Equals("text"))
            {
                TextUserControl text   = new TextUserControl();
                TextVM          textVM = new TextVM(element);
                text.DataContext     = textVM;
                returningUserControl = text;
            }
            return(returningUserControl);
        }
示例#5
0
 public MainPage()
 {
     InitializeComponent();
     BindingContext = new PieChartVM();
 }