public string GetFormattedCityStateZip() { var sb = new StringBuilder(); if (CityEnabled && City.HasValue()) { sb.Append(City); if ((StateProvinceEnabled && StateProvinceName.HasValue()) || (ZipPostalCodeEnabled && ZipPostalCode.HasValue())) { sb.Append(", "); } } if (StateProvinceEnabled && StateProvinceName.HasValue()) { sb.Append(StateProvinceName); if (ZipPostalCodeEnabled && ZipPostalCode.HasValue()) { sb.Append(" "); } } if (ZipPostalCodeEnabled && ZipPostalCode.HasValue()) { sb.Append(ZipPostalCode); } return(sb.ToString()); }
protected override void Execute(CodeActivityContext executionContext) { // Extract the tracing service ITracingService tracingService = executionContext.GetExtension <ITracingService>(); try { //Create the context IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); // Don't Really Care about which entity this is DynamicUrlParser parser = new DynamicUrlParser(); EntityReference primaryEntity = parser.ConvertToEntityReference(service, RecordUrl.Get <string>(executionContext)); string addressLine1 = Street1.Get <string>(executionContext); string addressLine2 = Street2.Get <string>(executionContext); string city = City.Get <string>(executionContext); string stateOrProvince = StateOrProvince.Get <string>(executionContext); string zipCode = ZipPostalCode.Get <string>(executionContext); string countryName = Country.Get <string>(executionContext); string rc = GenerateAddress(addressLine1, addressLine2, city, stateOrProvince, zipCode, countryName); FullAddress.Set(executionContext, rc); } catch (FaultException <OrganizationServiceFault> ex) { throw new Exception("SBS.Workflow.SetStateChildRecords: " + ex.Message); } }