//============================================================================= Helper methods /// <summary> /// Creates the first path of the url, without properties and parameters /// </summary> private string GetItemUrlBase() { // short url format that contains only the id if (ContentId > 0) { return(string.Format("{0}/{1}/content({2})", SiteUrl, SERVICE_NAME, ContentId)); } // regular url that contains the content path var path = Path.TrimStart('/'); // collection or item url if (!IsCollectionRequest) { var lastSlash = path.LastIndexOf('/'); if (lastSlash > 0) { var path1 = path.Substring(0, lastSlash); var path2 = path.Substring(lastSlash + 1); path = string.Format("{0}/('{1}')", path1, path2); } else { path = string.Format("('{0}')", path); } } return(string.Format("{0}/{1}/{2}", SiteUrl.TrimEnd('/'), SERVICE_NAME, path)); }
//============================================================================= Helper methods /// <summary> /// Creates the first path of the url, without properties and parameters /// </summary> private string GetItemUrlBase() { // short url format that contains only the id if (ContentId > 0) { return($"{SiteUrl}/{SERVICE_NAME}/content({ContentId})"); } // regular url that contains the content path var path = Path.TrimStart('/'); // collection or item url if (!IsCollectionRequest) { var lastSlash = path.LastIndexOf('/'); if (lastSlash > 0) { var path1 = path.Substring(0, lastSlash); var path2 = path.Substring(lastSlash + 1); path = $"{path1}('{path2}')"; } else { path = $"('{path}')"; } } return($"{SiteUrl.TrimEnd('/')}/{SERVICE_NAME}/{path}"); }
public Configuration() { SiteUrl = Environment.GetEnvironmentVariable("PnPTests_SiteUrl"); if (string.IsNullOrEmpty(SiteUrl)) { throw new ConfigurationErrorsException("Please set PnPTests_SiteUrl environment variable, or run Run-Tests.ps1 in the build root folder"); } else { SiteUrl = SiteUrl.TrimEnd(new[] { '/' }); } var credLabel = Environment.GetEnvironmentVariable("PnPTests_CredentialManagerLabel"); if (string.IsNullOrEmpty(credLabel)) { var username = Environment.GetEnvironmentVariable("PnPTests_Username"); var password = Environment.GetEnvironmentVariable("PnPTests_Password"); if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { Credentials = new PSCredential(username, ConvertFromBase64String(password)); } } else { Credentials = PnP.PowerShell.Commands.Utilities.CredentialManager.GetCredential(credLabel); } if (Credentials == null) { throw new ConfigurationErrorsException("Please set PnPTests_CredentialManagerLabel or PnPTests_Username and PnPTests_Password, or run Run-Tests.ps1 in the build root folder"); } }
public async Task <IActionResult> InvoiceDetail(string invoiceId) { var model = new InvoiceDetailModel { Data = await _invoicesServiceClient.GetInvoiceAsync(MerchantId, invoiceId) }; var files = await _invoicesServiceClient.GetFileInfoByInvoiceAsync(model.Data.InvoiceId); model.Files = files.Select(i => new FileModel(i)).ToList(); if (model.Data.Status != InvoiceStatus.Paid.ToString()) { model.InvoiceUrl = $"{SiteUrl.TrimEnd('/')}/invoice/{model.Data.InvoiceId}"; model.QRCode = $@"https://chart.googleapis.com/chart?chs=220x220&chld=L|2&cht=qr&chl={model.InvoiceUrl}"; } return(View(model)); }