private void _Saving(object sender, Blackbaud.AppFx.UIModeling.Core.SavingEventArgs e) { if (this.Mode == Blackbaud.AppFx.UIModeling.Core.DataFormMode.Add) //Check this while adding only { if (RELATIONSHIPCODEID.Value == Guid.Parse("437C723A-AA22-49B9-977E-96E389D21A6A")) //Self { DataListLoadRequest request = new DataListLoadRequest { DataListID = new Guid("5a96ea16-83bc-4dcc-a2a5-a66f4065de0a"), ContextRecordID = this.ContextRecordId, SecurityContext = this.GetRequestSecurityContext() }; AppFxWebService svc = new AppFxWebService(this.GetRequestContext()); var reply = svc.DataListLoad(request); foreach (DataListResultRow row in reply.Rows) { if (row.Values[5] != null && row.Values[5].ToLower().Equals("self")) { SaveFailed(); break; } } } } }
private CatalogBrowserLoadCatalogItemReply LoadCatalogItem(AppFxWebService appFxService, ClientAppInfoHeader header, ItemInfo itemToLoad) { Log.LogMessage("Calling CatalogBrowserLoadCatalogItem for '{0}'.", itemToLoad.ItemName); // Build the request CatalogBrowserLoadCatalogItemRequest loadReq = new CatalogBrowserLoadCatalogItemRequest(); loadReq.ClientAppInfo = header; loadReq.ItemName = itemToLoad.ItemName; loadReq.SourceInfo = new SourceInfo() { Name = itemToLoad.ItemSource, Type = SourceType.Assembly }; loadReq.ForceReload = true; loadReq.ForceReloadDependencies = false; loadReq.TrackLoadedItems = true; CatalogBrowserLoadCatalogItemReply loadReply = null; loadReply = appFxService.CatalogBrowserLoadCatalogItem(loadReq); if (loadReply == null) { throw new Exception("Null reply from CatalogBrowserLoadCatalogItem"); } return(loadReply); }
private ItemInfo GetItemInfo(AppFxWebService appFxService, ClientAppInfoHeader header, string itemName, string sourceInfo) { ItemInfo itemInfo = new ItemInfo(); // Retrieve item info from 'Catalog Browser List' datalist so we can determine how we want to load it DataListLoadRequest listLoadReq = new DataListLoadRequest(); listLoadReq.ClientAppInfo = header; listLoadReq.DataListID = new Guid("91907a4f-14a3-4433-b780-a030c01ca452"); // Catalog Browser List // Create params with SOURCE set to the source from the msbuild item metadata listLoadReq.Parameters = new DataFormItem(); listLoadReq.Parameters.Values = new DataFormFieldValue[] { new DataFormFieldValue() { ID = "SOURCE", Value = sourceInfo } }; // Let any exceptions from this bubble upwards DataListLoadReply listLoadReply = null; listLoadReply = appFxService.DataListLoad(listLoadReq); // Loading a few constants for clarity's sake int itemSourceColNum = 3; int itemIdColNum = 5; int itemResourceNameColNum = 8; int itemTypeCodeColNum = 14; // Look for the item we're supposed to load in the datalist results DataListResultRow rowToLoad = listLoadReply.Rows.Where(r => r.Values[itemResourceNameColNum].Equals(itemName, StringComparison.InvariantCultureIgnoreCase)).Select(r => r).FirstOrDefault(); if (rowToLoad == null) { throw new Exception(string.Format("Did not find '{0}' in items loaded from '{1}'.", itemName, sourceInfo)); } int tmpItemTypeCode = int.MinValue; if (!int.TryParse(rowToLoad.Values[itemTypeCodeColNum], out tmpItemTypeCode)) { throw new Exception(string.Format("Failed to parse item type code from '{0}'", rowToLoad.Values[itemTypeCodeColNum])); } itemInfo.ItemTypeCode = tmpItemTypeCode; itemInfo.ItemId = new Guid(rowToLoad.Values[itemIdColNum]); itemInfo.ItemName = rowToLoad.Values[itemResourceNameColNum]; itemInfo.ItemSource = rowToLoad.Values[itemSourceColNum]; return(itemInfo); }
public static AppFxWebService GetAppFxServiceProxy(string userName = "", string password = "") { if (userName == "") { userName = USER_NAME; password = PASSWORD; } AppFxWebService paymentSvc = new AppFxWebService(); paymentSvc.Url = @"https://localhost/bbps/appfxwebservice.asmx"; paymentSvc.Credentials = new System.Net.NetworkCredential(userName, password); paymentSvc.Timeout = 300000; return paymentSvc; }
static internal CountryGetFormatsReply GetCountryFormats(RequestContext context) { if ((context == null)) { return(null); } dynamic req = new CountryGetFormatsRequest(); dynamic svc = new AppFxWebService(context); return(svc.CountryGetFormats(req)); }
private bool ProcessItemToLoad(AppFxWebService appFxService, ClientAppInfoHeader header, string itemName, string sourceInfo) { Log.LogMessage("Loading '{0}' from '{1}'", itemName, sourceInfo); bool successfulLoad = true; ItemInfo itemToLoadInfo = GetItemInfo(appFxService, header, itemName, sourceInfo); // Load the item CatalogBrowserLoadCatalogItemReply loadReply = null; try { loadReply = LoadCatalogItem(appFxService, header, itemToLoadInfo); } catch (Exception ex) { if (ex.Message.Contains("ItemAlreadyExistsException")) { // Not sure why these keep occurring, but going to skip them and see what happens. Log.LogMessage("Encountered ItemAlreadyExistsException, skipping this report."); } else { Log.LogMessage("exception ToString: {0}", ex.ToString()); throw; } } if (loadReply != null) { Log.LogMessage("{0} item(s) loaded", loadReply.LoadedItems.Count()); if (itemToLoadInfo.ItemTypeCode == 5) // PackageSpec { IEnumerable <string> itemsFromPackageSpec = GetPackageDependencies(appFxService, header, itemToLoadInfo); // See if our itemsFromPackageSpec items were loaded foreach (string supposedToLoad in itemsFromPackageSpec) { // See if our "supposedToLoad" was loaded if (loadReply.LoadedItems.Where(x => x.ItemResourceName.Equals(supposedToLoad, StringComparison.InvariantCultureIgnoreCase)).Count() < 1) { Log.LogError("Item '{0}' from package spec was not loaded. Check to make sure it is present.", supposedToLoad); successfulLoad = false; } } } } return(successfulLoad); }
private bool LoadItems(AppFxWebService appFxWebService, ClientAppInfoHeader header) { bool successfulLoad = true; // Loop the items to load, calling the appfx load catalog item web service foreach (ITaskItem itemToLoad in ItemsToLoad) { string sourceInfo = itemToLoad.GetMetadata("SourceInfo"); successfulLoad = ProcessItemToLoad(appFxWebService, header, itemToLoad.ItemSpec, sourceInfo); } return(successfulLoad); }
private static ListOutputRow[] Search(string lastName, string firstName) { // Set credentials NetworkCredential credentials = new NetworkCredential { Domain = "<domain>", UserName = "******", Password = "******" }; // Initialize web service AppFxWebService service = new AppFxWebService { Url = "http://<web_server>/<virtual_directory>/AppFxWebService.asmx", Credentials = credentials }; // Define filters for the search list DataFormFieldValueSet fieldValueSet = new DataFormFieldValueSet() { new DataFormFieldValue("KEYNAME", lastName), new DataFormFieldValue("FIRSTNAME", firstName) }; // Create request SearchListLoadRequest request = new SearchListLoadRequest { SearchListID = new Guid("fdf9d631-5277-4300-80b3-fdf5fb8850ec"), // ConstituentByNameOrLookupId.Search.xml ClientAppInfo = new ClientAppInfoHeader { ClientAppName = "Sample Application", REDatabaseToUse = "<database>" }, Filter = new DataFormItem { Values = fieldValueSet } }; // Run search SearchListLoadReply reply = service.SearchListLoad(request); if (reply != null && reply.Output != null && reply.Output.Rows != null) { return(reply.Output.Rows); } else { return(null); } }
private IEnumerable <string> GetPackageDependencies(AppFxWebService appFxService, ClientAppInfoHeader header, ItemInfo itemToLoad) { Log.LogMessage("Reading package spec '{0}' (ID: {1})", itemToLoad.ItemName, itemToLoad.ItemId); DataFormLoadRequest dfLoadReq = new DataFormLoadRequest(); dfLoadReq.ClientAppInfo = header; dfLoadReq.FormID = new Guid("8dcaab58-3b6a-405a-9430-5d07cb000d22"); // Catalog Item Xml View Form dfLoadReq.RecordID = string.Format("5|{0}", itemToLoad.ItemId); // Record ID is "[item type code]|[item ID]" DataFormLoadReply dfLoadReply = appFxService.DataFormLoad(dfLoadReq); if (dfLoadReply == null) { throw new Exception("Null reply from DataFormLoad."); } // Get item XML string itemXml = dfLoadReply.DataFormItem.Values.Where(x => x.ID == "ITEMXML").Select(x => x.Value.ToString()).FirstOrDefault(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(itemXml); // Load <Dependency> nodes, add items to load to list XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmlDoc.NameTable); nsMgr.AddNamespace("c", "bb_appfx_commontypes"); XmlNodeList nodeList = xmlDoc.SelectNodes("//c:Dependency", nsMgr); if (nodeList.Count <= 0) { Log.LogWarning("Failed to find any Dependency nodes in package spec."); } List <string> itemsFromPackageSpec = new List <string>(); foreach (XmlNode dependencyNode in nodeList) { itemsFromPackageSpec.Add(dependencyNode.Attributes["CatalogItem"].Value); } return(itemsFromPackageSpec); }
public override bool Execute() { bool successfulLoad = true; Log.LogMessage("Configuring AppFxWebServiceProvider"); Log.LogMessage("User: {0}", string.IsNullOrEmpty(InfinityUserName) ? "[Default credentials]" : InfinityUserName); Log.LogMessage("URL: {0}\nDB: {1}", WebServiceUrl, WebServiceDbName); ClientAppInfoHeader header = new ClientAppInfoHeader(); header.ClientAppName = "Deploy Utility"; header.REDatabaseToUse = WebServiceDbName; AppFxWebService appFxWebService = new AppFxWebService(); appFxWebService.Url = WebServiceUrl; appFxWebService.Timeout = (TimeOutSeconds > 0 ? TimeOutSeconds * 1000 : 3000000); if (!string.IsNullOrEmpty(InfinityUserName)) { appFxWebService.Credentials = new System.Net.NetworkCredential(InfinityUserName, InfinityPassword); } else { appFxWebService.Credentials = System.Net.CredentialCache.DefaultCredentials; } try { successfulLoad = LoadItems(appFxWebService, header); } catch (Exception ex) { Log.LogErrorFromException(ex); successfulLoad = false; } return(successfulLoad); }
private void RefreshAdditionalRelationships() { //this.RELATIONSHIPS.Value.Clear(); DataListLoadRequest req = new DataListLoadRequest(); req.DataListID = new Guid("9FB22DDF-1B9E-4FBF-875A-CB7E18CBB755"); req.Parameters = new DataFormItem(); // Guid guid1; // Guid guid2; //if (this._constitHasHousehold) // { // guid1 = new Guid(this.ContextRecordId); // guid2 = this.RECIPROCALUMHSID.Value; // } //else //{ // guid1 = this.RELATEDINDIVIDUAL.Value; // guid2 = new Guid(this.ContextRecordId); //} //req.Parameters.SetValue("HOUSEHOLDCONSTITUENTID", (object)guid1); //req.Parameters.SetValue("ADDITIONALCONSTITUENTID", (object)guid2); req.SecurityContext = this.GetRequestSecurityContext(); DataListLoadReply dataListLoadReply = new AppFxWebService(this.GetRequestContext()).DataListLoad(req); if (dataListLoadReply == null || Enumerable.Count <DataListResultRow>((IEnumerable <DataListResultRow>)dataListLoadReply.Rows) <= 0) { return; } DataListResultRow[] dataListResultRowArray = dataListLoadReply.Rows; int index = 0; while (index < dataListResultRowArray.Length) { DataListResultRow dataListResultRow = dataListResultRowArray[index]; UMHSRelationshipAddFormUIModel relationshipsuiModel = new UMHSRelationshipAddFormUIModel(); Guid guid3 = new Guid(dataListResultRow.Values[0]); int num = Conversions.ToInteger(dataListResultRow.Values[1]); string str1 = dataListResultRow.Values[2]; string str2 = dataListResultRow.Values[3]; string str3 = dataListResultRow.Values[4]; string str4 = dataListResultRow.Values[5]; Guid relationshipTypeCodeID = dataListResultRow.Values[6] == null ? Guid.Empty : new Guid(dataListResultRow.Values[6]); Guid reciprocalTypeCodeID = dataListResultRow.Values[7] == null ? Guid.Empty : new Guid(dataListResultRow.Values[7]); //relationshipsuiModel.RECIPROCALCONSTITUENTID.Value = guid3; //relationshipsuiModel.RECIPROCALCONSTITUENTID.Value = guid2; relationshipsuiModel.RECIPROCALUMHSID.Value = guid3; //relationshipsuiModel.RECIPROCALUMHSID.Value = guid2; //relationshipsuiModel.UMHSTYPE.Value = num; if (string.IsNullOrEmpty(str4)) //**It shoudl be RECIPROCALPATIENTNAME { relationshipsuiModel.PATIENTNAME.Value = string.Format((IFormatProvider)CultureInfo.CurrentCulture, "Individual is the", new object[2] { (object)str1, (object)ConstituentHelper.MakeStringPossessive(str3) }); } else { //shoudl be RECIPROCALPATIENTNAME instead of PATIENTNAME here relationshipsuiModel.PATIENTNAME.Value = string.Format((IFormatProvider)CultureInfo.CurrentCulture, "Individual is the", (object)str1, (object)ConstituentHelper.MakeStringPossessive(str2), (object)str4, (object)ConstituentHelper.MakeStringPossessive(str3)); } relationshipsuiModel.PATIENTNAME.Value = string.Format((IFormatProvider)CultureInfo.CurrentCulture, "Individual is the", new object[1] { (object)str3 }); relationshipsuiModel.PATIENTNAME.Enabled = false; relationshipsuiModel.PATIENTNAME.Enabled = false; //should be RECIPROCALPATIENTNAME relationshipsuiModel.SetExistingRelationship(relationshipTypeCodeID, reciprocalTypeCodeID); // this.RELATIONSHIPS.Value.Add(relationshipsuiModel); checked { ++index; } } }