예제 #1
0
        public bool AddVM(VMDetails VMData)
        {

            var FP = VMData.UtilFileLocation;
            var FU = new FileUploader();
            var blob = FU.UploadFileToStorage(FP, true);
            var comm = new MLCommunicator();
            var result = comm.GetUtilDataFromFile(blob);
            var d = result.Result;
            var UtilData = new UtilizationCalculator();
            var UD = UtilData.getUtilPattern(d);

            AddVMInDB(VMData, blob, UD);

            // now we need to insert this data in SQL Azure for the given VM

            foreach (var u in UD)
            {
                Console.WriteLine(u.UtilizationType);
                foreach (var tr in u.TimeRanges)
                {
                    Console.WriteLine("{0}, {1}", tr.StartTime, tr.StopTime);
                }
            }
            //  populateTreeView();
            return true;

            // return Json(true, JsonRequestBehavior.AllowGet);

        }