private WidgetResult GetWidgetResult() { var remoteAddress = new EndpointAddress($"{ConnectionProperties.Uri}/backstop/services/BackstopWidgetService_1_0"); var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); binding.MaxReceivedMessageSize = 2147483647; binding.MaxBufferSize = 2147483647; var client = new BackstopWidgetService_1_0PortTypeClient(binding, remoteAddress); var login = new LoginInfoType() { Username = ConnectionProperties.Username, Password = ConnectionProperties.Password.ToInsecureString() }; var args = new Dictionary <string, object> { { "fundId", txtFundId.Text }, { "asOf", DateTime.Now } }; var fvps = new List <FieldValuePair>(); foreach (var x in args) { fvps.Add( new FieldValuePair { field = x.Key, value = (x.Value as DateTime?)?.ToString("yyyy-MM-dd") ?? x.Value.ToString() }); } var response = client.getWidget(login, "Drawdown Report", fvps.ToArray()); return(response); }
private async Task GetDocuments() { var remoteAddress = new EndpointAddress($"{ConnectionProperties.Uri}/backstop/services/BackstopCrmService_1_6"); var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); binding.MaxReceivedMessageSize = 2147483647; binding.MaxBufferSize = 2147483647; var client = new BackstopCrm.BackstopCrmService_1_6PortTypeClient(binding, remoteAddress); var login = new LoginInfoType() { Username = ConnectionProperties.Username, Password = ConnectionProperties.Password.ToInsecureString() }; var docs = client.getAllDocuments(login); //var relatedLinks = client.getAllDocumentRelations(login); var docService = new DocumentService(); var documents = new List <DataObjects.DocumentInformation>(); int index = 0; foreach (var item in docs) { var newDocument = new DataObjects.DocumentInformation() { Id = item.id.Value, FileName = item.filename, Title = item.title, CreatedDate = item.createdDate, Links = new List <Link>() }; //now we have to go thru each document and get its metadata. //this will take time since we go thru each and every document one at a time. try { var result = await docService.GetDocument(newDocument.Id); newDocument.Links = result.Data.Links; } catch (System.Exception ex) { //we need to log this error. } documents.Add(newDocument); index++; if (index == 20) { break; } } DocGrid.ItemsSource = documents; }