using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using Foresight.Data; using Foresight.Fleet.Services.User; namespace IronIntel.Contractor.Users { public class AppModuleInfo { public string ID { get; set; } public string Name { get; set; } public string Description { get; set; } public bool Visible { get; set; } public string Url { get; set; } public string IconPath { get; set; } public string BackColor { get; set; } public string ForeColor { get; set; } public bool OpenInNewWindow { get; set; } public AppModuleType ModuleType { get; set; } public List SubItems { get; set; } public List GetJobsiteNavigateItems(Tuple[] pmss) { List list = new List(); Foresight.Fleet.Services.Customer.LicenseInfo license = SystemParams.GetLicense(); var jsitem = license.Items.FirstOrDefault(m => m.Key == "JobSites"); if (jsitem == null || !Helper.IsTrue(jsitem.Value)) { return list; } NavigateItem item = null; var jsditem = license.Items.FirstOrDefault(m => m.Key == "JobsiteDispatch"); if (jsditem != null && Helper.IsTrue(jsditem.Value)) { item = new NavigateItem(); item.ID = "nav_jobsiterequirements"; item.FeatureID = Feature.JOB_SITES_REQUIREMENTS; item.Title = "Jobsite Requirements"; item.Url = Url + "#" + item.ID; item.PageUrl = "JobSiteRequirements.aspx"; item.IconPath = "img/jobsiterequirements.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_REQUIREMENTS) != null) list.Add(item); item = new NavigateItem(); item.ID = "nav_dispatchrequests"; item.FeatureID = Feature.JOB_SITES_DISPATCHREQUESTS; item.Title = "Dispatch Requests"; item.Url = Url + "#" + item.ID; item.PageUrl = "DispatchRequests.aspx"; item.IconPath = "img/dispatch.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_DISPATCHREQUESTS) != null) list.Add(item); } item = new NavigateItem(); item.ID = "nav_jobsitemanage"; item.FeatureID = Feature.JOB_SITES; item.Title = "Jobsites"; item.Url = Url + "#" + item.ID; item.PageUrl = "JobSiteManage.aspx"; item.IconPath = "img/jobsite.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES) != null) list.Add(item); if (jsditem != null || Helper.IsTrue(jsditem.Value)) { item = new NavigateItem(); item.ID = "nav_scheduler"; item.FeatureID = Feature.JOB_SITES_SCHEDULER; item.Title = "Scheduler"; item.Url = Url + "#" + item.ID; item.PageUrl = "SchedulerManagement.aspx"; item.IconPath = "img/scheduler.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JOB_SITES_SCHEDULER) != null) list.Add(item); } return list; } public List GetMaintenanceNavigateItems(Tuple[] pmss) { List list = new List(); NavigateItem item = new NavigateItem(); item.ID = "nav_workorder"; item.FeatureID = Feature.WORK_ORDER; item.Title = "Work Order"; 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_workorderhis"; item.FeatureID = Feature.WORKORDERHISTORY; item.Title = "Work Order History"; item.Url = Url + "#" + item.ID; item.PageUrl = "WorkOrderHistory.aspx"; item.IconPath = "img/workorderhis.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.WORKORDERHISTORY) != null) list.Add(item); item = new NavigateItem(); item.ID = "nav_alertsmanagement"; item.FeatureID = Feature.ALERTS_MANAGEMENT; item.Title = "Alerts Management"; 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_maintenanceschedule"; item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE; item.Title = "Maintenance Schedules"; item.Url = Url + "#" + item.ID; item.PageUrl = "MaintenanceSchedulesManagement.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_record"; item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE; item.Title = "Maintenance Record"; 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 && pmss.FirstOrDefault(m => m.Item1.Id == Feature.MAINTENANCE_RECORD) != null) list.Add(item); if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.FUEL_RECORDS) != null) { 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"; list.Add(item); } if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CUSTOMER_RECORD) != null) { item = new NavigateItem(); item.ID = "nav_customerrecord"; item.FeatureID = Feature.CUSTOMER_RECORD; item.Title = "Customer Record"; item.Url = Url + "#" + item.ID; item.PageUrl = "CustomerRecordManagement.aspx"; item.IconPath = "img/customerrecord.png?v=1"; list.Add(item); item = new NavigateItem(); item.ID = "nav_surveymanagementresult"; item.FeatureID = Feature.WORKORDERSURVEYS; item.Title = "Survey Management/Result"; item.Url = Url + "#" + item.ID; item.PageUrl = "SurveyManagement.aspx"; list.Add(item); item = new NavigateItem(); item.ID = "nav_wosurveytemplate"; item.FeatureID = -1; item.Title = "Templates"; item.Url = Url + "#" + item.ID; item.PageUrl = "SurveyTemplateManagement.aspx"; list.Add(item); item = new NavigateItem(); item.ID = "nav_wosurveytemplatereport"; item.FeatureID = -1; item.Title = "Report"; item.Url = Url + "#" + item.ID; item.PageUrl = "SurveyTemplateReport.aspx"; list.Add(item); } return list; } public List GetSecurityNavigateItems(Tuple[] pmss, UserInfo user) { if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.USERS) == null) return null; List list = new List(); 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"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CURFEW_CONFIG) != null) 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"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CURFEW_CONFIG) != null) list.Add(item); } return list; } public List GetAssetsNavigateItems(Tuple[] pmss, UserInfo user) { List list = new List(); 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 List GetCredentialNavigateItems(Tuple[] pmss, UserInfo user) { List list = new List(); NavigateItem item = new NavigateItem(); item.ID = "nav_credential"; item.FeatureID = Feature.CREDENTIALS; item.Title = "Credentials"; item.Url = Url + "#" + item.ID; item.PageUrl = "ManageCredential.aspx"; item.IconPath = "img/credential.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CREDENTIALS) != null) list.Add(item); item = new NavigateItem(); item.ID = "nav_jdlink"; item.FeatureID = Feature.JDLINK; item.Title = "JD Link"; item.Url = Url + "#" + item.ID; item.PageUrl = "ManageJDLink.aspx"; item.IconPath = "img/jdlink.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JDLINK) != null) list.Add(item); //item = new NavigateItem(); //item.ID = "nav_jdnotification"; //item.FeatureID = Feature.JDNOTIFICATION; //item.Title = "JohnDeere Notifications"; //item.Url = Url + "#" + item.ID; //item.PageUrl = "ManageJDNotifications.aspx"; //item.IconPath = "img/jdnotifications.png"; //if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.JDNOTIFICATION) != null) // list.Add(item); item = new NavigateItem(); item.ID = "nav_apicredential"; item.FeatureID = Feature.APICREDENTIALS; item.Title = "API Credentials"; item.Url = Url + "#" + item.ID; item.PageUrl = "ManageAPICredential.aspx"; item.IconPath = "img/apicredential.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.APICREDENTIALS) != null) list.Add(item); return list; } public List GetOTRConfigNavigateItems(Tuple[] pmss, UserInfo user) { List list = new List(); NavigateItem item = new NavigateItem(); item.ID = "nav_manageharshdriving"; item.FeatureID = Feature.HARSH_DRIVING; item.Title = "Manage Harsh Driving"; item.Url = Url + "#" + item.ID; item.PageUrl = "ManageHarshDriving.aspx"; item.IconPath = "img/harshdriving.png"; if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.HARSH_DRIVING) != null) 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 { public string ID { get; set; } public string Title { get; set; } public string Url { get; set; } public string IconPath { get; set; } } public class CredentialNavigateItem { public string ID { get; set; } public string Title { get; set; } public string Url { get; set; } public string IconPath { get; set; } } public enum AppModuleType { System, Workspace } }