Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public DashboardJson GetDashboardData()
        {

            DashboardJson objDashboardJson = new DashboardJson();
            objDashboardJson.initialZoom = 12;
            int keyid = 1;
            objDashboardJson.Id = keyid;
            var dashboarddatas = this.ObjectContext.usp_GetDashboardData().ToList();
            List<GroupJson> list = new List<GroupJson>();

            int grpid = 0;
            int cellId = 0;

            double initialLat = 42;
            double initialLng = -88;

            double lat;
            double lng;

            GroupJson groupJson = null;
            CellJson cellJson = null;
            List<string> sectors = new List<string>();

            foreach (var dashboardData in dashboarddatas)
            {
                if (grpid == 0)
                {
                    groupJson = CreateGroupJson(dashboardData.GroupId, dashboardData.GroupName, dashboardData.RegionName);
                    cellJson = CreateCellJson(dashboardData.CellId, dashboardData.URL, "red", dashboardData.CellName, dashboardData.Time, dashboardData.Status, dashboardData.CellType);
                    cellJson.duration += dashboardData.Duration;
                    PopulateNodeSectors(dashboardData.CellId, cellJson);
                    if (cellJson.Sectors != null && cellJson.Sectors.Count > 0)
                        cellJson.Sectors[dashboardData.Dsp].Duration = dashboardData.Duration;
                    groupJson.Cells.Add(cellJson);
                    list.Add(groupJson);
                }
                else
                {
                  groupJson = CreateGroupJson(dashboardData.GroupId, dashboardData.GroupName, dashboardData.RegionName);
                  cellJson = CreateCellJson(dashboardData.CellId, dashboardData.URL, "red", dashboardData.CellName, dashboardData.Time, dashboardData.Status, dashboardData.CellType);
                  cellJson.duration += dashboardData.Duration;
                  PopulateNodeSectors(dashboardData.CellId, cellJson);
                  if (cellJson.Sectors != null && cellJson.Sectors.Count > 0)
                  cellJson.Sectors[dashboardData.Dsp].Duration = dashboardData.Duration;
                  groupJson.Cells.Add(cellJson);
                  list.Add(groupJson);
                    
                }

                grpid = dashboardData.GroupId;
                cellId = dashboardData.CellId;
            }
			return objDashboardJson;
		}


C#
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Protools.ViewModels
{
    public class DashViewModel 
    {
        private DashboardContext dashboard = new DashboardContext(); 
    }
}


ASM
Hi

I write code for Create json in Servies(RIA Services) method name as Dashservice.cs. And also create ViewModel class file name as DashViewModel.cs
Now My question is How to pass or call return value (return objDashboardJson) in viewmodel...

Pls Help Me...
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900