// GET: Disks/QueryDiskInformation public ActionResult QueryDiskInformation() { var model = new DiskViewModel(); disksService.GetApps(model); return(View(model)); }
public ActionResult ViewDetails(int coolerId) { var cpus = new DiskViewModel(); cpus = _mapper.Map <DiskDTO, DiskViewModel>(_genericService.GetById(coolerId)); return(View(cpus)); }
public ActionResult QueryDiskInformation([Bind(Include = "ApplicationId,ServerId,FreeSpace,UsedSpace,TotalSpace,DiskName,RunDate")] DiskViewModel model) { if (!ModelState.IsValid) { disksService.GetApps(model); return(View(model)); } // Get DropDown selected value var selectedValue = Request.Form["ApplicationId"].ToString(); var sv = Convert.ToInt32(selectedValue); Session["SelectedApp"] = sv; Session["ServerId"] = disksService.GetServerId(sv); Session["Authority"] = disksService.GetAuthority(Helpers.parameters.ActiveDirectory); Session["Username"] = disksService.GetSuperUsername(Helpers.parameters.ActiveDirectory); Session["Password"] = disksService.GetSuperUserPassword(Helpers.parameters.ActiveDirectory); // Session["ServerIP"] = disksService.GetServerIp(sv); var disk = new Disk(); disksService.SaveEnvironmentInfo(disk); return(RedirectToAction("Index")); }
public static List <DiskViewModel> ToViewModel(this List <Disk> disks) { List <DiskViewModel> viewmodes = new List <DiskViewModel>(); DiskViewModel allDisk = new DiskViewModel(); allDisk.FreeSpace = disks.Sum(d => d.AvailableSpace); allDisk.TotalSpace = disks.Sum(d => d.TotalSpace); allDisk.UsedSpace = allDisk.TotalSpace - allDisk.FreeSpace; allDisk.FreeSpacePercent = (double)allDisk.FreeSpace / allDisk.TotalSpace; allDisk.DatabaseName = "Server"; viewmodes.Add(allDisk); List <IGrouping <long, Disk> > databaseGroup = disks.GroupBy(d => d.DatabaseId).ToList(); foreach (var database in databaseGroup) { DiskViewModel databaseDisk = new DiskViewModel(); databaseDisk.DatabaseName = database.FirstOrDefault()?.DatabaseName; databaseDisk.DriveName = database.FirstOrDefault()?.VolumeMountPoint; databaseDisk.FreeSpace = database.Sum(d => d.AvailableSpace); databaseDisk.TotalSpace = database.Sum(d => d.TotalSpace); databaseDisk.UsedSpace = databaseDisk.TotalSpace - databaseDisk.FreeSpace; databaseDisk.FreeSpacePercent = (double)databaseDisk.FreeSpace / databaseDisk.TotalSpace; viewmodes.Add(databaseDisk); } return(viewmodes); }
public Disk(Frame navigationService, ConnectionService connectionService) { InitializeComponent(); _navigationService = navigationService; _dataContext = new DiskViewModel(connectionService); //to use methods in DiskInfoViewModel outside DataContext = _dataContext; }
public JsonResult Delete(DiskViewModel diskModel) { try { _genericService.Delete(diskModel.ID); return(Json(new { Result = "OK" })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public JsonResult Edit(DiskViewModel diskModel) { try { _genericService.Update(_mapper.Map <DiskViewModel, DiskDTO>(diskModel)); return(Json(new { Result = "OK", Record = diskModel })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public JsonResult Create(DiskViewModel diskModel) { try { var id = _genericService.Save(_mapper.Map <DiskViewModel, DiskDTO>(diskModel)); diskModel.ID = id; return(Json(new { Result = "OK", Record = diskModel })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public ActionResult SICSNT([Bind(Include = "ApplicationId,ServerId,FreeSpace,UsedSpace,TotalSpace,DiskName,RunDate")] DiskViewModel model) { var sv = Helpers.parameters.SICSNT; Session["SelectedApp"] = sv; Session["ServerId"] = disksService.GetServerId(sv); Session["ServerIP"] = disksService.GetServerIp(sv); Session["Authority"] = disksService.GetAuthority(Helpers.parameters.ActiveDirectory); Session["Username"] = disksService.GetSuperUsername(Helpers.parameters.ActiveDirectory); Session["Password"] = disksService.GetSuperUserPassword(Helpers.parameters.ActiveDirectory); var disk = new Disk(); disksService.SaveEnvironmentInfo(disk); return(RedirectToAction("Index")); }
private DashboardViewModel GetDashboardViewModel() { CpuViewModel cpuViewModel = new CpuViewModel { LogicalCpuCores = _informationsService.GetLogicalCpuCores(), PhysicalCpuCores = _informationsService.GetPhysicalCpuCores(), CpuName = _informationsService.GetCpuName(), CpuClockSpeed = _informationsService.GetCpuClockSpeed(), CpuUsage = _informationsService.GetCpuUsage() }; RamViewModel ramViewModel = new RamViewModel { UsedRam = _informationsService.GetUsedRam(), TotalRam = _informationsService.GetTotalRam(), NamesRam = _informationsService.GetNamesRam() }; DiskViewModel diskViewModel = new DiskViewModel { TotalDiskSpace = _informationsService.GetTotalDiskSpace(), UsedDiskSpace = _informationsService.GetUsedDiskSpace(), NamesDisk = _informationsService.GetNamesDisk(), DisksUsage = _informationsService.GetDisksUsage() }; UptimeViewModel uptimeViewModel = new UptimeViewModel { Uptime = _informationsService.GetUptime(), OS = _informationsService.GetOs() }; return(new DashboardViewModel { CpuViewModel = cpuViewModel, RamViewModel = ramViewModel, DiskViewModel = diskViewModel, UptimeViewModel = uptimeViewModel }); }
public void GetApps(DiskViewModel model) { model.Applications = GetApplications(); }