Beispiel #1
0
        /// <summary>
        /// Gets the disability values for the drop down list.
        /// </summary>
        private void GetDisability()
        {
            ContactServiceClient contactService = null;

            try
            {
                contactService = new ContactServiceClient();
                CollectionRequest        collectionRequest = new CollectionRequest();
                DisabilitySearchCriteria searchCriteria    = new DisabilitySearchCriteria();
                searchCriteria.IncludeArchived = false;
                DisabilitySearchReturnValue returnValue = contactService.DisabilitySearch(_logonId,
                                                                                          collectionRequest, searchCriteria);
                if (returnValue.Success)
                {
                    _ddlDisability.DataSource     = returnValue.Disabilities.Rows;
                    _ddlDisability.DataTextField  = "Description";
                    _ddlDisability.DataValueField = "Id";
                    _ddlDisability.DataBind();
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (contactService != null)
                {
                    if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        contactService.Close();
                    }
                }
            }
        }
 /// <summary>
 /// Gets the disability values for the drop down list.
 /// </summary>
 private void GetDisability()
 {
     ContactServiceClient contactService = null;
     try
     {
         contactService = new ContactServiceClient();
         CollectionRequest collectionRequest = new CollectionRequest();
         DisabilitySearchCriteria searchCriteria = new DisabilitySearchCriteria();
         searchCriteria.IncludeArchived = false;
         DisabilitySearchReturnValue returnValue = contactService.DisabilitySearch(_logonId,
                                                         collectionRequest, searchCriteria);
         if (returnValue.Success)
         {
             _ddlDisability.DataSource = returnValue.Disabilities.Rows;
             _ddlDisability.DataTextField = "Description";
             _ddlDisability.DataValueField = "Id";
             _ddlDisability.DataBind();
         }
         else
         {
             throw new Exception(returnValue.Message);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         if (contactService != null)
         {
             if (contactService.State != System.ServiceModel.CommunicationState.Faulted)
                 contactService.Close();
         }
     }
 }