public SlackBinding(ParameterInfo parameter, SlackAttribute attribute, SlackConfiguration config, INameResolver nameResolver, BindingProviderContext context) { _parameter = parameter; _attribute = attribute; _config = config; _nameResolver = nameResolver; if (!string.IsNullOrEmpty(_attribute.WebHookUrl)) { _webHookUrlBindingTemplate = CreateBindingTemplate(_attribute.WebHookUrl, context.BindingDataContract); } if (!string.IsNullOrEmpty(_attribute.Text)) { _textBindingTemplate = CreateBindingTemplate(_attribute.Text, context.BindingDataContract); } if (!string.IsNullOrEmpty(_attribute.Username)) { _usernameBindingTemplate = CreateBindingTemplate(_attribute.Username, context.BindingDataContract); } if (!string.IsNullOrEmpty(_attribute.IconEmoji)) { _iconEmojiBindingTemplate = CreateBindingTemplate(_attribute.IconEmoji, context.BindingDataContract); } if (!string.IsNullOrEmpty(_attribute.Channel)) { _channelBindingTemplate = CreateBindingTemplate(_attribute.Channel, context.BindingDataContract); } }
public void AddBindingBlurb(string bindingKey, bool chained) { BindingTemplate binding = new BindingTemplate(bindingKey); binding.Get(); string text = (null != binding.AccessPoint ? binding.AccessPoint.Value : Localization.GetString("HEADING_BINDING")); string tooltip = Localization.GetString("HEADING_BINDING"); string url = root; if (BreadCrumbType.Edit == type) { url += "/edit/editbinding.aspx?refreshExplorer=&key="; } else { url += "/details/bindingdetail.aspx?search=" + Request["search"] + "&key="; } url += bindingKey + "&frames=" + frames.ToString().ToLower(); AddServiceBlurb(binding.ServiceKey, true); if (chained) { AddBlurb(text, url, null, tooltip, true); } else { AddBlurb(text, null, "binding.gif", tooltip, false); } }
public FileBinding(IOptions <FilesOptions> options, ParameterInfo parameter, BindingTemplate bindingTemplate) { _options = options; _parameter = parameter; _bindingTemplate = bindingTemplate; _attribute = _parameter.GetCustomAttribute <FileAttribute>(inherit: false); }
private void InitBindingList() { if (_bindingEntities == null) { _bindingEntities = new BindingTemplate <Country>(); } if (_bindingEntities.Count > 0) { _bindingEntities.Clear(); } if (_countrylist != null) { foreach (Country c in _countrylist) { if (c.LanguageID > 0) { Language lng = ClientEnvironment.LanguageService.FindById(c.CountryLanguage); c.LanguageName = (lng != null) ? lng.Name : String.Empty; } } _bindingEntities.CopyList(_countrylist); } if (gridControlCountries.DataSource == null) { gridControlCountries.DataSource = _bindingEntities; } }
internal static bool IsDisabledBySetting(string settingName, MethodInfo method, INameResolver nameResolver) { if (nameResolver != null) { settingName = nameResolver.ResolveWholeString(settingName); } BindingTemplate bindingTemplate = BindingTemplate.FromString(settingName); Dictionary <string, string> bindingData = new Dictionary <string, string>(); bindingData.Add("MethodName", string.Format(CultureInfo.InvariantCulture, "{0}.{1}", method.DeclaringType.Name, method.Name)); bindingData.Add("MethodShortName", method.Name); settingName = bindingTemplate.Bind(bindingData); // check the target setting and return false (disabled) if the value exists // and is "falsey" string value = ConfigurationUtility.GetSettingFromConfigOrEnvironment(settingName); if (!string.IsNullOrEmpty(value) && (string.Compare(value, "1", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(value, "true", StringComparison.OrdinalIgnoreCase) == 0)) { return(true); } return(false); }
public static string GetBoundScope(string scope, IReadOnlyDictionary <string, object> bindingData) { BindingTemplate bindingTemplate = BindingTemplate.FromString(scope); IReadOnlyDictionary <string, string> parameters = BindingDataPathHelper.ConvertParameters(bindingData); return(bindingTemplate.Bind(parameters)); }
public void Bind_DotExpression_IsLateBound() { // Use same binding expression with different binding data inputs and it resolves dynamically. BindingTemplate template = BindingTemplate.FromString(@"container/{a.b.c}"); var parameters1 = new Dictionary <string, object> { { "a", new { b = new { c = "first" } } } }; var parameters2 = new Dictionary <string, object> { { "a", new { b = new { c = 123, d = 456 }, b2 = 789 } } }; string result = template.Bind(parameters1); Assert.Equal(@"container/first", result); string result2 = template.Bind(parameters2); Assert.Equal(@"container/123", result2); }
public void InitControl(List <WorkingModel> lst) { if (lst != null) { _listEntities = new BindingTemplate <WorkingModel>(lst); } else { _listEntities = new BindingTemplate <WorkingModel>(); } if (Country != null) { //GetCountryLunchModel List <WorkingModel> lll = ClientEnvironment.WorkingModelService.GetCountryLunchModel(Country.ID, null, null); _listEntities.CopyList(lll); } if (_listEntities != null && _listEntities.Count > 0) { LoadUsedWorkingModels(); } gridControlLunch.DataSource = _listEntities; }
public SendGridBinding(ParameterInfo parameter, SendGridAttribute attribute, SendGridConfiguration config, INameResolver nameResolver, BindingProviderContext context) { _parameter = parameter; _attribute = attribute; _config = config; _nameResolver = nameResolver; _sendGrid = new Web(_config.ApiKey); if (!string.IsNullOrEmpty(_attribute.To)) { _toFieldBindingTemplate = CreateBindingTemplate(_attribute.To, context.BindingDataContract); } if (!string.IsNullOrEmpty(_attribute.From)) { _fromFieldBindingTemplate = CreateBindingTemplate(_attribute.From, context.BindingDataContract); } if (!string.IsNullOrEmpty(_attribute.Subject)) { _subjectFieldBindingTemplate = CreateBindingTemplate(_attribute.Subject, context.BindingDataContract); } if (!string.IsNullOrEmpty(_attribute.Text)) { _textFieldBindingTemplate = CreateBindingTemplate(_attribute.Text, context.BindingDataContract); } }
public FileBinding(FilesConfiguration config, ParameterInfo parameter, BindingTemplate bindingTemplate) { _config = config; _parameter = parameter; _bindingTemplate = bindingTemplate; _attribute = _parameter.GetCustomAttribute <FileAttribute>(inherit: false); }
private static IBindableServiceBusPath CreateProductUnderTest(string queueOrTopicNamePattern) { BindingTemplate template = BindingTemplate.FromString(queueOrTopicNamePattern); IBindableServiceBusPath path = new ParameterizedServiceBusPath(template); return(path); }
/// <summary> /// 获取到下一个轮询的值 /// </summary> /// <param name="binding"></param> /// <param name="cnt"></param> /// <returns></returns> private static Int32 GetRoundRobin(BindingTemplate binding, Int32 cnt) { String key = binding.ServiceID + "_" + binding.Version.ToString(); if (!m_CallRecord.ContainsKey(key)) { lock (m_CallRecord) { m_CallRecord.Add(key, 0); } return 0; } else { Int32 index = m_CallRecord[key]; if (index == (cnt - 1)) { index = 0; } else { index++; } lock (m_CallRecord) { m_CallRecord[key] = index; } return index; } }
public static string GetServiceLocation() { Console.WriteLine("Querying UDDI Registry..."); //Assign the network endpoint of UDDI Web services Inquire.Url = "http://test.uddi.microsoft.com/inquire"; //Find the provider FindBusiness findProvider = new FindBusiness(); findProvider.Names.Add("Vendor A"); BusinessList providerList = findProvider.Send(); BusinessInfo provider = providerList.BusinessInfos[0]; ServiceInfo providerService = provider.ServiceInfos[0]; //Find the Service details GetServiceDetail findService = new GetServiceDetail(); findService.ServiceKeys.Add(providerService.ServiceKey); ServiceDetail sd = findService.Send(); BusinessService service = sd.BusinessServices[0]; BindingTemplate template = service.BindingTemplates[0]; //Retrieve the service URL Console.WriteLine("Provider Endpoint : " + template.AccessPoint.Text); return(template.AccessPoint.Text); }
protected void Binding_Delete(object sender, DataGridCommandEventArgs e) { BindingTemplate binding = bindings[e.Item.ItemIndex]; string name; if (null != binding.AccessPoint) { name = binding.AccessPoint.Value; } else { name = Localization.GetString("HEADING_BINDING"); } string key = binding.BindingKey; // // The user has not yet confirmed the delete operation, so display // a confirmation dialog. // string message = String.Format( Localization.GetString("TEXT_DELETE_CONFIRMATION"), name); Page.RegisterStartupScript( "Confirm", ClientScripts.Confirm( message, "editbinding.aspx?frames=" + (frames ? "true" : "false") + "&key=" + key + "&mode=delete&confirm=true&tab=1")); }
public void ReBuildByWgr(HwgrToWgr wgr, BindingTemplate <BaseTreeItem> lst) { if (lst != null) { List <BaseTreeItem> detect = new List <BaseTreeItem>(); detect.AddRange(lst); foreach (BaseTreeItem item in detect) { if (!item.IsHwgr && (item as WgrTreeItem).Wgr.WGR_ID == wgr.WGR_ID) { lst.Remove(item); } } foreach (HwgrToWgr item in GetWgrHistoty()) { if (item.BeginTime <= m_filterDate && item.EndTime >= m_filterDate) { long parentid = 0; foreach (BaseTreeItem var in lst) { if (var.IsHwgr && (var as HwgrTreeItem).Hwgr.HWGR_ID == item.HWGR_ID) { parentid = var.ID; break; } } lst.Add(new WgrTreeItem(item, parentid)); } } lst.ClearRemoveList(); } }
private static BindingTemplate CreateBindingTemplate(string value) { return (value != null ? BindingTemplate.FromString(value) : null); }
public TableBinding(ScriptHostConfiguration config, TableBindingMetadata metadata, FileAccess access) : base(config, metadata, access) { if (string.IsNullOrEmpty(metadata.TableName)) { throw new ArgumentException("The table name cannot be null or empty."); } TableName = metadata.TableName; PartitionKey = metadata.PartitionKey; if (!string.IsNullOrEmpty(PartitionKey)) { _partitionKeyBindingTemplate = BindingTemplate.FromString(PartitionKey); } RowKey = metadata.RowKey; if (!string.IsNullOrEmpty(RowKey)) { _rowKeyBindingTemplate = BindingTemplate.FromString(RowKey); } Filter = metadata.Filter; if (!string.IsNullOrEmpty(Filter)) { _filterBindingTemplate = BindingTemplate.FromString(Filter); } Take = metadata.Take ?? 50; }
public RedisEntity(RedisAccount account, BindingTemplate channelOrKeyPath, Mode mode, IReadOnlyDictionary <string, object> bindingData) { Account = account; Mode = mode; _channelOrKeyPath = channelOrKeyPath; _bindingData = bindingData; }
public Task <IBinding> TryCreateAsync(BindingProviderContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } ParameterInfo parameter = context.Parameter; FtpAttribute attribute = parameter.GetCustomAttribute <FtpAttribute>(inherit: false); if (attribute == null) { return(Task.FromResult <IBinding>(null)); } string path = attribute.Path; if (_nameResolver != null) { path = _nameResolver.ResolveWholeString(path); } BindingTemplate bindingTemplate = BindingTemplate.FromString(path); bindingTemplate.ValidateContractCompatibility(context.BindingDataContract); IEnumerable <Type> types = StreamValueBinder.GetSupportedTypes(FileAccess.Read); if (!ValueBinder.MatchParameterType(context.Parameter, types)) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Can't bind FtpAttribute to type '{0}'.", parameter.ParameterType)); } return(Task.FromResult <IBinding>(new FtpBinding(_config, parameter, bindingTemplate))); }
/// <summary> /// Creates the binding template. /// </summary> /// <param name="bAccessPoint">The access point.</param> /// <returns></returns> public static BindingTemplate CreateBindingTemplate(AccessPoint bAccessPoint) { BindingTemplate bTemplate = new BindingTemplate(); bTemplate.AccessPoint = bAccessPoint; return(bTemplate); }
public string TemplateBind(PropertyInfo propInfo, Attribute attribute, BindingTemplate template, IReadOnlyDictionary <string, object> bindingData) { // set some internal state for the binding rules to use later ((AttributeWithResolutionPolicy)attribute).ResolutionData = "value1"; return(template.Bind(bindingData)); }
/// <summary> /// 获取到下一个轮询的值 /// </summary> /// <param name="binding"></param> /// <param name="cnt"></param> /// <returns></returns> private static Int32 GetRoundRobin(BindingTemplate binding, Int32 cnt) { String key = binding.ServiceID + "_" + binding.Version.ToString(); if (!m_CallRecord.ContainsKey(key)) { lock (m_CallRecord) { m_CallRecord.Add(key, 0); } return(0); } else { Int32 index = m_CallRecord[key]; if (index == (cnt - 1)) { index = 0; } else { index++; } lock (m_CallRecord) { m_CallRecord[key] = index; } return(index); } }
public ParameterizedServiceBusPath(BindingTemplate template) { Debug.Assert(template != null, "template must not be null"); Debug.Assert(template.ParameterNames.Count() > 0, "template must contain one or more parameters"); _template = template; }
public void Bind_DotExpression_With_JObject(string templateSource, string value, string error) { JObject jobj = new JObject(); jobj["prop"] = "bar"; jobj["x-header"] = "header"; jobj["null"] = null; var parameters = new Dictionary <string, object> { { "a", jobj }, { "null", null } }; BindingTemplate template = BindingTemplate.FromString(templateSource); if (error != null) { ExceptionAssert.ThrowsInvalidOperation(() => template.Bind(parameters), error); } else { string result = template.Bind(parameters); Assert.Equal(value, result); } }
public static IBindableBlobPath Create(string pattern, bool isContainerBinding = false) { BlobPath parsedPattern = null; // try blob/container pattern from url or string if (!BlobPath.TryParseAbsUrl(pattern, out parsedPattern) && !BlobPath.TryParse(pattern, isContainerBinding, out parsedPattern)) { // if failed => not blob/container pattern // we try pattern url BindingTemplate urlTemplate = BindingTemplate.FromString(pattern); if (urlTemplate.ParameterNames.Count() == 1) { return(new ParameterizedBlobUrl(urlTemplate)); } throw new FormatException($"Invalid blob path '{pattern}'. Paths must be in the format 'container/blob' or 'blob Url'."); } BindingTemplate containerNameTemplate = BindingTemplate.FromString(parsedPattern.ContainerName); BindingTemplate blobNameTemplate = BindingTemplate.FromString(parsedPattern.BlobName); if (containerNameTemplate.HasParameters || blobNameTemplate.HasParameters) { return(new ParameterizedBlobPath(containerNameTemplate, blobNameTemplate)); } BlobClient.ValidateContainerName(parsedPattern.ContainerName); if (!string.IsNullOrEmpty(parsedPattern.BlobName)) { BlobClient.ValidateBlobName(parsedPattern.BlobName); } return(new BoundBlobPath(parsedPattern)); }
private static string TemplateBind(BindingTemplate template, IReadOnlyDictionary <string, object> bindingData) { if (bindingData == null) { return(template.Pattern); } return(template.Bind(bindingData)); }
public ParameterizedTableEntityPath(BindingTemplate tableNameTemplate, BindingTemplate partitionKeyTemplate, BindingTemplate rowKeyTemplate) { Debug.Assert(tableNameTemplate.HasParameters || partitionKeyTemplate.HasParameters || rowKeyTemplate.HasParameters); _tableNameTemplate = tableNameTemplate; _partitionKeyTemplate = partitionKeyTemplate; _rowKeyTemplate = rowKeyTemplate; }
public ParameterizedBlobPath(BindingTemplate containerNameTemplate, BindingTemplate blobNameTemplate) { Debug.Assert(containerNameTemplate != null); Debug.Assert(blobNameTemplate != null); _containerNameTemplate = containerNameTemplate; _blobNameTemplate = blobNameTemplate; }
// AutoResolve internal static BindingDataResolver GetTemplateResolver(string originalValue, AutoResolveAttribute attr, INameResolver nameResolver, PropertyInfo propInfo, BindingDataContract contract) { string resolvedValue = nameResolver.ResolveWholeString(originalValue); var template = BindingTemplate.FromString(resolvedValue); IResolutionPolicy policy = GetPolicy(attr.ResolutionPolicyType, propInfo); template.ValidateContractCompatibility(contract); return((newAttr, bindingData) => TemplateBind(policy, propInfo, newAttr, template, bindingData)); }
public void Initialize(TModelInstanceInfoCollection instanceInfos, BindingTemplate parent, bool allowEdit) { this.instanceInfos = instanceInfos; this.parent = parent; grid.Columns[0].Visible = allowEdit; grid.Columns[1].Visible = allowEdit; grid.Columns[2].Visible = !allowEdit; }
/// <summary> /// Verifies that the specified binding contract contains contract members for each of the /// parameters in the specified <see cref="BindingTemplate"/>. /// </summary> /// <param name="bindingTemplate">The binding template to validate.</param> /// <param name="bindingDataContract">The data contract to validate against.</param> public static void ValidateContractCompatibility(this BindingTemplate bindingTemplate, IReadOnlyDictionary <string, Type> bindingDataContract) { if (bindingTemplate == null) { throw new ArgumentNullException("bindingTemplate"); } ValidateContractCompatibility(bindingTemplate.ParameterNames, bindingDataContract); }
/// <summary> /// 增加审计日志 /// </summary> public static String AddAuditLog(int status , BindingTemplate binding , CallState callState , String message , ESB.Core.Schema.服务请求 request , Int32 isCache = 0) { return AddAuditLog(status, binding.TemplateID, binding.ServiceID, binding.Address , callState , message, request, isCache); }
public void InitControl() { if (_listLanguages == null) { List<Language> lst = ClientEnvironment.LanguageService.FindAll(); _listLanguages = new BindingTemplate<Language>(); _listLanguages.CopyList(lst); lookUpEdit1.Properties.DataSource = _listLanguages; } }
/// <summary> /// 增加审计日志 /// </summary> public static String AddAuditLog(int status , BindingTemplate binding , DateTime reqBeginTime , DateTime reqEndTime , DateTime callBeginTime , DateTime callEndTime , String message , ESB.Core.Schema.服务请求 request) { return AddAuditLog(status, binding.TemplateID.ToString(), binding.ServiceID.ToString(), binding.Address.ToString() , reqBeginTime, reqEndTime, callBeginTime, callEndTime , message, request); }
public void InitControl(IList listLanguages) { if (listLanguages != null) { if (_listLanguages == null) { _listLanguages = new BindingTemplate<Language>(); } _listLanguages.Clear(); _listLanguages.CopyList(listLanguages); if (lookUpEdit1.Properties.DataSource == null) lookUpEdit1.Properties.DataSource = _listLanguages; } }
private void InitBindingList() { if (_bindingEntities == null) _bindingEntities = new BindingTemplate<Country>(); if (_bindingEntities.Count > 0) _bindingEntities.Clear(); if (_countrylist != null) { foreach (Country c in _countrylist) { if (c.LanguageID > 0) { Language lng = ClientEnvironment.LanguageService.FindById(c.CountryLanguage); c.LanguageName = (lng != null) ? lng.Name : String.Empty; } } _bindingEntities.CopyList(_countrylist); } if (gridControlCountries.DataSource == null) gridControlCountries.DataSource = _bindingEntities; }
void Clear() { if (ListOfAvgWDInWeek == null) ListOfAvgWDInWeek = new BindingTemplate<AvgWorkingDaysInWeek>(); ListOfAvgWDInWeek.Clear(); if (_listAmounts != null) _listAmounts.Clear(); gridControlAvgWDiWeek.DataSource = null; }
/// <summary> /// 抛出异常并写日志, 并需要记录异常的时间 /// </summary> /// <param name="message"></param> /// <param name="binding"></param> /// <param name="request"></param> public static Exception ExceptionAndLog(CallState state, String exceptionDesc, String message, BindingTemplate binding, ESB.Core.Schema.服务请求 request) { String messageID = String.Empty; String exceptionMessage = String.Format("{0}:{1}", exceptionDesc, message); if (state.CallBeginTime.Year != DateTime.Now.Year) state.CallBeginTime = DateTime.Now; if (state.CallEndTime.Year != DateTime.Now.Year) state.CallEndTime = DateTime.Now; if (binding != null) messageID = AddAuditLog(0, binding, state , exceptionMessage, request); else messageID = AddAuditLog(0, "00000000-0000-0000-0000-000000000000" , String.Empty, string.Empty, state, exceptionMessage, request); ExceptionCoreTb exception = new ExceptionCoreTb() { ExceptionID = Guid.NewGuid().ToString(), BindingTemplateID = binding == null ? "" : binding.TemplateID, BindingType = 0, Description = exceptionDesc, ExceptionCode = String.Empty, ExceptionInfo = exceptionMessage, ExceptionLevel = 0, ExceptionStatus = 0, ExceptionTime = DateTime.Now, ExceptionType = 0, HostName = request.主机名称, MessageBody = request.消息内容, MessageID = messageID, MethodName = request.方法名称, RequestPwd = request.密码, RequestType = 0 }; //exception.Insert(); ESBProxy.GetInstance().MessageQueueClient.SendExceptionMessage(exception); return new Exception(message); }
/// <summary> /// 抛出异常并写日志 /// </summary> /// <param name="message"></param> /// <param name="binding"></param> /// <param name="request"></param> public static Exception ExceptionAndLog(String exceptionDesc, String message, BindingTemplate binding, ESB.Core.Schema.服务请求 request) { CallState state = new CallState() { RequestBeginTime = DateTime.Now, RequestEndTime = DateTime.Now, CallBeginTime = DateTime.Now, CallEndTime = DateTime.Now }; return ExceptionAndLog(state, exceptionDesc, message, binding, request); }
public void InitControl(List<WorkingModel> lst) { if (lst != null) _listEntities = new BindingTemplate<WorkingModel>(lst); else _listEntities = new BindingTemplate<WorkingModel>(); if (Country != null) { //GetCountryLunchModel List<WorkingModel> lll = ClientEnvironment.WorkingModelService.GetCountryLunchModel(Country.ID, null, null); _listEntities.CopyList(lll); } if (_listEntities != null && _listEntities.Count > 0) LoadUsedWorkingModels(); gridControlLunch.DataSource = _listEntities; }
public void InsertBindingTemplate(BindingTemplate entity) { if (String.IsNullOrEmpty(entity.TemplateID)) entity.TemplateID = Guid.NewGuid().ToString(); entity.Insert(); esbProxy.RegistryConsumerClient.ResendServiceConfig(); }
void Clear() { if (ListOfUnavAddHours == null) ListOfUnavAddHours = new BindingTemplate<CountryAdditionalHour>(); ListOfUnavAddHours.Clear(); gridControl_UnAdHours.DataSource = null; }
public void DeleteBindingTemplate(BindingTemplate entity) { entity.Delete(); esbProxy.RegistryConsumerClient.ResendServiceConfig(); }
/// <summary> /// Stabileste ontologia (daca este specificata) pentru serviciul ce urmeza a fi publicat. /// </summary> /// <param name="newBindingTemplate">Serviciul (accessPoint) ce urmeaza a fi publicat.</param> private void selectOntologyForNewBindingTemplate(BindingTemplate newBindingTemplate) { if( cbxOntology.SelectedIndex > 0 ) { TModelInstanceInfo tModelInstanceInfo = new TModelInstanceInfo(); tModelInstanceInfo.TModelKey = ((List < OntInfo >)cbxOntology.Tag)[cbxOntology.SelectedIndex - 1].tModelKey; newBindingTemplate.TModelInstanceInfos.Add(tModelInstanceInfo); } }
/// <summary> /// Publica serviciul cu informatiile specificate in campurile corespunzatoare (daca nu exista deja). /// </summary> public void performPublish() { String businessName = txbBusinessName.Text.Trim(); String serviceName = txbServiceName.Text.Trim(); String accessPoint = txbAccessPoint.Text.Trim(); if (businessName == String.Empty || serviceName == String.Empty || accessPoint == String.Empty) { MessageBox.Show("All values must be set", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { FindBusiness findBusiness = new FindBusiness(businessName); findBusiness.FindQualifiers.Add(FindQualifier.ExactNameMatch); BusinessList businessList = findBusiness.Send(uddiConnection); if (0 == businessList.BusinessInfos.Count) { BusinessEntity newBusinessEntity = new BusinessEntity(businessName); BusinessService newBusinessService = new BusinessService(serviceName); newBusinessEntity.BusinessServices.Add(newBusinessService); BindingTemplate newBindingTemplate = new BindingTemplate(); newBindingTemplate.AccessPoint.Text = accessPoint; newBindingTemplate.AccessPoint.UrlType = UrlType.Http; selectOntologyForNewBindingTemplate(newBindingTemplate); newBusinessService.BindingTemplates.Add(newBindingTemplate); SaveBusiness saveNewBusiness = new SaveBusiness(newBusinessEntity); saveNewBusiness.Send(uddiConnection); } else { MessageBox.Show("Business already exists"); GetBusinessDetail getBusinessDetail = new GetBusinessDetail(businessList.BusinessInfos[0].BusinessKey); BusinessDetail businessDetail = getBusinessDetail.Send(uddiConnection); BusinessEntity oldBusinessEntity = businessDetail.BusinessEntities[0]; FindService findService = new FindService(serviceName); findService.FindQualifiers.Add(FindQualifier.ExactNameMatch); findService.BusinessKey = businessDetail.BusinessEntities[0].BusinessKey; ServiceList serviceList = findService.Send(uddiConnection); if (0 == serviceList.ServiceInfos.Count) { BusinessService newBusinessService = new BusinessService(serviceName); oldBusinessEntity.BusinessServices.Add(newBusinessService); BindingTemplate newBindingTemplate = new BindingTemplate(); newBindingTemplate.AccessPoint.Text = accessPoint; newBindingTemplate.AccessPoint.UrlType = UrlType.Http; selectOntologyForNewBindingTemplate(newBindingTemplate); newBusinessService.BindingTemplates.Add(newBindingTemplate); SaveBusiness saveOldBusiness = new SaveBusiness(oldBusinessEntity); saveOldBusiness.Send(uddiConnection); } else { MessageBox.Show("Service already exists"); GetServiceDetail getServiceDetail = new GetServiceDetail(serviceList.ServiceInfos[0].ServiceKey); ServiceDetail serviceDetail = getServiceDetail.Send(uddiConnection); BusinessService oldBusinessService = serviceDetail.BusinessServices[0]; foreach (BindingTemplate bindingTemplate in oldBusinessService.BindingTemplates) { if (bindingTemplate.AccessPoint.Text == accessPoint) { MessageBox.Show("Binding already exists"); return; } } BindingTemplate newBindingTemplate = new BindingTemplate(); newBindingTemplate.AccessPoint.Text = accessPoint; newBindingTemplate.AccessPoint.UrlType = UrlType.Http; selectOntologyForNewBindingTemplate(newBindingTemplate); oldBusinessService.BindingTemplates.Add(newBindingTemplate); SaveService saveOldService = new SaveService(oldBusinessService); saveOldService.Send(uddiConnection); } } MessageBox.Show("Publish successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (UddiException e) { MessageBox.Show("Uddi error: "+ e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception e){ MessageBox.Show("General exception: " + e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void Clear() { if (_bindingWeeks == null) _bindingWeeks = new BindingTemplate<AvgAmount>(); _bindingWeeks.Clear(); if (_listAmounts != null) _listAmounts.Clear(); gridControl.DataSource = null; }