public async Task <ActionResult> Events(string id, string ComputerName = "", string UserName = "") { if (id == null) { throw new HttpException((int)HttpStatusCode.BadRequest, "Missing PoolName"); } var stats = await Svc.GetPoolSummaryAsync(PoolName : id); if (stats == null) { throw new HttpException((int)HttpStatusCode.NotFound, "PoolName was Not found"); } var Events = await Svc.GetEventsAsync(PoolName : id); if (!String.IsNullOrEmpty(ComputerName)) { Events = Events.Where(e => e.ComputerName.Equals(ComputerName, StringComparison.InvariantCultureIgnoreCase)); } if (!String.IsNullOrEmpty(UserName)) { Events = Events.Where(e => e.UserName.Equals(UserName, StringComparison.InvariantCultureIgnoreCase)); } ViewBag.CurrentPool = id; ViewBag.Available = stats.PoolAvailable; ViewBag.Total = stats.PoolCount; ViewBag.InUse = stats.PoolInUse; return(View(Events.OrderByDescending(e => e.DtStamp).Take(Properties.Settings.Default.DashboardMaxEvents))); }
public async Task <ActionResult> DownloadScripts(FormCollection from) { String PoolName = (String)TempData["id"]; if (PoolName == null) { throw new HttpException((int)HttpStatusCode.BadRequest, "Missing PoolName"); } var stats = await Svc.GetPoolSummaryAsync(PoolName : PoolName); if (stats == null) { throw new HttpException((int)HttpStatusCode.NotFound, "PoolName was Not found"); } var buff = String.Format(Properties.Settings.Default.RemoteLabSettingsFileContent, String.Format("{0};{1}", "Provider=sqloledb", this.Svc.DatbaseConnectionString()), stats.RemoteAdminUser, PoolName); var contentType = "text/plain"; Response.AddHeader("Content-Disposition", "attachment; filename=RemoteLabSettings.vbs"); return(Content(buff, contentType, System.Text.Encoding.UTF8)); }
public async Task <ActionResult> DownloadEvents([Bind(Include = "PoolName,StartDate,EndDate,Format")] DownloadEventsViewModel devm) { if (devm.PoolName == null) { throw new HttpException((int)HttpStatusCode.BadRequest, "Missing PoolName"); } var stats = await Svc.GetPoolSummaryAsync(devm.PoolName); if (stats == null) { throw new HttpException((int)HttpStatusCode.NotFound, "PoolName was Not found"); } var downloadEvents = await this.Svc.GetEventsAsync(devm.PoolName, devm.StartDate, devm.EndDate); var buff = this.Svc.EventsToCsv(downloadEvents); var contentType = "text/csv"; var fileName = String.Format("events-{0}-{1:yyyyMMdd}-{2:yyyyMMdd}.csv", devm.PoolName, devm.StartDate, devm.EndDate); Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); return(Content(buff, contentType, System.Text.Encoding.UTF8)); }
public async Task <ActionResult> DownloadEvents(string id) { if (id == null) { throw new HttpException((int)HttpStatusCode.BadRequest, "Missing PoolName"); } TempData["id"] = id; var stats = await Svc.GetPoolSummaryAsync(PoolName : id); if (stats == null) { throw new HttpException((int)HttpStatusCode.NotFound, "PoolName was Not found"); } ViewBag.CurrentPool = id; ViewBag.Available = stats.PoolAvailable; ViewBag.Total = stats.PoolCount; ViewBag.InUse = stats.PoolInUse; return(View()); }
public async Task <ActionResult> Dashboard(string id) { if (id == null) { throw new HttpException((int)HttpStatusCode.BadRequest, "Missing PoolName"); } var stats = await Svc.GetPoolSummaryAsync(PoolName : id); if (stats == null) { throw new HttpException((int)HttpStatusCode.NotFound, "PoolName was Not found"); } var Computers = await Svc.GetComputersByPoolNameAsync(PoolName : id); ViewBag.CurrentPool = id; ViewBag.Available = stats.PoolAvailable; ViewBag.Total = stats.PoolCount; ViewBag.InUse = stats.PoolInUse; return(View(Computers.OrderBy(c => c.ComputerName))); }