public ActionResult GetCSVData(String ChartSeriesType, String masterHostIP, int masterPort,
            int fromDateYear,
            int fromDateMonth,
            int fromDateDay,
            int fromTimeHour,
            int fromDateMin,
            int toDateYear,
            int toDateMonth,
            int toDateDay,
            int toTimeHour,
            int toDateMin)
        {
            String username = "******";
            String password = "";

            global::Aneka.Entity.ServiceAddress serviceAddress = new global::Aneka.Entity.ServiceAddress(ContainersManagement.GetContainerUri(masterHostIP, masterPort), "ReportingService");
            global::Aneka.Security.UserCredentials userCredentials = new global::Aneka.Security.UserCredentials(username, password);
            ResourceUtilizationManagement resourceUtilizationManagement = new Logic.Reporting.ResourceUtilizationManagement(serviceAddress, userCredentials);

            DateTime fromDate = new DateTime(fromDateYear, fromDateMonth, fromDateDay, fromTimeHour, fromDateMin,0);
            DateTime toDate = new DateTime(toDateYear, toDateMonth, toDateDay, toTimeHour, toDateMin, 0);
            CloudWebPortal.Logic.Reporting.Helpers.PeriodSelection periodSelection = new Logic.Reporting.Helpers.PeriodSelection(fromDate, toDate);

            String csv = String.Empty;
            if (ChartSeriesType == "Summary")
            {
                resourceUtilizationManagement.QueryPerformanceData(periodSelection);
                List<DateTime> abscissaData = resourceUtilizationManagement.abscissaData;

                List<double> ordinateData = resourceUtilizationManagement.ordinateData;
                Dictionary<DateTime, double> Data = new Dictionary<DateTime, double>();
                for (int i = 0; i < abscissaData.Count; i++)
                    Data.Add(abscissaData[i], ordinateData[i]);

                csv = "Cloud Overview Utilization";
                foreach (var d in Data)
                {
                    csv += "," + d.Key.Year + "-" + d.Key.Month + "-" + d.Key.Day + "-" + d.Key.Hour + "-" + d.Key.Minute + "-" + d.Key.Second + "-" + d.Key.Millisecond
                    + "," + d.Value;
                }
            }
            if (ChartSeriesType == "Detailed")
            {
                resourceUtilizationManagement.QueryPerformanceData_Nodes(periodSelection);
                List<DateTime> abscissaData = resourceUtilizationManagement.abscissaData;

                IDictionary<String, List<double>> ordinateDataForNodes = resourceUtilizationManagement.ordinateDataForNodes;
                foreach (var aNode in ordinateDataForNodes)
                {
                    List<double> ordinateData = aNode.Value;
                    Dictionary<DateTime, double> Data = new Dictionary<DateTime, double>();
                    for (int i = 0; i < abscissaData.Count; i++)
                        Data.Add(abscissaData[i], ordinateData[i]);

                    if (csv != String.Empty)
                        csv += "\n";
                    csv += aNode.Key;
                    foreach (var d in Data)
                    {
                        csv += "," + d.Key.Year + "-" + d.Key.Month + "-" + d.Key.Day + "-" + d.Key.Hour + "-" + d.Key.Minute + "-" + d.Key.Second + "-" + d.Key.Millisecond
                        + "," + d.Value;
                    }
                }
            }

            return Content(csv);
        }
 public ApplicationManagement(String username, String password, String masterHostIP, int masterPortNumber)
 {
     credentials = new UserCredentials(username, password);
     serviceAddress = new global::Aneka.Entity.ServiceAddress(ContainersManagement.GetContainerUri(masterHostIP, masterPortNumber), "AccountingService");
 }