Beispiel #1
0
        private void GetCampaigns(DropDownList dropDownList)
        {
            ContactServiceClient contactService = null;

            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest         collectionRequest = new CollectionRequest();
                CampaignSearchCriteria    searchCriteria    = new CampaignSearchCriteria();
                CampaignSearchReturnValue returnValue       = contactService.CampaignSearch(_logonId, collectionRequest,
                                                                                            searchCriteria);

                if (returnValue.Success)
                {
                    dropDownList.DataSource     = returnValue.Campaigns.Rows;
                    dropDownList.DataTextField  = "Description";
                    dropDownList.DataValueField = "CampaignId";
                    dropDownList.DataBind();
                    dropDownList.Items.Insert(0, "");
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        contactService.Close();
                    }
                }
            }
        }
        private void GetCampaigns(DropDownList dropDownList)
        {
            ContactServiceClient contactService = null;
            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest collectionRequest = new CollectionRequest();
                CampaignSearchCriteria searchCriteria = new CampaignSearchCriteria();
                CampaignSearchReturnValue returnValue = contactService.CampaignSearch(_logonId, collectionRequest,
                                                                                       searchCriteria);

                if (returnValue.Success)
                {
                    dropDownList.DataSource = returnValue.Campaigns.Rows;
                    dropDownList.DataTextField = "Description";
                    dropDownList.DataValueField = "CampaignId";
                    dropDownList.DataBind();
                    dropDownList.Items.Insert(0, "");
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                        contactService.Close();
                }
            }
        }