Feature: AD Update Last Network Logon Date
Ability to run this task on-demand from the web UI is added
This commit is contained in:
+261
-293
@@ -1,293 +1,261 @@
|
|||||||
using Disco.Data.Repository;
|
using Disco.Data.Repository;
|
||||||
using Disco.Services.Logging;
|
using Disco.Services.Logging;
|
||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.DirectoryServices;
|
using System.DirectoryServices;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Disco.Services.Tasks;
|
using Disco.Services.Tasks;
|
||||||
namespace Disco.BI.Interop.ActiveDirectory
|
namespace Disco.BI.Interop.ActiveDirectory
|
||||||
{
|
{
|
||||||
public class ActiveDirectoryUpdateLastNetworkLogonDateJob : ScheduledTask
|
public class ActiveDirectoryUpdateLastNetworkLogonDateJob : ScheduledTask
|
||||||
{
|
{
|
||||||
|
|
||||||
public override string TaskName { get { return "Active Directory - Update Last Network Logon Dates Task"; } }
|
public override string TaskName { get { return "Active Directory - Update Last Network Logon Dates Task"; } }
|
||||||
public override bool SingleInstanceTask { get { return true; } }
|
public override bool SingleInstanceTask { get { return true; } }
|
||||||
public override bool CancelInitiallySupported { get { return false; } }
|
public override bool CancelInitiallySupported { get { return false; } }
|
||||||
|
|
||||||
public override void InitalizeScheduledTask(DiscoDataContext dbContext)
|
public override void InitalizeScheduledTask(DiscoDataContext dbContext)
|
||||||
{
|
{
|
||||||
// ActiveDirectoryUpdateLastNetworkLogonDateJob @ 11:30pm
|
// ActiveDirectoryUpdateLastNetworkLogonDateJob @ 11:30pm
|
||||||
TriggerBuilder triggerBuilder = TriggerBuilder.Create().
|
TriggerBuilder triggerBuilder = TriggerBuilder.Create().
|
||||||
WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(23, 30));
|
WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(23, 30));
|
||||||
|
|
||||||
this.ScheduleTask(triggerBuilder);
|
this.ScheduleTask(triggerBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ExecuteTask()
|
protected override void ExecuteTask()
|
||||||
{
|
{
|
||||||
int changeCount;
|
int changeCount;
|
||||||
|
|
||||||
this.Status.UpdateStatus(1, "Starting", "Connecting to the Database and initializing the environment");
|
this.Status.UpdateStatus(1, "Starting", "Connecting to the Database and initializing the environment");
|
||||||
using (DiscoDataContext dbContext = new DiscoDataContext())
|
using (DiscoDataContext dbContext = new DiscoDataContext())
|
||||||
{
|
{
|
||||||
UpdateLastNetworkLogonDates(dbContext, this.Status);
|
UpdateLastNetworkLogonDates(dbContext, this.Status);
|
||||||
this.Status.UpdateStatus(95, "Updating Database", "Writing last network logon dates to the Database");
|
this.Status.UpdateStatus(95, "Updating Database", "Writing last network logon dates to the Database");
|
||||||
changeCount = dbContext.SaveChanges();
|
changeCount = dbContext.SaveChanges();
|
||||||
this.Status.UpdateStatus(100, "Finished", string.Format("{0} Device last network logon dates updated", changeCount));
|
this.Status.Finished(string.Format("{0} Device last network logon dates updated", changeCount), "/Config/SystemConfig");
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemLog.LogInformation(new string[]
|
SystemLog.LogInformation(new string[]
|
||||||
{
|
{
|
||||||
"Updated LastNetworkLogon Device Property for Device/s",
|
"Updated LastNetworkLogon Device Property for Device/s",
|
||||||
changeCount.ToString()
|
changeCount.ToString()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//public void InitalizeScheduledTask(DiscoDataContext dbContext, IScheduler Scheduler)
|
public static ScheduledTaskStatus ScheduleImmediately()
|
||||||
//{
|
{
|
||||||
// // UpdateLastNetworkLogonDates @ 11:30pm
|
var existingTask = ScheduledTasks.GetTaskStatuses(typeof(ActiveDirectoryUpdateLastNetworkLogonDateJob)).Where(s => s.IsRunning).FirstOrDefault();
|
||||||
// IJobDetail jobDetail = new JobDetailImpl("UpdateLastNetworkLogonDates", typeof(ActiveDirectoryUpdateLastNetworkLogonDateJob));
|
if (existingTask != null)
|
||||||
// ITrigger trigger = TriggerBuilder.Create().
|
return existingTask;
|
||||||
// WithIdentity("UpdateLastNetworkLogonDatesTrigger").
|
|
||||||
// StartNow().
|
var instance = new ActiveDirectoryUpdateLastNetworkLogonDateJob();
|
||||||
// WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(23, 30)).
|
return instance.ScheduleTask();
|
||||||
// Build();
|
}
|
||||||
// Scheduler.ScheduleJob(jobDetail, trigger);
|
|
||||||
//}
|
public static bool UpdateLastNetworkLogonDate(Device Device)
|
||||||
|
{
|
||||||
//void IJob.Execute(IJobExecutionContext context)
|
System.DateTime? computerLastLogonDate = Device.LastNetworkLogonDate;
|
||||||
//{
|
if (!string.IsNullOrEmpty(Device.ComputerName))
|
||||||
// DiscoDataContext dbContext = new DiscoDataContext();
|
{
|
||||||
// try
|
foreach (var dcName in ActiveDirectoryHelpers.DefaultDomainDCNames)
|
||||||
// {
|
{
|
||||||
// ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateLastNetworkLogonDates(dbContext);
|
try
|
||||||
// int changeCount = dbContext.SaveChanges();
|
{
|
||||||
// SystemLog.LogInformation(new string[]
|
Ping p = new Ping();
|
||||||
// {
|
PingReply pr;
|
||||||
// "Updated LastNetworkLogon Device Property for Device/s",
|
try
|
||||||
// changeCount.ToString()
|
{
|
||||||
// });
|
pr = p.Send(dcName, 500);
|
||||||
// }
|
}
|
||||||
// catch (System.Exception ex)
|
finally
|
||||||
// {
|
{
|
||||||
// SystemLog.LogException("ActiveDirectoryUpdateLastNetworkLogonDateJob", ex);
|
if (p != null)
|
||||||
// }
|
{
|
||||||
// finally
|
((System.IDisposable)p).Dispose();
|
||||||
// {
|
}
|
||||||
// bool flag = dbContext != null;
|
}
|
||||||
// if (flag)
|
if (pr.Status == IPStatus.Success)
|
||||||
// {
|
{
|
||||||
// ((System.IDisposable)dbContext).Dispose();
|
using (DirectoryEntry dRootEntry = ActiveDirectoryHelpers.DefaultDCLdapRoot(dcName))
|
||||||
// }
|
{
|
||||||
// }
|
DirectorySearcher dSearcher = new DirectorySearcher(dRootEntry, string.Format("(&(objectClass=computer)(sAMAccountName={0}$))", ActiveDirectoryHelpers.EscapeLdapQuery(Device.ComputerName)), new string[]
|
||||||
//}
|
{
|
||||||
public static bool UpdateLastNetworkLogonDate(Device Device)
|
"lastLogon"
|
||||||
{
|
}, SearchScope.Subtree);
|
||||||
System.DateTime? computerLastLogonDate = Device.LastNetworkLogonDate;
|
SearchResult dResult = dSearcher.FindOne();
|
||||||
if (!string.IsNullOrEmpty(Device.ComputerName))
|
if (dResult != null)
|
||||||
{
|
{
|
||||||
foreach (var dcName in ActiveDirectoryHelpers.DefaultDomainDCNames)
|
ResultPropertyValueCollection dProp = dResult.Properties["lastLogon"];
|
||||||
{
|
if (dProp != null && dProp.Count > 0)
|
||||||
try
|
{
|
||||||
{
|
long lastLogonInt = (long)dProp[0];
|
||||||
Ping p = new Ping();
|
if (lastLogonInt > 0L)
|
||||||
PingReply pr;
|
{
|
||||||
try
|
System.DateTime computerNameDate = System.DateTime.FromFileTime(lastLogonInt);
|
||||||
{
|
if (computerLastLogonDate.HasValue)
|
||||||
pr = p.Send(dcName, 500);
|
{
|
||||||
}
|
if (System.DateTime.Compare(computerLastLogonDate.Value, computerNameDate) < 0)
|
||||||
finally
|
{
|
||||||
{
|
computerLastLogonDate = computerNameDate;
|
||||||
if (p != null)
|
}
|
||||||
{
|
}
|
||||||
((System.IDisposable)p).Dispose();
|
else
|
||||||
}
|
{
|
||||||
}
|
computerLastLogonDate = computerNameDate;
|
||||||
if (pr.Status == IPStatus.Success)
|
}
|
||||||
{
|
}
|
||||||
using (DirectoryEntry dRootEntry = ActiveDirectoryHelpers.DefaultDCLdapRoot(dcName))
|
}
|
||||||
{
|
}
|
||||||
DirectorySearcher dSearcher = new DirectorySearcher(dRootEntry, string.Format("(&(objectClass=computer)(sAMAccountName={0}$))", ActiveDirectoryHelpers.EscapeLdapQuery(Device.ComputerName)), new string[]
|
|
||||||
{
|
}
|
||||||
"lastLogon"
|
}
|
||||||
}, SearchScope.Subtree);
|
else
|
||||||
SearchResult dResult = dSearcher.FindOne();
|
{
|
||||||
if (dResult != null)
|
SystemLog.LogError(new string[]
|
||||||
{
|
{
|
||||||
ResultPropertyValueCollection dProp = dResult.Properties["lastLogon"];
|
string.Format("Unable to ping Domain Controller: '{0}' (ref: Disco.BI.Interop.ActiveDirectory.ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateDeviceLastNetworkLogonDate)", dcName)
|
||||||
if (dProp != null && dProp.Count > 0)
|
});
|
||||||
{
|
}
|
||||||
long lastLogonInt = (long)dProp[0];
|
}
|
||||||
if (lastLogonInt > 0L)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
System.DateTime computerNameDate = System.DateTime.FromFileTime(lastLogonInt);
|
SystemLog.LogException("UpdateDeviceLastNetworkLogonDate", ex);
|
||||||
if (computerLastLogonDate.HasValue)
|
}
|
||||||
{
|
}
|
||||||
if (System.DateTime.Compare(computerLastLogonDate.Value, computerNameDate) < 0)
|
}
|
||||||
{
|
bool UpdateLastNetworkLogonDate;
|
||||||
computerLastLogonDate = computerNameDate;
|
if (computerLastLogonDate.HasValue)
|
||||||
}
|
{
|
||||||
}
|
if (!Device.LastNetworkLogonDate.HasValue)
|
||||||
else
|
{
|
||||||
{
|
Device.LastNetworkLogonDate = computerLastLogonDate;
|
||||||
computerLastLogonDate = computerNameDate;
|
UpdateLastNetworkLogonDate = true;
|
||||||
}
|
return UpdateLastNetworkLogonDate;
|
||||||
}
|
}
|
||||||
}
|
if (System.DateTime.Compare(computerLastLogonDate.Value, Device.LastNetworkLogonDate.Value) > 0)
|
||||||
}
|
{
|
||||||
|
Device.LastNetworkLogonDate = computerLastLogonDate;
|
||||||
}
|
UpdateLastNetworkLogonDate = true;
|
||||||
}
|
return UpdateLastNetworkLogonDate;
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
SystemLog.LogError(new string[]
|
UpdateLastNetworkLogonDate = false;
|
||||||
{
|
return UpdateLastNetworkLogonDate;
|
||||||
string.Format("Unable to ping Domain Controller: '{0}' (ref: Disco.BI.Interop.ActiveDirectory.ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateDeviceLastNetworkLogonDate)", dcName)
|
}
|
||||||
});
|
private static void UpdateLastNetworkLogonDates(DiscoDataContext context, ScheduledTaskStatus status)
|
||||||
}
|
{
|
||||||
}
|
System.Collections.Generic.Dictionary<string, System.DateTime> computerLastLogonDates = new System.Collections.Generic.Dictionary<string, System.DateTime>();
|
||||||
catch (System.Exception ex)
|
|
||||||
{
|
int progressDCCountTotal = ActiveDirectoryHelpers.DefaultDomainDCNames.Count;
|
||||||
SystemLog.LogException("UpdateDeviceLastNetworkLogonDate", ex);
|
int progressDCCount = 0;
|
||||||
}
|
double progressDCProgress = 0;
|
||||||
}
|
if (progressDCCountTotal > 0)
|
||||||
}
|
progressDCProgress = 90 / progressDCCountTotal;
|
||||||
bool UpdateLastNetworkLogonDate;
|
|
||||||
if (computerLastLogonDate.HasValue)
|
foreach (var dcName in ActiveDirectoryHelpers.DefaultDomainDCNames)
|
||||||
{
|
{
|
||||||
if (!Device.LastNetworkLogonDate.HasValue)
|
try
|
||||||
{
|
{
|
||||||
Device.LastNetworkLogonDate = computerLastLogonDate;
|
PingReply pr;
|
||||||
UpdateLastNetworkLogonDate = true;
|
using (Ping p = new Ping())
|
||||||
return UpdateLastNetworkLogonDate;
|
{
|
||||||
}
|
pr = p.Send(dcName, 2000);
|
||||||
if (System.DateTime.Compare(computerLastLogonDate.Value, Device.LastNetworkLogonDate.Value) > 0)
|
}
|
||||||
{
|
if (pr.Status == IPStatus.Success)
|
||||||
Device.LastNetworkLogonDate = computerLastLogonDate;
|
{
|
||||||
UpdateLastNetworkLogonDate = true;
|
using (DirectoryEntry dRootEntry = ActiveDirectoryHelpers.DefaultDCLdapRoot(dcName))
|
||||||
return UpdateLastNetworkLogonDate;
|
{
|
||||||
}
|
double progressDCStart = 5 + (progressDCCount * progressDCProgress);
|
||||||
}
|
status.UpdateStatus(progressDCStart, string.Format("Querying Domain Controller: {0}", dcName), "Searching...");
|
||||||
UpdateLastNetworkLogonDate = false;
|
|
||||||
return UpdateLastNetworkLogonDate;
|
using (DirectorySearcher dSearcher = new DirectorySearcher(dRootEntry, "(objectClass=computer)", new string[] { "sAMAccountName", "lastLogon" }, SearchScope.Subtree))
|
||||||
}
|
{
|
||||||
public static void UpdateLastNetworkLogonDates(DiscoDataContext context, ScheduledTaskStatus status = null)
|
using (SearchResultCollection dResults = dSearcher.FindAll())
|
||||||
{
|
{
|
||||||
System.Collections.Generic.Dictionary<string, System.DateTime> computerLastLogonDates = new System.Collections.Generic.Dictionary<string, System.DateTime>();
|
|
||||||
|
int progressItemCount = 0;
|
||||||
int progressDCCountTotal = ActiveDirectoryHelpers.DefaultDomainDCNames.Count;
|
double progressItemProgress = dResults.Count == 0 ? 0 : (progressDCProgress / dResults.Count);
|
||||||
int progressDCCount = 0;
|
|
||||||
double progressDCProgress = 0;
|
foreach (SearchResult dResult in dResults)
|
||||||
if (progressDCCountTotal > 0)
|
{
|
||||||
progressDCProgress = 90 / progressDCCountTotal;
|
ResultPropertyValueCollection dProp = dResult.Properties["sAMAccountName"];
|
||||||
|
if (dProp != null && dProp.Count > 0)
|
||||||
foreach (var dcName in ActiveDirectoryHelpers.DefaultDomainDCNames)
|
{
|
||||||
{
|
string computerName = ((string)dProp[0]).TrimEnd(new char[] { '$' }).ToUpper();
|
||||||
try
|
|
||||||
{
|
if (progressItemCount % 150 == 0) // Only Update Status every 150 devices
|
||||||
PingReply pr;
|
status.UpdateStatus(progressDCStart + (progressItemProgress * progressItemCount), string.Format("Analysing Device: {0}", computerName));
|
||||||
using (Ping p = new Ping())
|
|
||||||
{
|
dProp = dResult.Properties["lastLogon"];
|
||||||
pr = p.Send(dcName, 2000);
|
if (dProp != null && dProp.Count > 0)
|
||||||
}
|
{
|
||||||
if (pr.Status == IPStatus.Success)
|
long lastLogonInt = (long)dProp[0];
|
||||||
{
|
if (lastLogonInt > 0L)
|
||||||
using (DirectoryEntry dRootEntry = ActiveDirectoryHelpers.DefaultDCLdapRoot(dcName))
|
{
|
||||||
{
|
System.DateTime computerNameDate = System.DateTime.FromFileTime(lastLogonInt);
|
||||||
double progressDCStart = 5 + (progressDCCount * progressDCProgress);
|
System.DateTime existingDate;
|
||||||
if (status != null)
|
if (computerLastLogonDates.TryGetValue(computerName, out existingDate))
|
||||||
{
|
{
|
||||||
status.UpdateStatus(progressDCStart, string.Format("Querying Domain Controller: {0}", dcName), "Searching...");
|
if (System.DateTime.Compare(existingDate, computerNameDate) < 0)
|
||||||
}
|
{
|
||||||
|
computerLastLogonDates[computerName] = computerNameDate;
|
||||||
using (DirectorySearcher dSearcher = new DirectorySearcher(dRootEntry, "(objectClass=computer)", new string[] { "sAMAccountName", "lastLogon" }, SearchScope.Subtree))
|
}
|
||||||
{
|
}
|
||||||
using (SearchResultCollection dResults = dSearcher.FindAll())
|
else
|
||||||
{
|
{
|
||||||
|
computerLastLogonDates[computerName] = computerNameDate;
|
||||||
int progressItemCount = 0;
|
}
|
||||||
double progressItemProgress = dResults.Count == 0 ? 0 : (progressDCProgress / dResults.Count);
|
}
|
||||||
|
}
|
||||||
foreach (SearchResult dResult in dResults)
|
}
|
||||||
{
|
progressItemCount++;
|
||||||
ResultPropertyValueCollection dProp = dResult.Properties["sAMAccountName"];
|
}
|
||||||
if (dProp != null && dProp.Count > 0)
|
}
|
||||||
{
|
}
|
||||||
string computerName = ((string)dProp[0]).TrimEnd(new char[] { '$' }).ToUpper();
|
}
|
||||||
|
}
|
||||||
if (status != null)
|
else
|
||||||
if (progressItemCount % 150 == 0) // Only Update Status every 150 devices
|
{
|
||||||
status.UpdateStatus(progressDCStart + (progressItemProgress * progressItemCount), string.Format("Analysing Device: {0}", computerName));
|
SystemLog.LogError(new string[]
|
||||||
|
{
|
||||||
dProp = dResult.Properties["lastLogon"];
|
string.Format("Unable to ping Domain Controller: '{0}' (ref: Disco.BI.Interop.ActiveDirectory.ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateLastNetworkLogonDates)", dcName)
|
||||||
if (dProp != null && dProp.Count > 0)
|
});
|
||||||
{
|
}
|
||||||
long lastLogonInt = (long)dProp[0];
|
}
|
||||||
if (lastLogonInt > 0L)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
System.DateTime computerNameDate = System.DateTime.FromFileTime(lastLogonInt);
|
SystemLog.LogException("UpdateLastNetworkLogonDates", ex);
|
||||||
System.DateTime existingDate;
|
}
|
||||||
if (computerLastLogonDates.TryGetValue(computerName, out existingDate))
|
progressDCCount++;
|
||||||
{
|
}
|
||||||
if (System.DateTime.Compare(existingDate, computerNameDate) < 0)
|
|
||||||
{
|
|
||||||
computerLastLogonDates[computerName] = computerNameDate;
|
foreach (Device d in context.Devices.Where(device => device.ComputerName != null))
|
||||||
}
|
{
|
||||||
}
|
DateTime computerLastLogonDate;
|
||||||
else
|
if (computerLastLogonDates.TryGetValue(d.ComputerName.ToUpper(), out computerLastLogonDate))
|
||||||
{
|
{
|
||||||
computerLastLogonDates[computerName] = computerNameDate;
|
if (d.LastNetworkLogonDate.HasValue)
|
||||||
}
|
{
|
||||||
}
|
if (System.DateTime.Compare(d.LastNetworkLogonDate.Value, computerLastLogonDate) < 0)
|
||||||
}
|
{
|
||||||
}
|
d.LastNetworkLogonDate = computerLastLogonDate;
|
||||||
progressItemCount++;
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
d.LastNetworkLogonDate = computerLastLogonDate;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
SystemLog.LogError(new string[]
|
}
|
||||||
{
|
}
|
||||||
string.Format("Unable to ping Domain Controller: '{0}' (ref: Disco.BI.Interop.ActiveDirectory.ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateLastNetworkLogonDates)", dcName)
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (System.Exception ex)
|
|
||||||
{
|
|
||||||
SystemLog.LogException("UpdateLastNetworkLogonDates", ex);
|
|
||||||
}
|
|
||||||
progressDCCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach (Device d in context.Devices.Where(device => device.ComputerName != null))
|
|
||||||
{
|
|
||||||
DateTime computerLastLogonDate;
|
|
||||||
if (computerLastLogonDates.TryGetValue(d.ComputerName.ToUpper(), out computerLastLogonDate))
|
|
||||||
{
|
|
||||||
if (d.LastNetworkLogonDate.HasValue)
|
|
||||||
{
|
|
||||||
if (System.DateTime.Compare(d.LastNetworkLogonDate.Value, computerLastLogonDate) < 0)
|
|
||||||
{
|
|
||||||
d.LastNetworkLogonDate = computerLastLogonDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d.LastNetworkLogonDate = computerLastLogonDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,230 +1,220 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Disco.BI;
|
using Disco.BI;
|
||||||
using Disco.BI.Extensions;
|
using Disco.BI.Extensions;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Disco.Services.Tasks;
|
using Disco.Services.Tasks;
|
||||||
using Disco.BI.Interop.ActiveDirectory;
|
using Disco.BI.Interop.ActiveDirectory;
|
||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.API.Controllers
|
namespace Disco.Web.Areas.API.Controllers
|
||||||
{
|
{
|
||||||
public partial class SystemController : dbAdminController
|
public partial class SystemController : dbAdminController
|
||||||
{
|
{
|
||||||
|
|
||||||
public virtual ActionResult UpdateLastNetworkLogonDates()
|
public virtual ActionResult UpdateLastNetworkLogonDates()
|
||||||
{
|
{
|
||||||
//ActiveDirectoryUpdateLastNetworkLogonDateJob updateJob = new ActiveDirectoryUpdateLastNetworkLogonDateJob();
|
var taskStatus = ActiveDirectoryUpdateLastNetworkLogonDateJob.ScheduleImmediately();
|
||||||
|
|
||||||
ActiveDirectoryUpdateLastNetworkLogonDateJob.UpdateLastNetworkLogonDates(dbContext);
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
|
||||||
|
}
|
||||||
var resultCount = dbContext.SaveChanges();
|
|
||||||
|
public virtual ActionResult UpdateAttachmentThumbnails()
|
||||||
var model = new Models.System.UpdateLastNetworkLogonDatesModel()
|
{
|
||||||
{
|
// Device Attachments
|
||||||
Result = "OK",
|
var das = dbContext.DeviceAttachments.Where(da => da.MimeType == "application/pdf");
|
||||||
UpdateCount = resultCount
|
foreach (var da in das)
|
||||||
};
|
{
|
||||||
|
var fileName = da.RepositoryThumbnailFilename(dbContext);
|
||||||
return Json(model, JsonRequestBehavior.AllowGet);
|
if (!System.IO.File.Exists(fileName))
|
||||||
}
|
{
|
||||||
|
da.GenerateThumbnail(dbContext);
|
||||||
public virtual ActionResult UpdateAttachmentThumbnails()
|
}
|
||||||
{
|
}
|
||||||
// Device Attachments
|
|
||||||
var das = dbContext.DeviceAttachments.Where(da => da.MimeType == "application/pdf");
|
// User Attachments
|
||||||
foreach (var da in das)
|
var uas = dbContext.UserAttachments.Where(ua => ua.MimeType == "application/pdf");
|
||||||
{
|
foreach (var ua in uas)
|
||||||
var fileName = da.RepositoryThumbnailFilename(dbContext);
|
{
|
||||||
if (!System.IO.File.Exists(fileName))
|
var fileName = ua.RepositoryThumbnailFilename(dbContext);
|
||||||
{
|
if (!System.IO.File.Exists(fileName))
|
||||||
da.GenerateThumbnail(dbContext);
|
{
|
||||||
}
|
ua.GenerateThumbnail(dbContext);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// User Attachments
|
|
||||||
var uas = dbContext.UserAttachments.Where(ua => ua.MimeType == "application/pdf");
|
// Job Attachments
|
||||||
foreach (var ua in uas)
|
var jas = dbContext.JobAttachments.Where(ja => ja.MimeType == "application/pdf");
|
||||||
{
|
foreach (var ja in jas)
|
||||||
var fileName = ua.RepositoryThumbnailFilename(dbContext);
|
{
|
||||||
if (!System.IO.File.Exists(fileName))
|
var fileName = ja.RepositoryThumbnailFilename(dbContext);
|
||||||
{
|
if (!System.IO.File.Exists(fileName))
|
||||||
ua.GenerateThumbnail(dbContext);
|
{
|
||||||
}
|
ja.GenerateThumbnail(dbContext);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Job Attachments
|
|
||||||
var jas = dbContext.JobAttachments.Where(ja => ja.MimeType == "application/pdf");
|
return Content("Done", "text/text");
|
||||||
foreach (var ja in jas)
|
}
|
||||||
{
|
|
||||||
var fileName = ja.RepositoryThumbnailFilename(dbContext);
|
public virtual ActionResult UpdateCheck()
|
||||||
if (!System.IO.File.Exists(fileName))
|
{
|
||||||
{
|
var ts = Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
|
||||||
ja.GenerateThumbnail(dbContext);
|
ts.SetFinishedUrl(Url.Action(MVC.Config.SystemConfig.Index()));
|
||||||
}
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content("Done", "text/text");
|
#region Organisation
|
||||||
}
|
|
||||||
|
#region Organisation Name
|
||||||
public virtual ActionResult UpdateCheck()
|
public virtual ActionResult UpdateOrganisationName(string OrganisationName, bool redirect = false)
|
||||||
{
|
{
|
||||||
var ts = Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
|
if (string.IsNullOrWhiteSpace(OrganisationName))
|
||||||
ts.SetFinishedUrl(Url.Action(MVC.Config.SystemConfig.Index()));
|
dbContext.DiscoConfiguration.OrganisationName = null;
|
||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId));
|
else
|
||||||
}
|
dbContext.DiscoConfiguration.OrganisationName = OrganisationName;
|
||||||
|
|
||||||
#region Organisation
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
#region Organisation Name
|
DiscoApplication.OrganisationName = dbContext.DiscoConfiguration.OrganisationName;
|
||||||
public virtual ActionResult UpdateOrganisationName(string OrganisationName, bool redirect = false)
|
|
||||||
{
|
if (redirect)
|
||||||
if (string.IsNullOrWhiteSpace(OrganisationName))
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
dbContext.DiscoConfiguration.OrganisationName = null;
|
else
|
||||||
else
|
return Json("OK", JsonRequestBehavior.AllowGet);
|
||||||
dbContext.DiscoConfiguration.OrganisationName = OrganisationName;
|
}
|
||||||
|
#endregion
|
||||||
dbContext.SaveChanges();
|
|
||||||
|
#region Organisation Logo
|
||||||
DiscoApplication.OrganisationName = dbContext.DiscoConfiguration.OrganisationName;
|
[OutputCache(Duration = 31536000, Location = System.Web.UI.OutputCacheLocation.Any, VaryByParam = "*")]
|
||||||
|
public virtual ActionResult OrganisationLogo(int Width = 256, int Height = 256, string v = null)
|
||||||
if (redirect)
|
{
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
if (Width < 1)
|
||||||
else
|
throw new ArgumentOutOfRangeException("Width");
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
if (Height < 1)
|
||||||
}
|
throw new ArgumentOutOfRangeException("Height");
|
||||||
#endregion
|
|
||||||
|
using (Stream logoStream = dbContext.DiscoConfiguration.OrganisationLogo)
|
||||||
#region Organisation Logo
|
{
|
||||||
[OutputCache(Duration = 31536000, Location = System.Web.UI.OutputCacheLocation.Any, VaryByParam = "*")]
|
using (Image logoBitmap = Bitmap.FromStream(logoStream))
|
||||||
public virtual ActionResult OrganisationLogo(int Width = 256, int Height = 256, string v = null)
|
{
|
||||||
{
|
return File(logoBitmap.ResizeImage(Width, Height).SavePng(), "image/png");
|
||||||
if (Width < 1)
|
}
|
||||||
throw new ArgumentOutOfRangeException("Width");
|
}
|
||||||
if (Height < 1)
|
}
|
||||||
throw new ArgumentOutOfRangeException("Height");
|
[HttpPost]
|
||||||
|
public virtual ActionResult OrganisationLogo(bool redirect, HttpPostedFileBase Image, bool? ResetLogo = null)
|
||||||
using (Stream logoStream = dbContext.DiscoConfiguration.OrganisationLogo)
|
{
|
||||||
{
|
if (ResetLogo.HasValue && ResetLogo.Value)
|
||||||
using (Image logoBitmap = Bitmap.FromStream(logoStream))
|
{
|
||||||
{
|
dbContext.DiscoConfiguration.OrganisationLogo = null;
|
||||||
return File(logoBitmap.ResizeImage(Width, Height).SavePng(), "image/png");
|
|
||||||
}
|
if (redirect)
|
||||||
}
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
}
|
else
|
||||||
[HttpPost]
|
return Json("OK", JsonRequestBehavior.AllowGet);
|
||||||
public virtual ActionResult OrganisationLogo(bool redirect, HttpPostedFileBase Image, bool? ResetLogo = null)
|
}
|
||||||
{
|
|
||||||
if (ResetLogo.HasValue && ResetLogo.Value)
|
if (Image != null && Image.ContentLength > 0)
|
||||||
{
|
{
|
||||||
dbContext.DiscoConfiguration.OrganisationLogo = null;
|
if (Image.ContentType.StartsWith("image/", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
if (redirect)
|
dbContext.DiscoConfiguration.OrganisationLogo = Image.InputStream;
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
|
||||||
else
|
if (redirect)
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
}
|
else
|
||||||
|
return Json("OK", JsonRequestBehavior.AllowGet);
|
||||||
if (Image != null && Image.ContentLength > 0)
|
}
|
||||||
{
|
else
|
||||||
if (Image.ContentType.StartsWith("image/", StringComparison.InvariantCultureIgnoreCase))
|
{
|
||||||
{
|
if (redirect)
|
||||||
dbContext.DiscoConfiguration.OrganisationLogo = Image.InputStream;
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
|
else
|
||||||
if (redirect)
|
return Json("Invalid Content Type", JsonRequestBehavior.AllowGet);
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
}
|
||||||
else
|
}
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
if (redirect)
|
||||||
}
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
{
|
return Json("No Image Supplied", JsonRequestBehavior.AllowGet);
|
||||||
if (redirect)
|
}
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
#endregion
|
||||||
else
|
|
||||||
return Json("Invalid Content Type", JsonRequestBehavior.AllowGet);
|
#region Organisation Addresses
|
||||||
}
|
|
||||||
}
|
public virtual ActionResult UpdateOrganisationAddress(Disco.Models.BI.Config.OrganisationAddress organisationAddress, bool redirect = false)
|
||||||
if (redirect)
|
{
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
if (organisationAddress == null)
|
||||||
else
|
{
|
||||||
return Json("No Image Supplied", JsonRequestBehavior.AllowGet);
|
ModelState.AddModelError("Address", "No address was supplied");
|
||||||
}
|
}
|
||||||
#endregion
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
#region Organisation Addresses
|
dbContext.DiscoConfiguration.OrganisationAddresses.SetAddress(organisationAddress);
|
||||||
|
dbContext.SaveChanges();
|
||||||
public virtual ActionResult UpdateOrganisationAddress(Disco.Models.BI.Config.OrganisationAddress organisationAddress, bool redirect = false)
|
if (redirect)
|
||||||
{
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
if (organisationAddress == null)
|
else
|
||||||
{
|
return Json("OK", JsonRequestBehavior.AllowGet);
|
||||||
ModelState.AddModelError("Address", "No address was supplied");
|
}
|
||||||
}
|
else
|
||||||
if (ModelState.IsValid)
|
{
|
||||||
{
|
// Build Error Message
|
||||||
dbContext.DiscoConfiguration.OrganisationAddresses.SetAddress(organisationAddress);
|
var em = new StringBuilder();
|
||||||
dbContext.SaveChanges();
|
em.AppendLine("Error:");
|
||||||
if (redirect)
|
foreach (var item in ModelState)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
{
|
||||||
else
|
foreach (var errorItem in item.Value.Errors)
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
{
|
||||||
}
|
em.Append(item.Key);
|
||||||
else
|
em.Append(": ");
|
||||||
{
|
em.AppendLine(errorItem.ErrorMessage);
|
||||||
// Build Error Message
|
}
|
||||||
var em = new StringBuilder();
|
}
|
||||||
em.AppendLine("Error:");
|
if (redirect)
|
||||||
foreach (var item in ModelState)
|
throw new InvalidOperationException(em.ToString());
|
||||||
{
|
else
|
||||||
foreach (var errorItem in item.Value.Errors)
|
return Json(em.ToString(), JsonRequestBehavior.AllowGet);
|
||||||
{
|
}
|
||||||
em.Append(item.Key);
|
}
|
||||||
em.Append(": ");
|
public virtual ActionResult DeleteOrganisationAddress(int Id, bool redirect = false)
|
||||||
em.AppendLine(errorItem.ErrorMessage);
|
{
|
||||||
}
|
dbContext.DiscoConfiguration.OrganisationAddresses.RemoveAddress(Id);
|
||||||
}
|
dbContext.SaveChanges();
|
||||||
if (redirect)
|
|
||||||
throw new InvalidOperationException(em.ToString());
|
if (redirect)
|
||||||
else
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
return Json(em.ToString(), JsonRequestBehavior.AllowGet);
|
else
|
||||||
}
|
return Json("OK", JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
public virtual ActionResult DeleteOrganisationAddress(int Id, bool redirect = false)
|
|
||||||
{
|
#endregion
|
||||||
dbContext.DiscoConfiguration.OrganisationAddresses.RemoveAddress(Id);
|
|
||||||
dbContext.SaveChanges();
|
#region MultiSiteMode
|
||||||
|
|
||||||
if (redirect)
|
public virtual ActionResult UpdateMultiSiteMode(bool MultiSiteMode, bool redirect = false)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
{
|
||||||
else
|
dbContext.DiscoConfiguration.MultiSiteMode = MultiSiteMode;
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
dbContext.SaveChanges();
|
||||||
|
|
||||||
#endregion
|
DiscoApplication.MultiSiteMode = dbContext.DiscoConfiguration.MultiSiteMode;
|
||||||
|
|
||||||
#region MultiSiteMode
|
if (redirect)
|
||||||
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
public virtual ActionResult UpdateMultiSiteMode(bool MultiSiteMode, bool redirect = false)
|
else
|
||||||
{
|
return Json("OK", JsonRequestBehavior.AllowGet);
|
||||||
dbContext.DiscoConfiguration.MultiSiteMode = MultiSiteMode;
|
}
|
||||||
|
|
||||||
dbContext.SaveChanges();
|
#endregion
|
||||||
|
|
||||||
DiscoApplication.MultiSiteMode = dbContext.DiscoConfiguration.MultiSiteMode;
|
#endregion
|
||||||
|
|
||||||
if (redirect)
|
}
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
}
|
||||||
else
|
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,178 +1,179 @@
|
|||||||
@model Disco.Web.Areas.Config.Models.SystemConfig.IndexModel
|
@model Disco.Web.Areas.Config.Models.SystemConfig.IndexModel
|
||||||
@{
|
@{
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System");
|
||||||
}
|
}
|
||||||
@using (Html.BeginForm())
|
@using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
<div class="form" style="width: 450px">
|
<div class="form" style="width: 450px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Disco Version:
|
<th style="width: 135px">Disco Version:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<code>@Model.DiscoVersion.ToString(4)</code>
|
<code>@Model.DiscoVersion.ToString(4)</code>
|
||||||
</div>
|
</div>
|
||||||
<div class="smallMessage" title="@Model.DiscoVersionBuilt.ToFullDateTime()">
|
<div class="smallMessage" title="@Model.DiscoVersionBuilt.ToFullDateTime()">
|
||||||
Built @Model.DiscoVersionBuilt.ToFuzzy("Unknown")
|
Built @Model.DiscoVersionBuilt.ToFuzzy("Unknown")
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Database Connection:
|
<th style="width: 135px">Database Connection:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<table class="sub">
|
<table class="sub">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Server:</th>
|
<th>Server:</th>
|
||||||
<td><span class="code">@Model.DatabaseServer</span></td>
|
<td><span class="code">@Model.DatabaseServer</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Database:</th>
|
<th>Database:</th>
|
||||||
<td><span class="code">@Model.DatabaseName</span></td>
|
<td><span class="code">@Model.DatabaseName</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Authentication:</th>
|
<th>Authentication:</th>
|
||||||
<td>@Model.DatabaseAuthentication</td>
|
<td>@Model.DatabaseAuthentication</td>
|
||||||
</tr>
|
</tr>
|
||||||
@{if (Model.DatabaseSqlAuthUsername != null)
|
@{if (Model.DatabaseSqlAuthUsername != null)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<th>SQL User:</th>
|
<th>SQL User:</th>
|
||||||
<td><span class="code">@Model.DatabaseSqlAuthUsername</span></td>
|
<td><span class="code">@Model.DatabaseSqlAuthUsername</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Data Store Location:
|
<th style="width: 135px">Data Store Location:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<span class="code">@Model.DataStoreLocation</span>
|
<span class="code">@Model.DataStoreLocation</span>
|
||||||
@* @Html.EditorFor(m => m.DataStoreLocation)<br />
|
@* @Html.EditorFor(m => m.DataStoreLocation)<br />
|
||||||
@Html.ValidationMessageFor(m => m.DataStoreLocation)*@
|
@Html.ValidationMessageFor(m => m.DataStoreLocation)*@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="form" style="width: 450px; margin-top: 15px;">
|
<div class="form" style="width: 450px; margin-top: 15px;">
|
||||||
<h2>Updates</h2>
|
<h2>Updates</h2>
|
||||||
<table>
|
<table>
|
||||||
@{
|
@{
|
||||||
if (Model.UpdateLatestResponse == null)
|
if (Model.UpdateLatestResponse == null)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Last Check:
|
<th style="width: 135px">Last Check:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div class="error"><span class="icon error" style="margin-right: 6px;"></span>Never</div>
|
<div class="error"><span class="icon error" style="margin-right: 6px;"></span>Never</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Last Run:
|
<th style="width: 135px">Last Run:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<span>@CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.ResponseTimestamp)</span>
|
<span>@CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.ResponseTimestamp)</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
if (Model.UpdateLatestResponse.IsUpdatable(typeof(DiscoApplication).Assembly.GetName().Version))
|
if (Model.UpdateLatestResponse.IsUpdatable(typeof(DiscoApplication).Assembly.GetName().Version))
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Update Available:
|
<th style="width: 135px">Update Available:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="icon warning" style="margin-right: 6px;"></span>Version @(Model.UpdateLatestResponse.Version) is available
|
<span class="icon warning" style="margin-right: 6px;"></span>Version @(Model.UpdateLatestResponse.Version) is available
|
||||||
</div>
|
</div>
|
||||||
<div class="smallMessage">
|
<div class="smallMessage">
|
||||||
[Released @(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.VersionReleasedTimestamp))]
|
[Released @(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.VersionReleasedTimestamp))]
|
||||||
</div>
|
</div>
|
||||||
<div class="smallMessage">@(new HtmlString(Model.UpdateLatestResponse.Blurb))</div>
|
<div class="smallMessage">@(new HtmlString(Model.UpdateLatestResponse.Blurb))</div>
|
||||||
<a href="@(Model.UpdateLatestResponse.UrlLink)" target="_blank">Download Now</a>
|
<a href="@(Model.UpdateLatestResponse.UrlLink)" target="_blank">Download Now</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Status:
|
<th style="width: 135px">Status:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<span class="icon success" style="margin-right: 6px;"></span><span>The latest version is installed</span>
|
<span class="icon success" style="margin-right: 6px;"></span><span>The latest version is installed</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Check for Update:@{
|
<th style="width: 135px">Check for Update:@{
|
||||||
if (Model.UpdateBetaDeployment)
|
if (Model.UpdateBetaDeployment)
|
||||||
{
|
{
|
||||||
<div class="alert"><span class="icon warning" style="margin-right: 6px;"></span>Beta Deployment</div>
|
<div class="alert"><span class="icon warning" style="margin-right: 6px;"></span>Beta Deployment</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@{
|
@{
|
||||||
if (Model.UpdateRunningStatus == null)
|
if (Model.UpdateRunningStatus == null)
|
||||||
{
|
{
|
||||||
<div>@Html.ActionLink("Check Now", MVC.API.System.UpdateCheck())</div>
|
<div>@Html.ActionLink("Check Now", MVC.API.System.UpdateCheck())</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div>Running now - @Html.ActionLink("Check Status", MVC.Config.Logging.TaskStatus(Model.UpdateRunningStatus.SessionId))</div>
|
<div>Running now - @Html.ActionLink("Check Status", MVC.Config.Logging.TaskStatus(Model.UpdateRunningStatus.SessionId))</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<div class="smallMessage">
|
<div class="smallMessage">
|
||||||
Next Scheduled: @CommonHelpers.FriendlyDate(Model.UpdateNextScheduled, "Unknown")
|
Next Scheduled: @CommonHelpers.FriendlyDate(Model.UpdateNextScheduled, "Unknown")
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="form" style="width: 450px; margin-top: 15px;">
|
<div class="form" style="width: 450px; margin-top: 15px;">
|
||||||
<h2>Proxy Settings</h2>
|
<h2>Proxy Settings</h2>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Address:
|
<th style="width: 135px">Address:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(m => m.ProxyAddress)<br />
|
@Html.EditorFor(m => m.ProxyAddress)<br />
|
||||||
@Html.ValidationMessageFor(m => m.ProxyAddress)
|
@Html.ValidationMessageFor(m => m.ProxyAddress)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Port:
|
<th style="width: 135px">Port:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(m => m.ProxyPort)<br />
|
@Html.EditorFor(m => m.ProxyPort)<br />
|
||||||
@Html.ValidationMessageFor(m => m.ProxyPort)
|
@Html.ValidationMessageFor(m => m.ProxyPort)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Username:
|
<th style="width: 135px">Username:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(m => m.ProxyUsername)<br />
|
@Html.EditorFor(m => m.ProxyUsername)<br />
|
||||||
@Html.ValidationMessageFor(m => m.ProxyUsername)
|
@Html.ValidationMessageFor(m => m.ProxyUsername)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 135px">Password:
|
<th style="width: 135px">Password:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(m => m.ProxyPassword)<br />
|
@Html.EditorFor(m => m.ProxyPassword)<br />
|
||||||
@Html.ValidationMessageFor(m => m.ProxyPassword)
|
@Html.ValidationMessageFor(m => m.ProxyPassword)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="actionBar">
|
<div class="actionBar">
|
||||||
<input type="submit" class="button" value="Save Configuration" />
|
@Html.ActionLinkButton("Update Device Last Network Logons", MVC.API.System.UpdateLastNetworkLogonDates())
|
||||||
</div>
|
<input type="submit" class="button" value="Save Configuration" />
|
||||||
}
|
</div>
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user