protected void getCorrespondingPeople(String strLicenseCode) { var licenseCorresponding = new Models.License(); grvLicenseAssignedPeople.DataSource = licenseCorresponding.ReturnLicensePeople(strLicenseCode, false); grvLicenseAssignedPeople.DataBind(); }
public void OnNavigatedTo(NavigationContext navigationContext) { if (null != navigationContext) { Models.License model = (navigationContext.Parameters[nameof(Models.License)] as Models.License); string LicenseDir = (navigationContext.Parameters["LicenseDirectory"] as string); try { if (null != model) { Title = model.Title; Author = model.Author; string LicenseFile = LicenseDir + System.IO.Path.DirectorySeparatorChar + model.LicenseFile; if (System.IO.File.Exists(LicenseFile)) { License = System.IO.File.ReadAllText(LicenseFile); } RaisePropertyChanged(""); } } catch (Exception ex) { _logger.Error(ex); } } }
public HttpResponseMessage getLicense() { IEnumerable <string> headerValues; var authHeader = string.Empty; try { if (Request.Headers.TryGetValues("Authorization", out headerValues)) { authHeader = headerValues.FirstOrDefault(); } var license = new Models.License(); var logic = new Logic.UsersLogic(); var authData = logic.GetAuthValues(authHeader); license = logic.GetLicense(authData.Username, authData.Password, authData.Domain); return(Request.CreateResponse(HttpStatusCode.OK, license)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.Forbidden, "Unable to get license: " + ex.Message)); } }
public Models.License GetLicense(string UserName, string Password, string domain = "") { Models.License license = new Models.License(); try { var api = new Requests.ConnectorApi(ConfigurationManager.AppSettings["Square9Api"], domain + @"\" + UserName, Password); license = api.Requests.Licenses.GetLicense(); } catch (Exception ex) { throw new Exception("Unable to return list of Secured Users: " + ex.Message); } return(license); }
protected void grvLicense_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { // String strLicenseCode = grvLicense.DataKeys[e.RowIndex].Value.ToString(); String strLicenseCode = grvLicenseCode.DataKeys[e.RowIndex].Value.ToString(); var deleteLicense = new Models.License(strLicenseCode); if (deleteLicense.IsRemoved()) { grvLicenseCode.DataBind(); } else { ShowMessage("Exeption occured!"); } } catch (MySqlException ex) { ShowMessage(ex.Message); } }
/// <summary> /// Retrieves the specified component from NuGet. /// </summary> /// <param name="name">NuGet package name</param> /// <param name="version">Package version</param> /// <returns></returns> public async Task <Component> GetComponentAsync(string name, string version, string scope) { if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(version)) { return(null); } Console.WriteLine("Retrieving " + name + " " + version); var component = new Component { Name = name, Version = version, Scope = scope, Purl = Utils.GeneratePackageUrl(name, version) }; var nuspecFilename = GetCachedNuspecFilename(name, version); NuspecReader nuspecReader = null; if (nuspecFilename == null) { var url = _baseUrl + name + "/" + version + "/" + name + ".nuspec"; using (var xmlStream = await _httpClient.GetXmlStreamAsync(url).ConfigureAwait(false)) { if (xmlStream != null) { nuspecReader = new NuspecReader(xmlStream); } } } else { using (var xmlStream = _fileSystem.File.Open(nuspecFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read)) { nuspecReader = new NuspecReader(xmlStream); } } if (nuspecReader == null) { return(component); } component.Publisher = nuspecReader.GetAuthors(); component.Copyright = nuspecReader.GetCopyright(); // this prevents empty copyright values in the JSON BOM if (string.IsNullOrEmpty(component.Copyright)) { component.Copyright = null; } var title = nuspecReader.GetTitle(); var summary = nuspecReader.GetSummary(); var description = nuspecReader.GetDescription(); if (!string.IsNullOrEmpty(summary)) { component.Description = summary; } else if (!string.IsNullOrEmpty(description)) { component.Description = description; } else if (!string.IsNullOrEmpty(title)) { component.Description = title; } var licenseMetadata = nuspecReader.GetLicenseMetadata(); if (licenseMetadata != null && licenseMetadata.Type == NuGet.Packaging.LicenseType.Expression) { Action <NuGetLicense> licenseProcessor = delegate(NuGetLicense nugetLicense) { var license = new Models.License { Id = nugetLicense.Identifier, Name = nugetLicense.Identifier }; component.Licenses.Add(new ComponentLicense { License = license }); }; licenseMetadata.LicenseExpression.OnEachLeafNode(licenseProcessor, null); } else { var licenseUrl = nuspecReader.GetLicenseUrl(); if (!string.IsNullOrEmpty(licenseUrl)) { Models.License license = null; if (_githubService != null) { license = await _githubService.GetLicenseAsync(licenseUrl).ConfigureAwait(false); } if (license == null) { license = new Models.License { Url = licenseUrl }; } component.Licenses.Add(new ComponentLicense { License = license }); } } var projectUrl = nuspecReader.GetProjectUrl(); if (projectUrl != null) { var externalReference = new Models.ExternalReference(); externalReference.Type = Models.ExternalReference.WEBSITE; externalReference.Url = projectUrl; component.ExternalReferences.Add(externalReference); } return(component); }