Feature: Search Shortcuts !/@/#
!{Device Serial Number} - @{User Id} - #{Job Id}
This commit is contained in:
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
@@ -31,115 +31,189 @@ namespace Disco.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
m.Success = true;
|
m.Success = true;
|
||||||
using (dbContext = new DiscoDataContext())
|
|
||||||
|
// Deal with !/@/# Search Shortcuts
|
||||||
|
if (limit == null && term.Length > 0)
|
||||||
{
|
{
|
||||||
if (limit == null)
|
switch (term[0])
|
||||||
{
|
{
|
||||||
if (term.Length < 2 && termInt < 0) // < 2 Characters && Not a Number
|
case '!':
|
||||||
{
|
term = term.Substring(1);
|
||||||
m.Success = false;
|
limit = "DeviceSerialNumber";
|
||||||
m.ErrorMessage = "A search term of at least two characters is required";
|
break;
|
||||||
return View(m);
|
case '#':
|
||||||
}
|
term = term.Substring(1);
|
||||||
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
|
limit = "JobId";
|
||||||
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
|
if (!int.TryParse(term, out termInt))
|
||||||
m.Users = BI.UserBI.Searching.Search(dbContext, term);
|
termInt = -1;
|
||||||
|
break;
|
||||||
|
case '@':
|
||||||
|
term = term.Substring(1);
|
||||||
|
limit = "UserId";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
if (limit == null)
|
||||||
|
{
|
||||||
|
if (term.Length < 2 && termInt < 0) // < 2 Characters && Not a Number
|
||||||
{
|
{
|
||||||
switch (limit.ToLower())
|
m.Success = false;
|
||||||
{
|
m.ErrorMessage = "A search term of at least two characters is required";
|
||||||
case "devicemodel":
|
return View(m);
|
||||||
int deviceModelId;
|
}
|
||||||
if (int.TryParse(term, out deviceModelId))
|
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
|
||||||
|
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
|
||||||
|
m.Users = BI.UserBI.Searching.Search(dbContext, term);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (limit.ToLower())
|
||||||
|
{
|
||||||
|
case "devicemodel":
|
||||||
|
int deviceModelId;
|
||||||
|
if (int.TryParse(term, out deviceModelId))
|
||||||
|
{
|
||||||
|
var vm = dbContext.DeviceModels.Find(deviceModelId);
|
||||||
|
if (vm != null)
|
||||||
{
|
{
|
||||||
var vm = dbContext.DeviceModels.Find(deviceModelId);
|
m.FriendlyTerm = string.Format("Device Model: {0}", vm.ToString());
|
||||||
if (vm != null)
|
m.Devices = BI.DeviceBI.Searching.SearchDeviceModel(dbContext, vm.Id);
|
||||||
{
|
break;
|
||||||
m.FriendlyTerm = string.Format("Device Model: {0}", vm.ToString());
|
|
||||||
m.Devices = BI.DeviceBI.Searching.SearchDeviceModel(dbContext, vm.Id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m.FriendlyTerm = string.Format("Device Model: {0}", term);
|
}
|
||||||
m.Success = false;
|
m.FriendlyTerm = string.Format("Device Model: {0}", term);
|
||||||
m.ErrorMessage = "Invalid Device Model Id";
|
m.Success = false;
|
||||||
break;
|
m.ErrorMessage = "Invalid Device Model Id";
|
||||||
case "deviceprofile":
|
break;
|
||||||
int deviceProfileId;
|
case "deviceprofile":
|
||||||
if (int.TryParse(term, out deviceProfileId))
|
int deviceProfileId;
|
||||||
|
if (int.TryParse(term, out deviceProfileId))
|
||||||
|
{
|
||||||
|
var dp = dbContext.DeviceProfiles.Find(deviceProfileId);
|
||||||
|
if (dp != null)
|
||||||
{
|
{
|
||||||
var dp = dbContext.DeviceProfiles.Find(deviceProfileId);
|
m.FriendlyTerm = string.Format("Device Profile: {0}", dp.ToString());
|
||||||
if (dp != null)
|
m.Devices = BI.DeviceBI.Searching.SearchDeviceProfile(dbContext, dp.Id);
|
||||||
{
|
break;
|
||||||
m.FriendlyTerm = string.Format("Device Profile: {0}", dp.ToString());
|
|
||||||
m.Devices = BI.DeviceBI.Searching.SearchDeviceProfile(dbContext, dp.Id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m.FriendlyTerm = string.Format("Device Profile: {0}", term);
|
}
|
||||||
m.Success = false;
|
m.FriendlyTerm = string.Format("Device Profile: {0}", term);
|
||||||
m.ErrorMessage = "Invalid Device Profile Id";
|
m.Success = false;
|
||||||
break;
|
m.ErrorMessage = "Invalid Device Profile Id";
|
||||||
case "devicebatch":
|
break;
|
||||||
int deviceBatchId;
|
case "devicebatch":
|
||||||
if (int.TryParse(term, out deviceBatchId))
|
int deviceBatchId;
|
||||||
|
if (int.TryParse(term, out deviceBatchId))
|
||||||
|
{
|
||||||
|
var db = dbContext.DeviceBatches.Find(deviceBatchId);
|
||||||
|
if (db != null)
|
||||||
{
|
{
|
||||||
var db = dbContext.DeviceBatches.Find(deviceBatchId);
|
m.FriendlyTerm = string.Format("Device Batch: {0}", db.ToString());
|
||||||
if (db != null)
|
m.Devices = BI.DeviceBI.Searching.SearchDeviceBatch(dbContext, db.Id);
|
||||||
{
|
break;
|
||||||
m.FriendlyTerm = string.Format("Device Batch: {0}", db.ToString());
|
|
||||||
m.Devices = BI.DeviceBI.Searching.SearchDeviceBatch(dbContext, db.Id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m.FriendlyTerm = string.Format("Device Batch: {0}", term);
|
}
|
||||||
|
m.FriendlyTerm = string.Format("Device Batch: {0}", term);
|
||||||
|
m.Success = false;
|
||||||
|
m.ErrorMessage = "Invalid Device Batch Id";
|
||||||
|
break;
|
||||||
|
case "devices":
|
||||||
|
if (term.Length < 2)
|
||||||
|
{
|
||||||
m.Success = false;
|
m.Success = false;
|
||||||
m.ErrorMessage = "Invalid Device Batch Id";
|
m.ErrorMessage = "A search term of at least two characters is required";
|
||||||
break;
|
return View(m);
|
||||||
case "devices":
|
}
|
||||||
if (term.Length < 2)
|
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
|
||||||
|
if (m.Devices.Count == 1)
|
||||||
|
{
|
||||||
|
return RedirectToAction(MVC.Device.Show(m.Devices[0].SerialNumber));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "jobs":
|
||||||
|
if (term.Length < 2 && termInt < 0)
|
||||||
|
{
|
||||||
|
m.Success = false;
|
||||||
|
m.ErrorMessage = "A search term of at least two characters is required";
|
||||||
|
return View(m);
|
||||||
|
}
|
||||||
|
if (termInt >= 0)
|
||||||
|
{ // Term is a Number - Check for JobId
|
||||||
|
if (dbContext.Jobs.Count(j => j.Id == termInt) == 1)
|
||||||
|
{
|
||||||
|
return RedirectToAction(MVC.Job.Show(termInt));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
|
||||||
|
break;
|
||||||
|
case "users":
|
||||||
|
if (term.Length < 2)
|
||||||
|
{
|
||||||
|
m.Success = false;
|
||||||
|
m.ErrorMessage = "A search term of at least two characters is required";
|
||||||
|
return View(m);
|
||||||
|
}
|
||||||
|
m.Users = BI.UserBI.Searching.Search(dbContext, term);
|
||||||
|
if (m.Users.Count == 1)
|
||||||
|
{
|
||||||
|
return RedirectToAction(MVC.User.Show(m.Users[0].Id));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "deviceserialnumber":
|
||||||
|
var device = dbContext.Devices.FirstOrDefault(d => d.SerialNumber == term);
|
||||||
|
if (device != null)
|
||||||
|
return RedirectToAction(MVC.Device.Show(term));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m.Success = false;
|
||||||
|
m.ErrorMessage = "Unknown Device Serial Number";
|
||||||
|
return View(m);
|
||||||
|
}
|
||||||
|
case "jobid":
|
||||||
|
if (termInt >= 0)
|
||||||
|
{
|
||||||
|
var job = dbContext.Jobs.FirstOrDefault(d => d.Id == termInt);
|
||||||
|
if (job != null)
|
||||||
|
return RedirectToAction(MVC.Job.Show(termInt));
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m.Success = false;
|
m.Success = false;
|
||||||
m.ErrorMessage = "A search term of at least two characters is required";
|
m.ErrorMessage = "Unknown Job Number";
|
||||||
return View(m);
|
return View(m);
|
||||||
}
|
}
|
||||||
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
|
}
|
||||||
if (m.Devices.Count == 1)
|
else
|
||||||
|
{
|
||||||
|
m.Success = false;
|
||||||
|
m.ErrorMessage = "Invalid Job Number";
|
||||||
|
return View(m);
|
||||||
|
}
|
||||||
|
case "userid":
|
||||||
|
var user = dbContext.Users.FirstOrDefault(u => u.Id == term);
|
||||||
|
if (user != null)
|
||||||
|
return RedirectToAction(MVC.User.Show(term));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return RedirectToAction(MVC.Device.Show(m.Devices[0].SerialNumber));
|
user = BI.UserBI.UserCache.GetUser(term, dbContext);
|
||||||
}
|
if (user != null)
|
||||||
break;
|
return RedirectToAction(MVC.User.Show(term));
|
||||||
case "jobs":
|
else
|
||||||
if (term.Length < 2 && termInt < 0)
|
|
||||||
{
|
|
||||||
m.Success = false;
|
|
||||||
m.ErrorMessage = "A search term of at least two characters is required";
|
|
||||||
return View(m);
|
|
||||||
}
|
|
||||||
if (termInt >= 0)
|
|
||||||
{ // Term is a Number - Check for JobId
|
|
||||||
if (dbContext.Jobs.Count(j => j.Id == termInt) == 1)
|
|
||||||
{
|
{
|
||||||
return RedirectToAction(MVC.Job.Show(termInt));
|
m.Success = false;
|
||||||
|
m.ErrorMessage = "Unknown User Id";
|
||||||
|
return View(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
|
catch (ArgumentException)
|
||||||
break;
|
|
||||||
case "users":
|
|
||||||
if (term.Length < 2)
|
|
||||||
{
|
{
|
||||||
m.Success = false;
|
m.Success = false;
|
||||||
m.ErrorMessage = "A search term of at least two characters is required";
|
m.ErrorMessage = "Unknown User Id";
|
||||||
return View(m);
|
return View(m);
|
||||||
}
|
}
|
||||||
m.Users = BI.UserBI.Searching.Search(dbContext, term);
|
}
|
||||||
if (m.Users.Count == 1)
|
|
||||||
{
|
|
||||||
return RedirectToAction(MVC.User.Show(m.Users[0].Id));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1785,6 +1785,7 @@
|
|||||||
</Content>
|
</Content>
|
||||||
<Content Include="Web.Release.config">
|
<Content Include="Web.Release.config">
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
<None Include="Views\_ViewStart.cshtml">
|
<None Include="Views\_ViewStart.cshtml">
|
||||||
<Generator>RazorGenerator</Generator>
|
<Generator>RazorGenerator</Generator>
|
||||||
@@ -1861,7 +1862,7 @@
|
|||||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||||
</WebProjectProperties>
|
</WebProjectProperties>
|
||||||
</FlavorProperties>
|
</FlavorProperties>
|
||||||
<UserProperties BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
|
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" />
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||||
|
|||||||
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("1.2.0606.1220")]
|
[assembly: AssemblyVersion("1.2.0606.1909")]
|
||||||
[assembly: AssemblyFileVersion("1.2.0606.1220")]
|
[assembly: AssemblyFileVersion("1.2.0606.1909")]
|
||||||
Reference in New Issue
Block a user