public bool CanDriveAerial() { return(Licenses.Any(l => l.Vehicle is IAerialVehicle)); }
public bool CanDriveGround() { return(Licenses.Any(l => l.Vehicle is IGroundVehicle)); }
/// <summary> /// load data for the home model /// </summary> public void LoadData(string baseUri) { var bulkClient = _sb.BulkDataV2(); var hostBulkData = bulkClient.GetHostData(); ExceptionsML.Check(hostBulkData.Error); HostBulkData = JsonConvert.SerializeObject(hostBulkData); CurrentDBName = hostBulkData.Result.CurrentDB; DefaultDBName = hostBulkData.Result.DefaultDB; DefaultInstanceId = hostBulkData.Result.DefaultInstanceId; Instances = hostBulkData.Result.UserCompanyInstances; SystemPreferences = JsonConvert.SerializeObject(hostBulkData.Result.CompanySettings); SystrayConnections = JsonConvert.SerializeObject(hostBulkData.Result.SysTrayConnections); AutomationConnections = JsonConvert.SerializeObject(hostBulkData.Result.AutomationConnections); HttpRuntimeSection httpRuntimeSection = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection; MaxRequestLength = httpRuntimeSection.MaxRequestLength; DateTime?lastChecked = null; if (hostBulkData.Result.UserSettings.ContainsKey(Constants.WORKFLOW_LAST_CHECKED)) { lastChecked = DateTime.Parse(hostBulkData.Result.UserSettings[Constants.WORKFLOW_LAST_CHECKED]); } var bulkData = bulkClient.Get(lastChecked); ExceptionsML.Check(bulkData.Error); BulkData = JsonConvert.SerializeObject(bulkData); var result = bulkData.Result; UserMessages = result.ExpiringMessage; var importData = new AdvancedImportData(); var licenseTokens = result.LicenseTokens; if (licenseTokens != null) { Licenses.AddRange(licenseTokens); } if (!Licenses.Any(r => (TokenKey)r == TokenKey.View)) { Unlicensed = true; } // Gateway permissions importData.GatewayPermissions = result.GatewayPermissions; var user = result.CurrentUser; _baseCache.Remove(USERINFO + user.Id.ToString()); _baseCache.Add(USERINFO + user.Id.ToString(), new object[] { user, result.GatewayPermissions }, new CacheItemPolicy()); LoadUserData(); CurrentUser = JsonConvert.SerializeObject(new { Name = user.Username, Id = user.Id, HasPassword = HasPassword }); importData.RootFolder = result.RootFolders; var rootNode = new JSTreeData(Constants.i18n("folders")); rootNode.children = JSTreeFormat.ConvertToJSTreeFormat(importData.RootFolder); FolderData = JsonConvert.SerializeObject(rootNode); // Inbox data var inboxes = new JSTreeData(Constants.i18n("inboxes")); importData.Inboxes = result.Inboxes.ToList(); inboxes.children = JSTreeFormat.ConvertToJSTreeFormat(result.Inboxes); InboxData = JsonConvert.SerializeObject(inboxes); // Security Class Data importData.SecurityClasses = result.SecurityClasses.ToList(); // Content Type Data ContentTypes = result.ContentTypes; importData.ContentTypes = new List <ContentTypeLight>(); foreach (var ct in ContentTypes) { importData.ContentTypes.Add(new ContentTypeLight { Id = ct.Id, Name = ct.Name, DefaultFolderName = "", //TODO: scain need to obtain the default folder Name DefaultFolderId = ct.DefaultFolderId, DefaultInboxId = ct.DefaultInboxId, DefaultSecurityClassid = ct.DefaultSecurityClassId, DefaultWorkflowId = ct.DefaultWorkflowId, EffectivePermissions = ct.EffectivePermissions }); } NewApprovals = result.NewApprovals; NewWorkflows = result.NewWorkflows; importData.Workflows = result.Workflows.ToList(); ImportData = JsonConvert.SerializeObject(importData); var views = GetCachedViews(baseUri); CommonTemplates = JsonConvert.SerializeObject(views); }