sync
This commit is contained in:
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.User;
|
||||
|
||||
namespace IronIntel.Contractor.Users
|
||||
{
|
||||
@ -20,6 +21,245 @@ namespace IronIntel.Contractor.Users
|
||||
public string ForeColor { get; set; }
|
||||
public bool OpenInNewWindow { get; set; }
|
||||
public AppModuleType ModuleType { get; set; }
|
||||
public List<NavigateItem> SubItems { get; set; }
|
||||
|
||||
public List<NavigateItem> GetMaintenanceNavigateItems(Tuple<Feature, Permissions>[] pmss)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_alertsmanagement";
|
||||
item.FeatureID = Feature.ALERTS_MANAGEMENT;
|
||||
item.Title = "Alerts Management **New**";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AlertsManagement.aspx";
|
||||
item.IconPath = "img/alert.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.ALERTS_MANAGEMENT) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_workorder";
|
||||
item.FeatureID = Feature.WORK_ORDER;
|
||||
item.Title = "Work Order **New**";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "WorkOrderMaintenance.aspx";
|
||||
item.IconPath = "img/workorder.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.WORK_ORDER) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_preventative";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.Title = "Absolute Hours Maintenance";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "PreventativeMaintenance.aspx";
|
||||
item.IconPath = "img/preventative.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_timebased";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.Title = "Relative Time Maintenance";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "TimeBasedMaintenance.aspx";
|
||||
item.IconPath = "img/timebased.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_hours";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.Title = "Relative Hours Maintenance";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "HoursMaintenance.aspx";
|
||||
item.IconPath = "img/hours.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_absolutedistance";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.Title = "Absolute Distance Maintenance";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AbsoluteDistanceMaintenance.aspx";
|
||||
item.IconPath = "img/preventative.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.ID = "nav_relativedistance";
|
||||
item.Title = "Relative Distance Maintenance";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "RelativeDistanceMaintenance.aspx";
|
||||
item.IconPath = "img/hours.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_record";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
item.Title = "Maintenance Record **Legacy**";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "MaintanceRecordsManagement.aspx";
|
||||
item.IconPath = "img/record.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.PREVENTATIVE_MAINTENANCE) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_fuelrecord";
|
||||
item.FeatureID = Feature.FUEL_RECORDS;
|
||||
item.Title = "Fuel Records";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "FuelRecordManagement.aspx";
|
||||
item.IconPath = "img/fuelrecord.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.FUEL_RECORDS) != null)
|
||||
list.Add(item);
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetSecurityNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.USERS) == null)
|
||||
return null;
|
||||
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_users";
|
||||
item.FeatureID = Feature.USERS;
|
||||
item.Title = "Users";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "UserManage.aspx";
|
||||
item.IconPath = "img/users.png";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_user_group";
|
||||
item.Title = "User Group";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "UserGroup.aspx";
|
||||
item.IconPath = "img/usergroup.png";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_dts";
|
||||
item.Title = "DataTable Permission";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "../fic/fic/Management/DataTablePermission.aspx";
|
||||
//item.IconPath = "img/permission.png";
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_filters";
|
||||
item.Title = "Dashboard Filters";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "../fic/fic/Management/FiltersManagement.aspx";
|
||||
item.IconPath = "img/filters.png";
|
||||
list.Add(item);
|
||||
|
||||
if (IronIntel.Contractor.SystemParams.IsDealer)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_usertocontractor";
|
||||
item.Title = "User To Contractor";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "UserToContractorPage.aspx";
|
||||
item.IconPath = "img/contractor.png";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_curfew";
|
||||
item.FeatureID = Feature.CURFEW_CONFIG;
|
||||
item.Title = "Curfew Configuration";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "CurfewManage.aspx";
|
||||
item.IconPath = "img/curfew.png";
|
||||
list.Add(item);
|
||||
|
||||
if (user.UserType == UserTypes.SupperAdmin)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_curfewmt";
|
||||
item.FeatureID = Feature.CURFEW_CONFIG;
|
||||
item.Title = "Curfew Movement Tolerance";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "CurfewMovementTolerance.aspx";
|
||||
item.IconPath = "img/curfewmovementtolerance.png";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetAssetsNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
|
||||
NavigateItem item = new NavigateItem();
|
||||
item.ID = "nav_managmachines";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
item.Title = "Manage Assets";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageMachines.aspx";
|
||||
item.IconPath = "img/machines.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managrentals";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
item.Title = "Manage Rentals";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageRentals.aspx";
|
||||
item.IconPath = "img/rental.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_machinegroups";
|
||||
item.FeatureID = Feature.ASSET_GROUP;
|
||||
item.Title = "Asset Groups";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "MachineGroups.aspx";
|
||||
item.IconPath = "img/machinegroups.png";
|
||||
if (!IronIntel.Contractor.SystemParams.IsDealer && user.UserType >= UserTypes.Admin)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managegpsdevices";
|
||||
item.FeatureID = Feature.MANAGE_DEVICES;
|
||||
item.Title = "Manage Devices";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageGPSDevices.aspx";
|
||||
item.IconPath = "img/devices.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_DEVICES) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managmodels";
|
||||
item.Title = "Manage Models";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ManageModels.aspx";
|
||||
item.IconPath = "img/model.png";
|
||||
if (user.UserType >= UserTypes.Admin)
|
||||
list.Add(item);
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public class NavigateItem
|
||||
{
|
||||
public string ID { get; set; }
|
||||
public int FeatureID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string PageUrl { get; set; }
|
||||
public string IconPath { get; set; }
|
||||
}
|
||||
|
||||
public class SecurityNavigateItem
|
||||
|
@ -29,6 +29,8 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
var pc = FleetServiceClientHelper.CreateClient<PermissionProvider>();
|
||||
FeatureModule[] ms = pc.GetAvailableModules(SystemParams.CompanyID, user.IID);
|
||||
Tuple<Feature, Permissions>[] pmss = pc.GetUserPermissions(SystemParams.CompanyID, user.IID);
|
||||
|
||||
List<FeatureModule> moudles = new List<FeatureModule>();
|
||||
moudles.AddRange(ms);
|
||||
if (ms.FirstOrDefault(m => m.Id == FeatureModule.MODULE_MAPVIEW) == null)
|
||||
@ -47,6 +49,13 @@ namespace IronIntel.Contractor.Users
|
||||
ami.Visible = true;
|
||||
ami.ModuleType = AppModuleType.System;
|
||||
|
||||
if (m.Id == FeatureModule.MODULE_ASSETHEALTH)
|
||||
ami.SubItems = ami.GetMaintenanceNavigateItems(pmss);
|
||||
else if (m.Id == FeatureModule.MODULE_SECURITY)
|
||||
ami.SubItems = ami.GetSecurityNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_MANAGEASSETS)
|
||||
ami.SubItems = ami.GetAssetsNavigateItems(pmss, user);
|
||||
|
||||
list.Add(ami);
|
||||
}
|
||||
AppModuleInfo[] wsps = GetFICWorkspace(user);
|
||||
@ -89,7 +98,7 @@ namespace IronIntel.Contractor.Users
|
||||
return ai;
|
||||
}
|
||||
|
||||
private static AppModuleInfo[] GetFICWorkspace(UserInfo user)
|
||||
public static AppModuleInfo[] GetFICWorkspace(UserInfo user)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(SystemParams.FICDbConnectionString))
|
||||
{
|
||||
|
@ -35,6 +35,7 @@ namespace IronIntel.Contractor.Users
|
||||
public bool AllowLoginIntoPC { get; set; }
|
||||
public bool AllowLoginIntoInspectMobile { get; set; }
|
||||
public bool AllowLoginIntoFleetMobile { get; set; }
|
||||
public string LandingPage { get; set; }
|
||||
public string GroupNamesStr { get { return (GroupNames == null || GroupNames.Length == 0) ? "" : string.Join(",", GroupNames); } }
|
||||
|
||||
public string ContactTypeName
|
||||
|
@ -29,6 +29,7 @@ namespace IronIntel.Contractor.Users
|
||||
private const string _ExcludeNoLocation = "ExcludeNoLocation";
|
||||
|
||||
private const string _MapViewSearches = "MapViewSearches";
|
||||
private const string _LandingPage = "LandingPage";
|
||||
|
||||
public static UserParamInfo GetUserParams(string sessionid, string useriid)
|
||||
{
|
||||
@ -82,6 +83,9 @@ namespace IronIntel.Contractor.Users
|
||||
case _ExcludeNoLocation:
|
||||
userParams.ExcludeNoLocation = int.Parse(value) == 1;
|
||||
break;
|
||||
case _LandingPage:
|
||||
userParams.LandingPage = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
userParams.MapViewSearches = GetMapViewSearches(sessionid, useriid);
|
||||
@ -168,6 +172,11 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
if (userParams.ExcludeNoLocation)
|
||||
db.ExecSQL(SQL, useriid, _ExcludeNoLocation, userParams.ExcludeNoLocation ? 1 : 0);
|
||||
|
||||
if (!string.IsNullOrEmpty(userParams.LandingPage))
|
||||
db.ExecSQL(SQL, useriid, _LandingPage, userParams.LandingPage);
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _LandingPage);
|
||||
}
|
||||
|
||||
public static string GetStringParameter(string useriid, string paramname)
|
||||
@ -311,6 +320,7 @@ namespace IronIntel.Contractor.Users
|
||||
public bool ExcludeNoLocation { get; set; } = true;
|
||||
|
||||
public MapViewSearchItem[] MapViewSearches { get; set; }
|
||||
public string LandingPage { get; set; }
|
||||
}
|
||||
|
||||
public class MapViewSearcheHelper
|
||||
|
Reference in New Issue
Block a user