Exemplo n.º 1
0
        /// <summary>
        /// Get a Account by their Guid
        /// </summary>
        /// <param name="system"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public MicrosoftDynamicsCRMaccount GetAccountByNameWithEstablishments(string name)
        {
            name = name.Replace("'", "''");
            string[] expand = { "primarycontactid", "adoxio_account_adoxio_establishment_Licencee" };

            MicrosoftDynamicsCRMaccount result;

            try
            {
                string filter = $"name eq '{name}'";
                // fetch from Dynamics.
                result = Accounts.Get(filter: filter).Value.FirstOrDefault();

                if (result != null)
                {
                    result = Accounts.GetByKey(result.Accountid, expand: expand);
                }
            }
            catch (HttpOperationException)
            {
                result = null;
            }


            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a Account by their Guid
        /// </summary>
        /// <param name="system"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public MicrosoftDynamicsCRMaccount GetAccountByIdWithChildren(string id)
        {
            MicrosoftDynamicsCRMaccount result;

            try
            {
                string[] expand = { "primarycontactid",
                                    "Account_SharepointDocumentLocation",
                                    "adoxio_account_adoxio_legalentity_Account",
                                    "adoxio_account_adoxio_establishment_Licencee",
                                    "adoxio_account_adoxio_application_Applicant",
                                    "adoxio_licenseechangelog_ParentBusinessAccount",
                                    "adoxio_licenseechangelog_BusinessAccount",
                                    "adoxio_licenseechangelog_ShareholderBusinessAccount",
                                    "adoxio_account_adoxio_licences_Licencee",
                                    "contact_customer_accounts",
                                    "adoxio_account_tiedhouseconnections" };
                // fetch from Dynamics.
                result = Accounts.GetByKey(accountid: id, expand: expand);
            }
            catch (HttpOperationException)
            {
                result = null;
            }

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get a Account by their Guid
        /// </summary>
        /// <param name="system"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public MicrosoftDynamicsCRMaccount GetAccountById(string id)
        {
            MicrosoftDynamicsCRMaccount result;

            try
            {
                string[] expand = { "primarycontactid", "Account_SharepointDocumentLocation" };
                // fetch from Dynamics.
                result = Accounts.GetByKey(accountid: id, expand: expand);
            }
            catch (HttpOperationException)
            {
                result = null;
            }

            return(result);
        }
        /// <summary>
        /// Get a Account by their Guid
        /// </summary>
        /// <param name="system"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public MicrosoftDynamicsCRMaccount GetAccountById(string id)
        {
            MicrosoftDynamicsCRMaccount result = null;

            try
            {
                string[] expand = { "primarycontactid", "Account_SharepointDocumentLocation" };
                // fetch from Dynamics.
                if (!string.IsNullOrEmpty(id) && Guid.Parse(id) != Guid.Empty)
                {
                    result = Accounts.GetByKey(accountid: id, expand: expand);
                }
            }
            catch (Exception)
            {
                result = null;
            }

            return(result);
        }