コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the MicrosoftDynamicsCRMbulkoperation
 /// class.
 /// </summary>
 public MicrosoftDynamicsCRMbulkoperation(string bulkoperationnumber = default(string), int?importsequencenumber = default(int?), int?targetedrecordtypecode = default(int?), int?operationtypecode = default(int?), int?failurecount = default(int?), string workflowinfo = default(string), int?targetmemberscount = default(int?), string parameters = default(string), int?errornumber = default(int?), int?successcount = default(int?), int?createdrecordtypecode = default(int?), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), MicrosoftDynamicsCRMinteractionforemail regardingobjectidNewInteractionforemailBulkoperation = default(MicrosoftDynamicsCRMinteractionforemail), MicrosoftDynamicsCRMknowledgebaserecord regardingobjectidKnowledgebaserecordBulkoperation = default(MicrosoftDynamicsCRMknowledgebaserecord), MicrosoftDynamicsCRMlead regardingobjectidLeadBulkoperation = default(MicrosoftDynamicsCRMlead), MicrosoftDynamicsCRMbookableresourcebooking regardingobjectidBookableresourcebookingBulkoperation = default(MicrosoftDynamicsCRMbookableresourcebooking), MicrosoftDynamicsCRMbookableresourcebookingheader regardingobjectidBookableresourcebookingheaderBulkoperation = default(MicrosoftDynamicsCRMbookableresourcebookingheader), MicrosoftDynamicsCRMaccount regardingobjectidAccountBulkoperation = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMsystemuser createdbyBulkoperation = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMcontact regardingobjectidContactBulkoperation = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMmailbox sendermailboxidBulkoperation = default(MicrosoftDynamicsCRMmailbox), MicrosoftDynamicsCRMtransactioncurrency transactioncurrencyidBulkoperation = default(MicrosoftDynamicsCRMtransactioncurrency), MicrosoftDynamicsCRMprincipal owneridBulkoperation = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMsystemuser owninguserBulkoperation = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsla slaActivitypointerSlaBulkoperation = default(MicrosoftDynamicsCRMsla), MicrosoftDynamicsCRMbusinessunit owningbusinessunitBulkoperation = default(MicrosoftDynamicsCRMbusinessunit), MicrosoftDynamicsCRMknowledgearticle regardingobjectidKnowledgearticleBulkoperation = default(MicrosoftDynamicsCRMknowledgearticle), MicrosoftDynamicsCRMsystemuser modifiedonbehalfbyBulkoperation = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdonbehalfbyBulkoperation = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedbyBulkoperation = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteamBulkoperation = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMsla slainvokedidActivitypointerSlaBulkoperation = default(MicrosoftDynamicsCRMsla), MicrosoftDynamicsCRMactivitypointer activityidActivitypointer = default(MicrosoftDynamicsCRMactivitypointer), IList <MicrosoftDynamicsCRMactivitypointer> bulkOperationActivityPointers = default(IList <MicrosoftDynamicsCRMactivitypointer>), IList <MicrosoftDynamicsCRMsyncerror> bulkOperationSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMactivityparty> bulkoperationActivityParties = default(IList <MicrosoftDynamicsCRMactivityparty>), IList <MicrosoftDynamicsCRMasyncoperation> bulkOperationAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMmailboxtrackingfolder> bulkOperationMailboxTrackingFolder = default(IList <MicrosoftDynamicsCRMmailboxtrackingfolder>), IList <MicrosoftDynamicsCRMbulkdeletefailure> bulkOperationBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> bulkoperationPrincipalObjectAttributeAccesses = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), IList <MicrosoftDynamicsCRMappointment> bulkOperationAppointment = default(IList <MicrosoftDynamicsCRMappointment>), IList <MicrosoftDynamicsCRMemail> bulkOperationEmail = default(IList <MicrosoftDynamicsCRMemail>), IList <MicrosoftDynamicsCRMfax> bulkOperationFaxes = default(IList <MicrosoftDynamicsCRMfax>), IList <MicrosoftDynamicsCRMletter> bulkOperationLetter = default(IList <MicrosoftDynamicsCRMletter>), IList <MicrosoftDynamicsCRMphonecall> bulkOperationPhonecall = default(IList <MicrosoftDynamicsCRMphonecall>), IList <MicrosoftDynamicsCRMtask> bulkoperationTasks = default(IList <MicrosoftDynamicsCRMtask>), IList <MicrosoftDynamicsCRMrecurringappointmentmaster> bulkOperationRecurringAppointmentMaster = default(IList <MicrosoftDynamicsCRMrecurringappointmentmaster>), IList <MicrosoftDynamicsCRMsocialactivity> bulkOperationSocialActivity = default(IList <MicrosoftDynamicsCRMsocialactivity>), IList <MicrosoftDynamicsCRMannotation> bulkoperationAnnotations = default(IList <MicrosoftDynamicsCRMannotation>), IList <MicrosoftDynamicsCRMcampaignresponse> bulkOperationCampaignResponse = default(IList <MicrosoftDynamicsCRMcampaignresponse>), IList <MicrosoftDynamicsCRMbulkoperationlog> bulkOperationLogs = default(IList <MicrosoftDynamicsCRMbulkoperationlog>), MicrosoftDynamicsCRMcampaignactivity regardingobjectidCampaignactivityBulkoperation = default(MicrosoftDynamicsCRMcampaignactivity), MicrosoftDynamicsCRMlist regardingobjectidList = default(MicrosoftDynamicsCRMlist), IList <MicrosoftDynamicsCRMqueueitem> bulkOperationQueueItem = default(IList <MicrosoftDynamicsCRMqueueitem>), IList <MicrosoftDynamicsCRMincidentresolution> bulkoperationIncidentResolutions = default(IList <MicrosoftDynamicsCRMincidentresolution>), IList <MicrosoftDynamicsCRMserviceappointment> bulkoperationServiceAppointments = default(IList <MicrosoftDynamicsCRMserviceappointment>), IList <MicrosoftDynamicsCRMopportunityclose> bulkoperationOpportunityCloses = default(IList <MicrosoftDynamicsCRMopportunityclose>), IList <MicrosoftDynamicsCRMorderclose> bulkoperationOrderCloses = default(IList <MicrosoftDynamicsCRMorderclose>), IList <MicrosoftDynamicsCRMquoteclose> bulkoperationQuoteCloses = default(IList <MicrosoftDynamicsCRMquoteclose>), IList <MicrosoftDynamicsCRMcsuCasetask> bulkoperationCsuCasetasks = default(IList <MicrosoftDynamicsCRMcsuCasetask>))
 {
     Bulkoperationnumber    = bulkoperationnumber;
     Importsequencenumber   = importsequencenumber;
     Targetedrecordtypecode = targetedrecordtypecode;
     Operationtypecode      = operationtypecode;
     Failurecount           = failurecount;
     Workflowinfo           = workflowinfo;
     Targetmemberscount     = targetmemberscount;
     Parameters             = parameters;
     Errornumber            = errornumber;
     Successcount           = successcount;
     Createdrecordtypecode  = createdrecordtypecode;
     Overriddencreatedon    = overriddencreatedon;
     RegardingobjectidNewInteractionforemailBulkoperation = regardingobjectidNewInteractionforemailBulkoperation;
     RegardingobjectidKnowledgebaserecordBulkoperation    = regardingobjectidKnowledgebaserecordBulkoperation;
     RegardingobjectidLeadBulkoperation = regardingobjectidLeadBulkoperation;
     RegardingobjectidBookableresourcebookingBulkoperation       = regardingobjectidBookableresourcebookingBulkoperation;
     RegardingobjectidBookableresourcebookingheaderBulkoperation = regardingobjectidBookableresourcebookingheaderBulkoperation;
     RegardingobjectidAccountBulkoperation = regardingobjectidAccountBulkoperation;
     CreatedbyBulkoperation = createdbyBulkoperation;
     RegardingobjectidContactBulkoperation = regardingobjectidContactBulkoperation;
     SendermailboxidBulkoperation          = sendermailboxidBulkoperation;
     TransactioncurrencyidBulkoperation    = transactioncurrencyidBulkoperation;
     OwneridBulkoperation                           = owneridBulkoperation;
     OwninguserBulkoperation                        = owninguserBulkoperation;
     SlaActivitypointerSlaBulkoperation             = slaActivitypointerSlaBulkoperation;
     OwningbusinessunitBulkoperation                = owningbusinessunitBulkoperation;
     RegardingobjectidKnowledgearticleBulkoperation = regardingobjectidKnowledgearticleBulkoperation;
     ModifiedonbehalfbyBulkoperation                = modifiedonbehalfbyBulkoperation;
     CreatedonbehalfbyBulkoperation                 = createdonbehalfbyBulkoperation;
     ModifiedbyBulkoperation                        = modifiedbyBulkoperation;
     OwningteamBulkoperation                        = owningteamBulkoperation;
     SlainvokedidActivitypointerSlaBulkoperation    = slainvokedidActivitypointerSlaBulkoperation;
     ActivityidActivitypointer                      = activityidActivitypointer;
     BulkOperationActivityPointers                  = bulkOperationActivityPointers;
     BulkOperationSyncErrors                        = bulkOperationSyncErrors;
     BulkoperationActivityParties                   = bulkoperationActivityParties;
     BulkOperationAsyncOperations                   = bulkOperationAsyncOperations;
     BulkOperationMailboxTrackingFolder             = bulkOperationMailboxTrackingFolder;
     BulkOperationBulkDeleteFailures                = bulkOperationBulkDeleteFailures;
     BulkoperationPrincipalObjectAttributeAccesses  = bulkoperationPrincipalObjectAttributeAccesses;
     BulkOperationAppointment                       = bulkOperationAppointment;
     BulkOperationEmail     = bulkOperationEmail;
     BulkOperationFaxes     = bulkOperationFaxes;
     BulkOperationLetter    = bulkOperationLetter;
     BulkOperationPhonecall = bulkOperationPhonecall;
     BulkoperationTasks     = bulkoperationTasks;
     BulkOperationRecurringAppointmentMaster = bulkOperationRecurringAppointmentMaster;
     BulkOperationSocialActivity             = bulkOperationSocialActivity;
     BulkoperationAnnotations      = bulkoperationAnnotations;
     BulkOperationCampaignResponse = bulkOperationCampaignResponse;
     BulkOperationLogs             = bulkOperationLogs;
     RegardingobjectidCampaignactivityBulkoperation = regardingobjectidCampaignactivityBulkoperation;
     RegardingobjectidList            = regardingobjectidList;
     BulkOperationQueueItem           = bulkOperationQueueItem;
     BulkoperationIncidentResolutions = bulkoperationIncidentResolutions;
     BulkoperationServiceAppointments = bulkoperationServiceAppointments;
     BulkoperationOpportunityCloses   = bulkoperationOpportunityCloses;
     BulkoperationOrderCloses         = bulkoperationOrderCloses;
     BulkoperationQuoteCloses         = bulkoperationQuoteCloses;
     BulkoperationCsuCasetasks        = bulkoperationCsuCasetasks;
     CustomInit();
 }
コード例 #2
0
        public async Task <IActionResult> CreateDynamicsAccount([FromBody] ViewModels.Account item)
        {
            _logger.LogInformation(LoggingEvents.HttpPost, "Begin method " + this.GetType().Name + "." + MethodBase.GetCurrentMethod().ReflectedType.Name);
            _logger.LogDebug(LoggingEvents.HttpPost, "Account parameters: " + JsonConvert.SerializeObject(item));

            ViewModels.Account result = null;
            bool updateIfNull         = true;
            Guid tryParseOutGuid;

            bool createContact = true;

            // get UserSettings from the session
            string       temp         = _httpContextAccessor.HttpContext.Session.GetString("UserSettings");
            UserSettings userSettings = JsonConvert.DeserializeObject <UserSettings>(temp);

            _logger.LogDebug(LoggingEvents.HttpPost, "UserSettings: " + JsonConvert.SerializeObject(userSettings));

            // get account Siteminder GUID
            string accountSiteminderGuid = userSettings.SiteMinderBusinessGuid;

            if (accountSiteminderGuid == null || accountSiteminderGuid.Length == 0)
            {
                _logger.LogError(LoggingEvents.Error, "No account Siteminder Guid exernal id");
                throw new Exception("Error. No accountSiteminderGuid exernal id");
            }

            // first check to see that a contact exists.
            string contactSiteminderGuid = userSettings.SiteMinderGuid;

            if (contactSiteminderGuid == null || contactSiteminderGuid.Length == 0)
            {
                _logger.LogError(LoggingEvents.Error, "No Contact Siteminder Guid exernal id");
                throw new Exception("Error. No ContactSiteminderGuid exernal id");
            }

            // get BCeID record for the current user
            Gov.Lclb.Cllb.Interfaces.BCeIDBusiness bceidBusiness = await _bceid.ProcessBusinessQuery(userSettings.SiteMinderGuid);

            var cleanNumber = BusinessNumberSanitizer.SanitizeNumber(bceidBusiness?.businessNumber);

            if (cleanNumber != null)
            {
                bceidBusiness.businessNumber = cleanNumber;
            }

            _logger.LogDebug(LoggingEvents.HttpGet, "BCeId business: " + JsonConvert.SerializeObject(bceidBusiness));

            // get the contact record.
            MicrosoftDynamicsCRMcontact userContact = null;

            // see if the contact exists.
            try
            {
                userContact   = _dynamicsClient.GetContactByExternalId(contactSiteminderGuid);
                createContact = false;
            }
            catch (OdataerrorException odee)
            {
                _logger.LogError(LoggingEvents.Error, "Error getting contact by Siteminder Guid.");
                _logger.LogError("Request:");
                _logger.LogError(odee.Request.Content);
                _logger.LogError("Response:");
                _logger.LogError(odee.Response.Content);
                throw new OdataerrorException("Error getting contact by Siteminder Guid");
            }

            if (userContact == null)
            {
                // create the user contact record.
                userContact = new MicrosoftDynamicsCRMcontact();
                // Adoxio_externalid is where we will store the guid from siteminder.
                string sanitizedContactSiteminderId = GuidUtility.SanitizeGuidString(contactSiteminderGuid);
                userContact.AdoxioExternalid = sanitizedContactSiteminderId;
                userContact.Fullname         = userSettings.UserDisplayName;
                userContact.Nickname         = userSettings.UserDisplayName;
                if (Guid.TryParse(userSettings.UserId, out tryParseOutGuid)) // BCeid id goes here
                {
                    userContact.Employeeid = userSettings.UserId;
                }
                else // Store the BC service card id here
                {
                    userContact.Externaluseridentifier = userSettings.UserId;
                }

                if (bceidBusiness != null)
                {
                    // set contact according to item
                    userContact.Firstname     = bceidBusiness.individualFirstname;
                    userContact.Middlename    = bceidBusiness.individualMiddlename;
                    userContact.Lastname      = bceidBusiness.individualSurname;
                    userContact.Emailaddress1 = bceidBusiness.contactEmail;
                    userContact.Telephone1    = bceidBusiness.contactPhone;
                }
                else
                {
                    userContact.Firstname = userSettings.UserDisplayName.GetFirstName();
                    userContact.Lastname  = userSettings.UserDisplayName.GetLastName();
                }
                userContact.Statuscode = 1;
            }
            // this may be an existing account, as this service is used during the account confirmation process.
            MicrosoftDynamicsCRMaccount account = await _dynamicsClient.GetAccountBySiteminderBusinessGuid(accountSiteminderGuid);

            _logger.LogDebug(LoggingEvents.HttpGet, "Account by siteminder business guid: " + JsonConvert.SerializeObject(account));

            if (account == null) // do a deep create.  create 3 objects at once.
            {
                _logger.LogDebug(LoggingEvents.HttpGet, "Account is null. Do a deep create of 3 objects at once.");
                // create a new account
                account = new MicrosoftDynamicsCRMaccount();
                account.CopyValues(item, updateIfNull);
                // business type must be set only during creation, not in update (removed from copyValues() )
                account.AdoxioBusinesstype = (int)Enum.Parse(typeof(ViewModels.AdoxioApplicantTypeCodes), item.businessType, true);
                // ensure that we create an account for the current user.

                // by convention we strip out any dashes present in the guid, and force it to uppercase.
                string sanitizedAccountSiteminderId = GuidUtility.SanitizeGuidString(accountSiteminderGuid);

                account.AdoxioExternalid  = sanitizedAccountSiteminderId;
                account.Primarycontactid  = userContact;
                account.AdoxioAccounttype = (int)AdoxioAccountTypeCodes.Applicant;

                if (bceidBusiness != null)
                {
                    account.Emailaddress1      = bceidBusiness.contactEmail;
                    account.Telephone1         = bceidBusiness.contactPhone;
                    account.Address1City       = bceidBusiness.addressCity;
                    account.Address1Postalcode = bceidBusiness.addressPostal;
                    account.Address1Line1      = bceidBusiness.addressLine1;
                    account.Address1Line2      = bceidBusiness.addressLine2;
                    account.Address1Postalcode = bceidBusiness.addressPostal;
                }

                // sets Business type with numerical value found in Adoxio_applicanttypecodes
                // using account.businessType which is set in bceid-confirmation.component.ts
                account.AdoxioBusinesstype = (int)Enum.Parse(typeof(AdoxioApplicantTypeCodes), item.businessType, true);

                var legalEntity = new MicrosoftDynamicsCRMadoxioLegalentity()
                {
                    AdoxioAccount         = account,
                    AdoxioName            = item.name,
                    AdoxioIsindividual    = 0,
                    AdoxioIsapplicant     = true,
                    AdoxioLegalentitytype = account.AdoxioBusinesstype
                };

                string legalEntityString = JsonConvert.SerializeObject(legalEntity);
                _logger.LogDebug("Legal Entity before creation in dynamics --> " + legalEntityString);

                try
                {
                    legalEntity = await _dynamicsClient.Adoxiolegalentities.CreateAsync(legalEntity);
                }
                catch (OdataerrorException odee)
                {
                    string legalEntityId = _dynamicsClient.GetCreatedRecord(odee, null);
                    if (!string.IsNullOrEmpty(legalEntityId) && Guid.TryParse(legalEntityId, out Guid legalEntityGuid))
                    {
                        legalEntity = await _dynamicsClient.GetLegalEntityById(legalEntityGuid);
                    }
                    else
                    {
                        _logger.LogError(LoggingEvents.Error, "Error creating legal entity.");
                        _logger.LogError("Request:");
                        _logger.LogError(odee.Request.Content);
                        _logger.LogError("Response:");
                        _logger.LogError(odee.Response.Content);
                        throw new OdataerrorException("Error creating legal entitiy");
                    }
                }

                account.Accountid = legalEntity._adoxioAccountValue;

                // fetch the account and get the created contact.
                if (legalEntity.AdoxioAccount == null)
                {
                    legalEntity.AdoxioAccount = await _dynamicsClient.GetAccountById(Guid.Parse(account.Accountid));
                }

                if (legalEntity.AdoxioAccount.Primarycontactid == null)
                {
                    legalEntity.AdoxioAccount.Primarycontactid = await _dynamicsClient.GetContactById(Guid.Parse(legalEntity.AdoxioAccount._primarycontactidValue));
                }

                userContact.Contactid = legalEntity.AdoxioAccount._primarycontactidValue;

                legalEntityString = JsonConvert.SerializeObject(legalEntity);
                _logger.LogDebug("Legal Entity after creation in dynamics --> " + legalEntityString);

                var tiedHouse = new MicrosoftDynamicsCRMadoxioTiedhouseconnection()
                {
                };
                tiedHouse.AccountODataBind = _dynamicsClient.GetEntityURI("accounts", account.Accountid);


                try
                {
                    tiedHouse = await _dynamicsClient.AdoxioTiedhouseconnections.CreateAsync(tiedHouse);
                }
                catch (OdataerrorException odee)
                {
                    string tiedHouseId = _dynamicsClient.GetCreatedRecord(odee, null);
                    if (string.IsNullOrEmpty(tiedHouseId))
                    {
                        _logger.LogError(LoggingEvents.Error, "Error creating Tied house connection.");
                        _logger.LogError("Request:");
                        _logger.LogError(odee.Request.Content);
                        _logger.LogError("Response:");
                        _logger.LogError(odee.Response.Content);
                        throw new OdataerrorException("Error creating Tied house connection.");
                    }
                }
                catch (Exception e)
                {
                    _logger.LogError(e.Message);
                }
            }
            else // it is a new user only.
            {
                if (createContact)
                {
                    _logger.LogDebug(LoggingEvents.HttpGet, "Account is NOT null. Only a new user.");
                    try
                    {
                        userContact = await _dynamicsClient.Contacts.CreateAsync(userContact);
                    }
                    catch (OdataerrorException odee)
                    {
                        string contactId = _dynamicsClient.GetCreatedRecord(odee, null);
                        if (!string.IsNullOrEmpty(contactId) && Guid.TryParse(contactId, out Guid contactGuid))
                        {
                            userContact = await _dynamicsClient.GetContactById(contactGuid);
                        }
                        else
                        {
                            _logger.LogError(LoggingEvents.Error, "Error creating contact");
                            _logger.LogError("Request:");
                            _logger.LogError(odee.Request.Content);
                            _logger.LogError("Response:");
                            _logger.LogError(odee.Response.Content);
                            throw new OdataerrorException("Error creating contact");
                        }
                    }
                }
            }

            // always patch the userContact so it relates to the account.
            _logger.LogDebug(LoggingEvents.Save, "Patching the userContact so it relates to the account.");
            // parent customer id relationship will be created using the method here:
            //https://msdn.microsoft.com/en-us/library/mt607875.aspx
            MicrosoftDynamicsCRMcontact patchUserContact = new MicrosoftDynamicsCRMcontact();

            patchUserContact.ParentCustomerIdAccountODataBind = _dynamicsClient.GetEntityURI("accounts", account.Accountid);
            try
            {
                await _dynamicsClient.Contacts.UpdateAsync(userContact.Contactid, patchUserContact);
            }
            catch (OdataerrorException odee)
            {
                _logger.LogError(LoggingEvents.Error, "Error binding contact to account");
                _logger.LogError("Request:");
                _logger.LogError(odee.Request.Content);
                _logger.LogError("Response:");
                _logger.LogError(odee.Response.Content);
                throw new OdataerrorException("Error binding contact to account");
            }

            // if we have not yet authenticated, then this is the new record for the user.
            if (userSettings.IsNewUserRegistration)
            {
                userSettings.AccountId = account.Accountid.ToString();
                userSettings.ContactId = userContact.Contactid.ToString();

                // we can now authenticate.
                if (userSettings.AuthenticatedUser == null)
                {
                    Models.User user = new Models.User();
                    user.Active    = true;
                    user.AccountId = Guid.Parse(userSettings.AccountId);
                    user.ContactId = Guid.Parse(userSettings.ContactId);
                    user.UserType  = userSettings.UserType;
                    user.SmUserId  = userSettings.UserId;
                    userSettings.AuthenticatedUser = user;
                }

                userSettings.IsNewUserRegistration = false;

                string userSettingsString = JsonConvert.SerializeObject(userSettings);
                _logger.LogDebug("userSettingsString --> " + userSettingsString);

                // add the user to the session.
                _httpContextAccessor.HttpContext.Session.SetString("UserSettings", userSettingsString);
                _logger.LogDebug("user added to session. ");
            }
            else
            {
                _logger.LogError(LoggingEvents.Error, "Invalid user registration.");
                throw new Exception("Invalid user registration.");
            }

            //account.accountId = id;
            result = account.ToViewModel();

            _logger.LogDebug(LoggingEvents.HttpPost, "result: " +
                             JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            }));
            return(Json(result));
        }
 /// <summary>
 /// Initializes a new instance of the
 /// MicrosoftDynamicsCRMcsuCasepersondetails class.
 /// </summary>
 public MicrosoftDynamicsCRMcsuCasepersondetails(string csuAddressdescriptioncopied = default(string), int?importsequencenumber = default(int?), string csuCitycopied = default(string), int?statuscode = default(int?), string csuStateprovincecopied = default(string), int?timezoneruleversionnumber = default(int?), int?statecode = default(int?), string _csuPersondetailsValue = default(string), string versionnumber = default(string), string _owningteamValue = default(string), string _owningbusinessunitValue = default(string), string csuAddressdescription = default(string), string csuPostalcode = default(string), string _csuCaseCasepersondetailsidValue = default(string), string csuAddress = default(string), string csuCountryregion = default(string), string csuRelationshiptocase = default(string), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), int?csuInvolvementtype = default(int?), int?csuIssec105applicant = default(int?), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), string _modifiedbyValue = default(string), string csuPrimaryphone = default(string), string csuCountry = default(string), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), string _owninguserValue = default(string), string csuName = default(string), int?utcconversiontimezonecode = default(int?), string csuCasepersondetailsid = default(string), string csuFirstnameandlastname = default(string), string csuFax = default(string), string csuZippostalcode = default(string), string _createdbyValue = default(string), string _modifiedonbehalfbyValue = default(string), string csuRecordid = default(string), string csuStateprovince = default(string), string csuCity = default(string), string csuAptsuiteunit = default(string), string csuStreetaddress = default(string), string _owneridValue = default(string), string csuAptsuiteunitcopied = default(string), string _createdonbehalfbyValue = default(string), string csuOtherphone = default(string), string csuOtherinvolvementtype = default(string), MicrosoftDynamicsCRMsystemuser createdby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser owninguser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteam = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMprincipal ownerid = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMbusinessunit owningbusinessunit = default(MicrosoftDynamicsCRMbusinessunit), IList <MicrosoftDynamicsCRMsyncerror> csuCasepersondetailsSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMduplicaterecord> csuCasepersondetailsDuplicateMatchingRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMduplicaterecord> csuCasepersondetailsDuplicateBaseRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMasyncoperation> csuCasepersondetailsAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMmailboxtrackingfolder> csuCasepersondetailsMailboxTrackingFolders = default(IList <MicrosoftDynamicsCRMmailboxtrackingfolder>), IList <MicrosoftDynamicsCRMprocesssession> csuCasepersondetailsProcessSession = default(IList <MicrosoftDynamicsCRMprocesssession>), IList <MicrosoftDynamicsCRMbulkdeletefailure> csuCasepersondetailsBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> csuCasepersondetailsPrincipalObjectAttributeAccesses = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), MicrosoftDynamicsCRMcontact csuPersonDetails = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMincident csuCaseCasePersonDetailsId = default(MicrosoftDynamicsCRMincident), IList <MicrosoftDynamicsCRMcsuViolation> csuCsuCasepersondetailsCsuViolationCasePersonDetail = default(IList <MicrosoftDynamicsCRMcsuViolation>), IList <MicrosoftDynamicsCRMcsuViolation> csuCsuCasepersondetailsCsuViolationPerson = default(IList <MicrosoftDynamicsCRMcsuViolation>), IList <MicrosoftDynamicsCRMcsuDemandandorder> csuCsuCasepersondetailsCsuDemandandorderIssuedForPerson = default(IList <MicrosoftDynamicsCRMcsuDemandandorder>), IList <MicrosoftDynamicsCRMcsuAmp> csuCsuCasepersondetailsCsuAmpAMPNoticeIssuedtoPersonId = default(IList <MicrosoftDynamicsCRMcsuAmp>), IList <MicrosoftDynamicsCRMcsuInjuctiondetail> csuCsuCasepersondetailsCsuInjuctiondetailPerson = default(IList <MicrosoftDynamicsCRMcsuInjuctiondetail>), IList <MicrosoftDynamicsCRMcsuInjuctiondetail> csuCsuCasepersondetailsCsuInjuctiondetailServedToPerson = default(IList <MicrosoftDynamicsCRMcsuInjuctiondetail>), IList <MicrosoftDynamicsCRMcsuApplicationforreturnofseizedcannabis> csuCsuCasepersondetailsCsuApplicationforreturnofseizedcannabisApplicantNamePerson = default(IList <MicrosoftDynamicsCRMcsuApplicationforreturnofseizedcannabis>), IList <MicrosoftDynamicsCRMcsuJudicialreview> csuCsuCasepersondetailsCsuJudicialreviewApplicantNamePerson = default(IList <MicrosoftDynamicsCRMcsuJudicialreview>))
 {
     CsuAddressdescriptioncopied = csuAddressdescriptioncopied;
     Importsequencenumber        = importsequencenumber;
     CsuCitycopied             = csuCitycopied;
     Statuscode                = statuscode;
     CsuStateprovincecopied    = csuStateprovincecopied;
     Timezoneruleversionnumber = timezoneruleversionnumber;
     Statecode = statecode;
     this._csuPersondetailsValue = _csuPersondetailsValue;
     Versionnumber                         = versionnumber;
     this._owningteamValue                 = _owningteamValue;
     this._owningbusinessunitValue         = _owningbusinessunitValue;
     CsuAddressdescription                 = csuAddressdescription;
     CsuPostalcode                         = csuPostalcode;
     this._csuCaseCasepersondetailsidValue = _csuCaseCasepersondetailsidValue;
     CsuAddress            = csuAddress;
     CsuCountryregion      = csuCountryregion;
     CsuRelationshiptocase = csuRelationshiptocase;
     Createdon             = createdon;
     CsuInvolvementtype    = csuInvolvementtype;
     CsuIssec105applicant  = csuIssec105applicant;
     Overriddencreatedon   = overriddencreatedon;
     this._modifiedbyValue = _modifiedbyValue;
     CsuPrimaryphone       = csuPrimaryphone;
     CsuCountry            = csuCountry;
     Modifiedon            = modifiedon;
     this._owninguserValue = _owninguserValue;
     CsuName = csuName;
     Utcconversiontimezonecode = utcconversiontimezonecode;
     CsuCasepersondetailsid    = csuCasepersondetailsid;
     CsuFirstnameandlastname   = csuFirstnameandlastname;
     CsuFax                         = csuFax;
     CsuZippostalcode               = csuZippostalcode;
     this._createdbyValue           = _createdbyValue;
     this._modifiedonbehalfbyValue  = _modifiedonbehalfbyValue;
     CsuRecordid                    = csuRecordid;
     CsuStateprovince               = csuStateprovince;
     CsuCity                        = csuCity;
     CsuAptsuiteunit                = csuAptsuiteunit;
     CsuStreetaddress               = csuStreetaddress;
     this._owneridValue             = _owneridValue;
     CsuAptsuiteunitcopied          = csuAptsuiteunitcopied;
     this._createdonbehalfbyValue   = _createdonbehalfbyValue;
     CsuOtherphone                  = csuOtherphone;
     CsuOtherinvolvementtype        = csuOtherinvolvementtype;
     Createdby                      = createdby;
     Createdonbehalfby              = createdonbehalfby;
     Modifiedby                     = modifiedby;
     Modifiedonbehalfby             = modifiedonbehalfby;
     Owninguser                     = owninguser;
     Owningteam                     = owningteam;
     Ownerid                        = ownerid;
     Owningbusinessunit             = owningbusinessunit;
     CsuCasepersondetailsSyncErrors = csuCasepersondetailsSyncErrors;
     CsuCasepersondetailsDuplicateMatchingRecord          = csuCasepersondetailsDuplicateMatchingRecord;
     CsuCasepersondetailsDuplicateBaseRecord              = csuCasepersondetailsDuplicateBaseRecord;
     CsuCasepersondetailsAsyncOperations                  = csuCasepersondetailsAsyncOperations;
     CsuCasepersondetailsMailboxTrackingFolders           = csuCasepersondetailsMailboxTrackingFolders;
     CsuCasepersondetailsProcessSession                   = csuCasepersondetailsProcessSession;
     CsuCasepersondetailsBulkDeleteFailures               = csuCasepersondetailsBulkDeleteFailures;
     CsuCasepersondetailsPrincipalObjectAttributeAccesses = csuCasepersondetailsPrincipalObjectAttributeAccesses;
     CsuPersonDetails           = csuPersonDetails;
     CsuCaseCasePersonDetailsId = csuCaseCasePersonDetailsId;
     CsuCsuCasepersondetailsCsuViolationCasePersonDetail     = csuCsuCasepersondetailsCsuViolationCasePersonDetail;
     CsuCsuCasepersondetailsCsuViolationPerson               = csuCsuCasepersondetailsCsuViolationPerson;
     CsuCsuCasepersondetailsCsuDemandandorderIssuedForPerson = csuCsuCasepersondetailsCsuDemandandorderIssuedForPerson;
     CsuCsuCasepersondetailsCsuAmpAMPNoticeIssuedtoPersonId  = csuCsuCasepersondetailsCsuAmpAMPNoticeIssuedtoPersonId;
     CsuCsuCasepersondetailsCsuInjuctiondetailPerson         = csuCsuCasepersondetailsCsuInjuctiondetailPerson;
     CsuCsuCasepersondetailsCsuInjuctiondetailServedToPerson = csuCsuCasepersondetailsCsuInjuctiondetailServedToPerson;
     CsuCsuCasepersondetailsCsuApplicationforreturnofseizedcannabisApplicantNamePerson = csuCsuCasepersondetailsCsuApplicationforreturnofseizedcannabisApplicantNamePerson;
     CsuCsuCasepersondetailsCsuJudicialreviewApplicantNamePerson = csuCsuCasepersondetailsCsuJudicialreviewApplicantNamePerson;
     CustomInit();
 }
コード例 #4
0
ファイル: DynamicsUtils.cs プロジェクト: bcgov/jag-spd-spice
        public MicrosoftDynamicsCRMcontact CreateOrUpdateContact(
            string contactId, string firstName, string middleName, string lastName,
            int?gender, string email, string phoneNumber, string driversLicenceNumber,
            string driversLicenceJurisdiction, string bcIdCardNumber,
            DateTimeOffset?dateOfBirth, string birthPlace, bool selfDisclosed,
            string addressLine1, string addressLine2, string addressLine3,
            string city, string postalCode, string stateProvince, string country,
            List <Address> addresses, List <Alias> aliases, string title
            )
        {
            try
            {
                string uniqueFilter = "externaluseridentifier eq '" + contactId + "'";
                MicrosoftDynamicsCRMcontactCollection contactResponse = _dynamicsClient.Contacts.Get(1, filter: uniqueFilter);
                MicrosoftDynamicsCRMcontact           contact         = new MicrosoftDynamicsCRMcontact()
                {
                    Externaluseridentifier = contactId,
                    Firstname               = firstName,
                    Middlename              = middleName,
                    Lastname                = lastName,
                    Gendercode              = gender,
                    Emailaddress1           = email,
                    Telephone1              = phoneNumber,
                    SpiceDriverslicencenum  = driversLicenceNumber,
                    SpiceIdJurisdiction     = driversLicenceJurisdiction,
                    SpiceBcidcardnumber     = bcIdCardNumber,
                    SpiceDateofbirth        = dateOfBirth,
                    SpiceBirthplace         = birthPlace,
                    SpiceSelfdisclosed      = selfDisclosed,
                    Address1Line1           = addressLine1,
                    Address1Line2           = addressLine2,
                    Address1Line3           = addressLine3,
                    Address1City            = city,
                    Address1Postalcode      = postalCode,
                    Address1Stateorprovince = stateProvince,
                    Address1Country         = country,
                    SpicePositiontitle      = title
                };

                if (contactResponse.Value.Count > 0)
                {
                    _dynamicsClient.Contacts.Update(contactResponse.Value[0].Contactid, contact);
                    contact.Contactid = contactResponse.Value[0].Contactid;
                }
                else
                {
                    contact = _dynamicsClient.Contacts.Create(contact);
                }

                string entityUri = _dynamicsClient.GetEntityURI("contacts", contact.Contactid);

                MicrosoftDynamicsCRMspicePreviousaddressesCollection currentPreviousAddresses = _dynamicsClient.Previousaddresseses.Get(filter: $"_spice_contactid_value eq {contact.Contactid}");
                if (currentPreviousAddresses.Value.Count > 0)
                {
                    foreach (var address in currentPreviousAddresses.Value)
                    {
                        _dynamicsClient.Previousaddresseses.Delete(address.SpicePreviousaddressesid);
                    }
                }
                foreach (var address in addresses)
                {
                    _dynamicsClient.Previousaddresseses.Create(new MicrosoftDynamicsCRMspicePreviousaddresses()
                    {
                        SpiceContactIdODataBind = entityUri,
                        SpiceName          = address.AddressStreet1,
                        SpiceCity          = address.City,
                        SpiceStateprovince = address.StateProvince,
                        SpiceZippostalcode = address.Postal,
                        SpiceCountry       = address.Country,
                        SpiceStartdate     = address.FromDate,
                        SpiceEnddate       = address.ToDate
                    });
                }

                MicrosoftDynamicsCRMspiceAliasesCollection currentAliases = _dynamicsClient.Aliaseses.Get(filter: $"_spice_aliascontact_value eq {contact.Contactid}");
                if (currentAliases.Value.Count > 0)
                {
                    foreach (var alias in currentAliases.Value)
                    {
                        _dynamicsClient.Aliaseses.Delete(alias.SpiceAliasesid);
                    }
                }
                foreach (var alias in aliases)
                {
                    _dynamicsClient.Aliaseses.Create(new MicrosoftDynamicsCRMspiceAliases()
                    {
                        SpiceAliascontactODataBind = entityUri,
                        SpiceName       = alias.GivenName,
                        SpiceMiddlename = alias.SecondName,
                        SpiceLastname   = alias.Surname,
                    });
                }

                return(contact);
            }
            catch (OdataerrorException e)
            {
                _logger.LogError(e, "Failed to create or update contact");
                _logger.LogError(e.Request.Content);
                _logger.LogError(e.Response.Content);
                throw;
            }
        }
コード例 #5
0
        private void UpdateEntityModifiedOnDate(string entityName, string entityId, bool setUploadedFromPortal = false)
        {
            switch (entityName.ToLower())
            {
            case "application":
                var patchApplication = new MicrosoftDynamicsCRMadoxioApplication();
                if (setUploadedFromPortal)
                {
                    patchApplication.AdoxioFileuploadedfromportal = (int?)ViewModels.GeneralYesNo.Yes;
                }

                try
                {
                    _dynamicsClient.Applications.Update(entityId, patchApplication);
                }
                catch (OdataerrorException odee)
                {
                    _logger.LogError("Error updating application");
                    _logger.LogError("Request:");
                    _logger.LogError(odee.Request.Content);
                    _logger.LogError("Response:");
                    _logger.LogError(odee.Response.Content);
                    // fail if we can't create.
                    throw (odee);
                }
                break;

            case "contact":
                var patchContact = new MicrosoftDynamicsCRMcontact();
                try
                {
                    _dynamicsClient.Contacts.Update(entityId, patchContact);
                }
                catch (OdataerrorException odee)
                {
                    _logger.LogError("Error updating Contact");
                    _logger.LogError("Request:");
                    _logger.LogError(odee.Request.Content);
                    _logger.LogError("Response:");
                    _logger.LogError(odee.Response.Content);
                    // fail if we can't create.
                    throw (odee);
                }
                break;

            case "worker":
                var patchWorker = new MicrosoftDynamicsCRMadoxioWorker();
                try
                {
                    _dynamicsClient.Workers.Update(entityId, patchWorker);
                }
                catch (OdataerrorException odee)
                {
                    _logger.LogError("Error updating Contact");
                    _logger.LogError("Request:");
                    _logger.LogError(odee.Request.Content);
                    _logger.LogError("Response:");
                    _logger.LogError(odee.Response.Content);
                    // fail if we can't create.
                    throw (odee);
                }
                break;

            default:
                break;
            }
        }
コード例 #6
0
        public async Task <IActionResult> CreateContact([FromBody] Contact item)
        {
            // get UserSettings from the session
            var temp         = _httpContextAccessor.HttpContext.Session.GetString("UserSettings");
            var userSettings = JsonConvert.DeserializeObject <UserSettings>(temp);

            // first check to see that a contact exists.
            var contactSiteminderGuid = userSettings.SiteMinderGuid;

            if (contactSiteminderGuid == null || contactSiteminderGuid.Length == 0)
            {
                _logger.LogDebug(LoggingEvents.Error, "No Contact Siteminder Guid exernal id");
                throw new Exception("Error. No ContactSiteminderGuid exernal id");
            }

            // get the contact record.
            MicrosoftDynamicsCRMcontact userContact = null;

            // see if the contact exists.
            try
            {
                userContact = _dynamicsClient.GetActiveContactByExternalId(contactSiteminderGuid);
                if (userContact != null)
                {
                    throw new Exception("Contact already Exists");
                }
            }
            catch (HttpOperationException httpOperationException)
            {
                _logger.LogError(httpOperationException, "Error getting contact by Siteminder Guid.");
                throw new HttpOperationException("Error getting contact by Siteminder Guid");
            }

            // create a new contact.
            var contact = new MicrosoftDynamicsCRMcontact();

            contact.CopyValues(item);


            if (userSettings.IsNewUserRegistration)
            {
                // get additional information from the service card headers.
                contact.CopyHeaderValues(_httpContextAccessor);
            }

            contact.AdoxioExternalid = DynamicsExtensions.GetServiceCardID(contactSiteminderGuid);
            try
            {
                contact = await _dynamicsClient.Contacts.CreateAsync(contact);
            }
            catch (HttpOperationException httpOperationException)
            {
                _logger.LogError(httpOperationException, "Error creating contact. ");
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Unknown error creating contact.");
            }

            // if we have not yet authenticated, then this is the new record for the user.
            if (userSettings.IsNewUserRegistration)
            {
                userSettings.ContactId = contact.Contactid;

                // we can now authenticate.
                if (userSettings.AuthenticatedUser == null)
                {
                    var user = new User();
                    user.Active    = true;
                    user.ContactId = Guid.Parse(userSettings.ContactId);
                    user.UserType  = userSettings.UserType;
                    user.SmUserId  = userSettings.UserId;
                    userSettings.AuthenticatedUser = user;
                }

                userSettings.IsNewUserRegistration = false;

                var userSettingsString = JsonConvert.SerializeObject(userSettings);
                _logger.LogDebug("userSettingsString --> " + userSettingsString);

                // add the user to the session.
                _httpContextAccessor.HttpContext.Session.SetString("UserSettings", userSettingsString);
                _logger.LogDebug("user added to session. ");
            }
            else
            {
                _logger.LogDebug(LoggingEvents.Error, "Invalid user registration.");
                throw new Exception("Invalid user registration.");
            }

            return(new JsonResult(contact.ToViewModel()));
        }
コード例 #7
0
        public async Task <IActionResult> GetCASSContactByToken(string code)
        {
            var id = EncryptionUtility.DecryptStringHex(code, _encryptionKey);

            if (!string.IsNullOrEmpty(id))
            {
                MicrosoftDynamicsCRMcontact userContact = null;
                try
                {
                    var temp         = _httpContextAccessor.HttpContext.Session.GetString("UserSettings");
                    var userSettings = JsonConvert.DeserializeObject <UserSettings>(temp);
                    userContact = await _dynamicsClient.GetContactById(userSettings.ContactId);
                }
                catch (ArgumentNullException)
                {
                    // anonymous
                }

                var contactId = Guid.Parse(id);
                // query the Dynamics system to get the contact record.
                var contact = await _dynamicsClient.GetContactById(contactId);

                if (userContact == null)
                {
                    return(new JsonResult(new CASSPublicContact
                    {
                        Id = contact.Contactid,
                        token = code,
                        shortName = contact.Firstname.First() + " " + contact.Lastname,
                        IsWrongUser = false
                    }));
                }

                if (contact != null &&
                    userContact.Firstname != null &&
                    contact.Firstname.StartsWith(userContact.Firstname.Substring(0, 1), true,
                                                 CultureInfo.CurrentCulture) &&
                    userContact.Lastname != null && userContact.Lastname.ToLower() == contact.Lastname.ToLower() &&
                    userContact.Birthdate != null && userContact.Birthdate.Value.Date.ToShortDateString() ==
                    contact.Birthdate.Value.Date.ToShortDateString()
                    )
                {
                    return(new JsonResult(new CASSPrivateContact
                    {
                        Id = contact.Contactid,
                        token = code,
                        shortName = contact.Firstname + " " + contact.Lastname,
                        dateOfBirth = contact.AdoxioDateofbirthshortdatestring,
                        gender = ((Gender?)contact.AdoxioGendercode).ToString(),
                        streetAddress = contact.Address1Line1,
                        city = contact.Address1City,
                        province = contact.Address1Stateorprovince,
                        postalCode = contact.Address1Postalcode,
                        country = contact.Address1Country
                    }));
                }
                return(new JsonResult(new CASSPublicContact
                {
                    Id = contact.Contactid,
                    token = code,
                    shortName = contact.Firstname.First() + " " + contact.Lastname,
                    IsWrongUser = true
                }));
            }

            return(BadRequest());
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the MicrosoftDynamicsCRMconnection
 /// class.
 /// </summary>
 public MicrosoftDynamicsCRMconnection(int?record1objecttypecode = default(int?), int?statuscode = default(int?), int?statecode = default(int?), string _modifiedonbehalfbyValue = default(string), string _record1roleidValue = default(string), System.DateTimeOffset?effectiveend = default(System.DateTimeOffset?), string entityimageUrl = default(string), string name = default(string), string connectionid = default(string), decimal?exchangerate = default(decimal?), string _owningteamValue = default(string), string _createdbyValue = default(string), string _modifiedbyValue = default(string), int?record2objecttypecode = default(int?), string _createdonbehalfbyValue = default(string), string _owneridValue = default(string), string _owninguserValue = default(string), string _record1idValue = default(string), System.DateTimeOffset?effectivestart = default(System.DateTimeOffset?), string description = default(string), string versionnumber = default(string), string entityimageid = default(string), long?entityimageTimestamp = default(long?), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), byte[] entityimage = default(byte[]), int?importsequencenumber = default(int?), string _owningbusinessunitValue = default(string), string _relatedconnectionidValue = default(string), string _record2idValue = default(string), bool?ismaster = default(bool?), string _record2roleidValue = default(string), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), string _transactioncurrencyidValue = default(string), MicrosoftDynamicsCRMknowledgearticle record1idKnowledgearticle = default(MicrosoftDynamicsCRMknowledgearticle), MicrosoftDynamicsCRMknowledgearticle record2idKnowledgearticle = default(MicrosoftDynamicsCRMknowledgearticle), MicrosoftDynamicsCRMknowledgebaserecord record1idKnowledgebaserecord = default(MicrosoftDynamicsCRMknowledgebaserecord), MicrosoftDynamicsCRMknowledgebaserecord record2idKnowledgebaserecord = default(MicrosoftDynamicsCRMknowledgebaserecord), MicrosoftDynamicsCRMterritory record1idTerritory = default(MicrosoftDynamicsCRMterritory), MicrosoftDynamicsCRMterritory record2idTerritory = default(MicrosoftDynamicsCRMterritory), MicrosoftDynamicsCRMlead record1idLead = default(MicrosoftDynamicsCRMlead), MicrosoftDynamicsCRMlead record2idLead = default(MicrosoftDynamicsCRMlead), MicrosoftDynamicsCRMpricelevel record1idPricelevel = default(MicrosoftDynamicsCRMpricelevel), MicrosoftDynamicsCRMpricelevel record2idPricelevel = default(MicrosoftDynamicsCRMpricelevel), MicrosoftDynamicsCRMproduct record1idProduct = default(MicrosoftDynamicsCRMproduct), MicrosoftDynamicsCRMproduct record2idProduct = default(MicrosoftDynamicsCRMproduct), MicrosoftDynamicsCRMcampaign record1idCampaign = default(MicrosoftDynamicsCRMcampaign), MicrosoftDynamicsCRMcampaign record2idCampaign = default(MicrosoftDynamicsCRMcampaign), MicrosoftDynamicsCRMcampaignactivity record1idCampaignactivity = default(MicrosoftDynamicsCRMcampaignactivity), MicrosoftDynamicsCRMcampaignactivity record2idCampaignactivity = default(MicrosoftDynamicsCRMcampaignactivity), MicrosoftDynamicsCRMlist record1idList = default(MicrosoftDynamicsCRMlist), MicrosoftDynamicsCRMlist record2idList = default(MicrosoftDynamicsCRMlist), MicrosoftDynamicsCRMconstraintbasedgroup record1idConstraintbasedgroup = default(MicrosoftDynamicsCRMconstraintbasedgroup), MicrosoftDynamicsCRMconstraintbasedgroup record2idConstraintbasedgroup = default(MicrosoftDynamicsCRMconstraintbasedgroup), MicrosoftDynamicsCRMcontract record1idContract = default(MicrosoftDynamicsCRMcontract), MicrosoftDynamicsCRMcontract record2idContract = default(MicrosoftDynamicsCRMcontract), MicrosoftDynamicsCRMentitlement record1idEntitlement = default(MicrosoftDynamicsCRMentitlement), MicrosoftDynamicsCRMentitlement record2idEntitlement = default(MicrosoftDynamicsCRMentitlement), MicrosoftDynamicsCRMentitlementchannel record1idEntitlementchannel = default(MicrosoftDynamicsCRMentitlementchannel), MicrosoftDynamicsCRMentitlementchannel record2idEntitlementchannel = default(MicrosoftDynamicsCRMentitlementchannel), MicrosoftDynamicsCRMentitlementtemplatechannel record1idEntitlementtemplatechannel = default(MicrosoftDynamicsCRMentitlementtemplatechannel), MicrosoftDynamicsCRMentitlementtemplatechannel record2idEntitlementtemplatechannel = default(MicrosoftDynamicsCRMentitlementtemplatechannel), MicrosoftDynamicsCRMequipment record1idEquipment = default(MicrosoftDynamicsCRMequipment), MicrosoftDynamicsCRMequipment record2idEquipment = default(MicrosoftDynamicsCRMequipment), MicrosoftDynamicsCRMincident record1idIncident = default(MicrosoftDynamicsCRMincident), MicrosoftDynamicsCRMincident record2idIncident = default(MicrosoftDynamicsCRMincident), MicrosoftDynamicsCRMresourcegroup record1idResourcegroup = default(MicrosoftDynamicsCRMresourcegroup), MicrosoftDynamicsCRMresourcegroup record2idResourcegroup = default(MicrosoftDynamicsCRMresourcegroup), MicrosoftDynamicsCRMserviceappointment record1idServiceappointment = default(MicrosoftDynamicsCRMserviceappointment), MicrosoftDynamicsCRMserviceappointment record2idServiceappointment = default(MicrosoftDynamicsCRMserviceappointment), MicrosoftDynamicsCRMinvoice record1idInvoice = default(MicrosoftDynamicsCRMinvoice), MicrosoftDynamicsCRMinvoice record2idInvoice = default(MicrosoftDynamicsCRMinvoice), MicrosoftDynamicsCRMopportunity record1idOpportunity = default(MicrosoftDynamicsCRMopportunity), MicrosoftDynamicsCRMopportunity record2idOpportunity = default(MicrosoftDynamicsCRMopportunity), MicrosoftDynamicsCRMquote record1idQuote = default(MicrosoftDynamicsCRMquote), MicrosoftDynamicsCRMquote record2idQuote = default(MicrosoftDynamicsCRMquote), MicrosoftDynamicsCRMsalesorder record1idSalesorder = default(MicrosoftDynamicsCRMsalesorder), MicrosoftDynamicsCRMsalesorder record2idSalesorder = default(MicrosoftDynamicsCRMsalesorder), MicrosoftDynamicsCRMcompetitor record1idCompetitor = default(MicrosoftDynamicsCRMcompetitor), MicrosoftDynamicsCRMcompetitor record2idCompetitor = default(MicrosoftDynamicsCRMcompetitor), MicrosoftDynamicsCRMmsdynPostalbum record1idMsdynPostalbum = default(MicrosoftDynamicsCRMmsdynPostalbum), MicrosoftDynamicsCRMmsdynPostalbum record2idMsdynPostalbum = default(MicrosoftDynamicsCRMmsdynPostalbum), MicrosoftDynamicsCRMcsuCasetask record1idCsuCasetask = default(MicrosoftDynamicsCRMcsuCasetask), MicrosoftDynamicsCRMcsuCasetask record2idCsuCasetask = default(MicrosoftDynamicsCRMcsuCasetask), MicrosoftDynamicsCRMcsuVehicledetail record1idCsuVehicledetail = default(MicrosoftDynamicsCRMcsuVehicledetail), MicrosoftDynamicsCRMcsuVehicledetail record2idCsuVehicledetail = default(MicrosoftDynamicsCRMcsuVehicledetail), MicrosoftDynamicsCRMcontact record1idContact = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMsocialactivity record2idSocialactivity = default(MicrosoftDynamicsCRMsocialactivity), MicrosoftDynamicsCRMtask record2idTask = default(MicrosoftDynamicsCRMtask), MicrosoftDynamicsCRMsystemuser modifiedby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser record1idSystemuser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMtransactioncurrency transactioncurrencyid = default(MicrosoftDynamicsCRMtransactioncurrency), MicrosoftDynamicsCRMaccount record2idAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMsystemuser createdby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser record2idSystemuser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam record2idTeam = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMletter record2idLetter = default(MicrosoftDynamicsCRMletter), MicrosoftDynamicsCRMemail record1idEmail = default(MicrosoftDynamicsCRMemail), MicrosoftDynamicsCRMsocialprofile record1idSocialprofile = default(MicrosoftDynamicsCRMsocialprofile), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> connectionPrincipalobjectattributeaccess = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), MicrosoftDynamicsCRMsystemuser createdonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMtask record1idTask = default(MicrosoftDynamicsCRMtask), MicrosoftDynamicsCRMemail record2idEmail = default(MicrosoftDynamicsCRMemail), MicrosoftDynamicsCRMsocialprofile record2idSocialprofile = default(MicrosoftDynamicsCRMsocialprofile), MicrosoftDynamicsCRMteam record1idTeam = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMconnectionrole record2roleid = default(MicrosoftDynamicsCRMconnectionrole), MicrosoftDynamicsCRMgoal record2idGoal = default(MicrosoftDynamicsCRMgoal), MicrosoftDynamicsCRMposition record1idPosition = default(MicrosoftDynamicsCRMposition), MicrosoftDynamicsCRMrecurringappointmentmaster record1idRecurringappointmentmaster = default(MicrosoftDynamicsCRMrecurringappointmentmaster), MicrosoftDynamicsCRMprocesssession record1idProcesssession = default(MicrosoftDynamicsCRMprocesssession), IList <MicrosoftDynamicsCRMasyncoperation> connectionAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMprocesssession> connectionProcessSessions = default(IList <MicrosoftDynamicsCRMprocesssession>), MicrosoftDynamicsCRMappointment record1idAppointment = default(MicrosoftDynamicsCRMappointment), MicrosoftDynamicsCRMfax record2idFax = default(MicrosoftDynamicsCRMfax), MicrosoftDynamicsCRMsystemuser modifiedonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMconnection relatedconnectionid = default(MicrosoftDynamicsCRMconnection), IList <MicrosoftDynamicsCRMconnection> connectionRelatedConnection = default(IList <MicrosoftDynamicsCRMconnection>), MicrosoftDynamicsCRMrecurringappointmentmaster record2idRecurringappointmentmaster = default(MicrosoftDynamicsCRMrecurringappointmentmaster), MicrosoftDynamicsCRMphonecall record1idPhonecall = default(MicrosoftDynamicsCRMphonecall), MicrosoftDynamicsCRMappointment record2idAppointment = default(MicrosoftDynamicsCRMappointment), MicrosoftDynamicsCRMbusinessunit owningbusinessunit = default(MicrosoftDynamicsCRMbusinessunit), MicrosoftDynamicsCRMgoal record1idGoal = default(MicrosoftDynamicsCRMgoal), MicrosoftDynamicsCRMsocialactivity record1idSocialactivity = default(MicrosoftDynamicsCRMsocialactivity), MicrosoftDynamicsCRMfax record1idFax = default(MicrosoftDynamicsCRMfax), MicrosoftDynamicsCRMposition record2idPosition = default(MicrosoftDynamicsCRMposition), MicrosoftDynamicsCRMconnectionrole record1roleid = default(MicrosoftDynamicsCRMconnectionrole), MicrosoftDynamicsCRMletter record1idLetter = default(MicrosoftDynamicsCRMletter), MicrosoftDynamicsCRMprocesssession record2idProcesssession = default(MicrosoftDynamicsCRMprocesssession), IList <MicrosoftDynamicsCRMsyncerror> connectionSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), MicrosoftDynamicsCRMactivitypointer record2idActivitypointer = default(MicrosoftDynamicsCRMactivitypointer), MicrosoftDynamicsCRMaccount record1idAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMprincipal ownerid = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMcontact record2idContact = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMactivitypointer record1idActivitypointer = default(MicrosoftDynamicsCRMactivitypointer), MicrosoftDynamicsCRMphonecall record2idPhonecall = default(MicrosoftDynamicsCRMphonecall))
 {
     Record1objecttypecode         = record1objecttypecode;
     Statuscode                    = statuscode;
     Statecode                     = statecode;
     this._modifiedonbehalfbyValue = _modifiedonbehalfbyValue;
     this._record1roleidValue      = _record1roleidValue;
     Effectiveend                  = effectiveend;
     EntityimageUrl                = entityimageUrl;
     Name                                     = name;
     Connectionid                             = connectionid;
     Exchangerate                             = exchangerate;
     this._owningteamValue                    = _owningteamValue;
     this._createdbyValue                     = _createdbyValue;
     this._modifiedbyValue                    = _modifiedbyValue;
     Record2objecttypecode                    = record2objecttypecode;
     this._createdonbehalfbyValue             = _createdonbehalfbyValue;
     this._owneridValue                       = _owneridValue;
     this._owninguserValue                    = _owninguserValue;
     this._record1idValue                     = _record1idValue;
     Effectivestart                           = effectivestart;
     Description                              = description;
     Versionnumber                            = versionnumber;
     Entityimageid                            = entityimageid;
     EntityimageTimestamp                     = entityimageTimestamp;
     Modifiedon                               = modifiedon;
     Overriddencreatedon                      = overriddencreatedon;
     Entityimage                              = entityimage;
     Importsequencenumber                     = importsequencenumber;
     this._owningbusinessunitValue            = _owningbusinessunitValue;
     this._relatedconnectionidValue           = _relatedconnectionidValue;
     this._record2idValue                     = _record2idValue;
     Ismaster                                 = ismaster;
     this._record2roleidValue                 = _record2roleidValue;
     Createdon                                = createdon;
     this._transactioncurrencyidValue         = _transactioncurrencyidValue;
     Record1idKnowledgearticle                = record1idKnowledgearticle;
     Record2idKnowledgearticle                = record2idKnowledgearticle;
     Record1idKnowledgebaserecord             = record1idKnowledgebaserecord;
     Record2idKnowledgebaserecord             = record2idKnowledgebaserecord;
     Record1idTerritory                       = record1idTerritory;
     Record2idTerritory                       = record2idTerritory;
     Record1idLead                            = record1idLead;
     Record2idLead                            = record2idLead;
     Record1idPricelevel                      = record1idPricelevel;
     Record2idPricelevel                      = record2idPricelevel;
     Record1idProduct                         = record1idProduct;
     Record2idProduct                         = record2idProduct;
     Record1idCampaign                        = record1idCampaign;
     Record2idCampaign                        = record2idCampaign;
     Record1idCampaignactivity                = record1idCampaignactivity;
     Record2idCampaignactivity                = record2idCampaignactivity;
     Record1idList                            = record1idList;
     Record2idList                            = record2idList;
     Record1idConstraintbasedgroup            = record1idConstraintbasedgroup;
     Record2idConstraintbasedgroup            = record2idConstraintbasedgroup;
     Record1idContract                        = record1idContract;
     Record2idContract                        = record2idContract;
     Record1idEntitlement                     = record1idEntitlement;
     Record2idEntitlement                     = record2idEntitlement;
     Record1idEntitlementchannel              = record1idEntitlementchannel;
     Record2idEntitlementchannel              = record2idEntitlementchannel;
     Record1idEntitlementtemplatechannel      = record1idEntitlementtemplatechannel;
     Record2idEntitlementtemplatechannel      = record2idEntitlementtemplatechannel;
     Record1idEquipment                       = record1idEquipment;
     Record2idEquipment                       = record2idEquipment;
     Record1idIncident                        = record1idIncident;
     Record2idIncident                        = record2idIncident;
     Record1idResourcegroup                   = record1idResourcegroup;
     Record2idResourcegroup                   = record2idResourcegroup;
     Record1idServiceappointment              = record1idServiceappointment;
     Record2idServiceappointment              = record2idServiceappointment;
     Record1idInvoice                         = record1idInvoice;
     Record2idInvoice                         = record2idInvoice;
     Record1idOpportunity                     = record1idOpportunity;
     Record2idOpportunity                     = record2idOpportunity;
     Record1idQuote                           = record1idQuote;
     Record2idQuote                           = record2idQuote;
     Record1idSalesorder                      = record1idSalesorder;
     Record2idSalesorder                      = record2idSalesorder;
     Record1idCompetitor                      = record1idCompetitor;
     Record2idCompetitor                      = record2idCompetitor;
     Record1idMsdynPostalbum                  = record1idMsdynPostalbum;
     Record2idMsdynPostalbum                  = record2idMsdynPostalbum;
     Record1idCsuCasetask                     = record1idCsuCasetask;
     Record2idCsuCasetask                     = record2idCsuCasetask;
     Record1idCsuVehicledetail                = record1idCsuVehicledetail;
     Record2idCsuVehicledetail                = record2idCsuVehicledetail;
     Record1idContact                         = record1idContact;
     Record2idSocialactivity                  = record2idSocialactivity;
     Record2idTask                            = record2idTask;
     Modifiedby                               = modifiedby;
     Record1idSystemuser                      = record1idSystemuser;
     Transactioncurrencyid                    = transactioncurrencyid;
     Record2idAccount                         = record2idAccount;
     Createdby                                = createdby;
     Record2idSystemuser                      = record2idSystemuser;
     Record2idTeam                            = record2idTeam;
     Record2idLetter                          = record2idLetter;
     Record1idEmail                           = record1idEmail;
     Record1idSocialprofile                   = record1idSocialprofile;
     ConnectionPrincipalobjectattributeaccess = connectionPrincipalobjectattributeaccess;
     Createdonbehalfby                        = createdonbehalfby;
     Record1idTask                            = record1idTask;
     Record2idEmail                           = record2idEmail;
     Record2idSocialprofile                   = record2idSocialprofile;
     Record1idTeam                            = record1idTeam;
     Record2roleid                            = record2roleid;
     Record2idGoal                            = record2idGoal;
     Record1idPosition                        = record1idPosition;
     Record1idRecurringappointmentmaster      = record1idRecurringappointmentmaster;
     Record1idProcesssession                  = record1idProcesssession;
     ConnectionAsyncOperations                = connectionAsyncOperations;
     ConnectionProcessSessions                = connectionProcessSessions;
     Record1idAppointment                     = record1idAppointment;
     Record2idFax                             = record2idFax;
     Modifiedonbehalfby                       = modifiedonbehalfby;
     Relatedconnectionid                      = relatedconnectionid;
     ConnectionRelatedConnection              = connectionRelatedConnection;
     Record2idRecurringappointmentmaster      = record2idRecurringappointmentmaster;
     Record1idPhonecall                       = record1idPhonecall;
     Record2idAppointment                     = record2idAppointment;
     Owningbusinessunit                       = owningbusinessunit;
     Record1idGoal                            = record1idGoal;
     Record1idSocialactivity                  = record1idSocialactivity;
     Record1idFax                             = record1idFax;
     Record2idPosition                        = record2idPosition;
     Record1roleid                            = record1roleid;
     Record1idLetter                          = record1idLetter;
     Record2idProcesssession                  = record2idProcesssession;
     ConnectionSyncErrors                     = connectionSyncErrors;
     Record2idActivitypointer                 = record2idActivitypointer;
     Record1idAccount                         = record1idAccount;
     Ownerid                                  = ownerid;
     Record2idContact                         = record2idContact;
     Record1idActivitypointer                 = record1idActivitypointer;
     Record2idPhonecall                       = record2idPhonecall;
     CustomInit();
 }
コード例 #9
0
        public IActionResult CreateWorkerContact([FromBody] ViewModels.Contact item)
        {
            // get UserSettings from the session
            string       temp         = _httpContextAccessor.HttpContext.Session.GetString("UserSettings");
            UserSettings userSettings = JsonConvert.DeserializeObject <UserSettings>(temp);

            // first check to see that a contact exists.
            string contactSiteminderGuid = userSettings.SiteMinderGuid;

            if (contactSiteminderGuid == null || contactSiteminderGuid.Length == 0)
            {
                _logger.LogError(LoggingEvents.Error, "No Contact Siteminder Guid exernal id");
                throw new Exception("Error. No ContactSiteminderGuid exernal id");
            }

            // get the contact record.
            MicrosoftDynamicsCRMcontact userContact = null;

            // see if the contact exists.
            try
            {
                userContact = _dynamicsClient.GetContactByExternalId(contactSiteminderGuid);
                if (userContact != null)
                {
                    throw new Exception("Contact already Exists");
                }
            }
            catch (OdataerrorException odee)
            {
                _logger.LogError(LoggingEvents.Error, "Error getting contact by Siteminder Guid.");
                _logger.LogError("Request:");
                _logger.LogError(odee.Request.Content);
                _logger.LogError("Response:");
                _logger.LogError(odee.Response.Content);
                throw new OdataerrorException("Error getting contact by Siteminder Guid");
            }

            // create a new contact.
            MicrosoftDynamicsCRMcontact contact = new MicrosoftDynamicsCRMcontact();

            contact.CopyValues(item);


            contact.Externaluseridentifier = UserDynamicsExtensions.GetServiceCardID(contactSiteminderGuid);

            // if we have not yet authenticated, then this is the new record for the user.
            if (userSettings.IsNewUserRegistration)
            {
                userSettings.ContactId = contact.Contactid.ToString();

                // we can now authenticate.
                if (userSettings.AuthenticatedUser == null)
                {
                    Models.User user = new Models.User();
                    user.Active    = true;
                    user.ContactId = Guid.Parse(userSettings.ContactId);
                    user.UserType  = userSettings.UserType;
                    user.SmUserId  = userSettings.UserId;
                    userSettings.AuthenticatedUser = user;
                }

                userSettings.IsNewUserRegistration = false;

                string userSettingsString = JsonConvert.SerializeObject(userSettings);
                _logger.LogDebug("userSettingsString --> " + userSettingsString);

                // add the user to the session.
                _httpContextAccessor.HttpContext.Session.SetString("UserSettings", userSettingsString);
                _logger.LogDebug("user added to session. ");
            }
            else
            {
                _logger.LogError(LoggingEvents.Error, "Invalid user registration.");
                throw new Exception("Invalid user registration.");
            }

            return(Json(contact.ToViewModel()));
        }
        /// <summary>
        /// Process Authentication Request
        /// </summary>
        /// <returns></returns>
        protected override async Task <AuthenticateResult> HandleAuthenticateAsync()
        {
            // get siteminder headers
            _logger.LogDebug("Parsing the HTTP headers for SiteMinder authentication credential");

            SiteMinderAuthOptions options = new SiteMinderAuthOptions();
            bool isDeveloperLogin         = false;
            bool isBCSCDeveloperLogin     = false;

            try
            {
                ClaimsPrincipal principal;
                HttpContext     context = Request.HttpContext;

                IConfiguration _configuration = (IConfiguration)context.RequestServices.GetService(typeof(IConfiguration));

                IDynamicsClient _dynamicsClient = (IDynamicsClient)context.RequestServices.GetService(typeof(IDynamicsClient));

                FileManagerClient _fileManagerClient = (FileManagerClient)context.RequestServices.GetService(typeof(FileManagerClient));

                IWebHostEnvironment hostingEnv = (IWebHostEnvironment)context.RequestServices.GetService(typeof(IWebHostEnvironment));

                UserSettings userSettings = new UserSettings();

                if (!string.IsNullOrEmpty(_configuration["FEATURE_DISABLE_LOGIN"]))
                {
                    return(AuthenticateResult.Fail(options.LoginDisabledError));
                }

                string userId                 = null;
                string devCompanyId           = null;
                string siteMinderGuid         = "";
                string siteMinderBusinessGuid = "";
                string siteMinderUserType     = "";

                // **************************************************
                // If this is an Error or Authentiation API - Ignore
                // **************************************************
                string url = context.Request.GetDisplayUrl().ToLower();

                if (url.Contains(".js"))
                {
                    return(AuthenticateResult.NoResult());
                }

                // **************************************************
                // Check if we have a Dev Environment Cookie
                // **************************************************
                if (!hostingEnv.IsProduction())
                {
                    // check for a fake BCeID login in dev mode
                    string temp = context.Request.Cookies[options.DevAuthenticationTokenKey];

                    if (string.IsNullOrEmpty(temp)) // could be an automated test user.
                    {
                        temp = context.Request.Headers["DEV-USER"];
                    }

                    if (!string.IsNullOrEmpty(temp))
                    {
                        if (temp.Contains("::"))
                        {
                            var temp2 = temp.Split("::");
                            userId = temp2[0];
                            if (temp2.Length >= 2)
                            {
                                devCompanyId = temp2[1];
                            }
                            else
                            {
                                devCompanyId = temp2[0];
                            }
                        }
                        else
                        {
                            userId       = temp;
                            devCompanyId = temp;
                        }
                        isDeveloperLogin = true;

                        _logger.LogDebug("Got user from dev cookie = " + userId + ", company = " + devCompanyId);
                    }
                    else
                    {
                        // same set of tests for a BC Services Card dev login
                        temp = context.Request.Cookies[options.DevBCSCAuthenticationTokenKey];

                        if (string.IsNullOrEmpty(temp)) // could be an automated test user.
                        {
                            temp = context.Request.Headers["DEV-BCSC-USER"];
                        }

                        if (!string.IsNullOrEmpty(temp))
                        {
                            userId = temp;
                            isBCSCDeveloperLogin = true;

                            _logger.LogDebug("Got user from dev cookie = " + userId);
                        }
                    }
                }

                // **************************************************
                // Check if the user session is already created
                // **************************************************
                try
                {
                    _logger.LogDebug("Checking user session");
                    userSettings = UserSettings.ReadUserSettings(context);
                    _logger.LogDebug("UserSettings found: " + userSettings.GetJson());
                }
                catch
                {
                    //do nothing
                    _logger.LogDebug("No UserSettings found");
                }

                // is user authenticated - if so we're done
                if ((userSettings.UserAuthenticated && string.IsNullOrEmpty(userId)) ||
                    (userSettings.UserAuthenticated && !string.IsNullOrEmpty(userId) &&
                     !string.IsNullOrEmpty(userSettings.UserId) && userSettings.UserId == userId))
                {
                    _logger.LogDebug("User already authenticated with active session: " + userSettings.UserId);
                    principal = userSettings.AuthenticatedUser.ToClaimsPrincipal(options.Scheme, userSettings.UserType);
                    return(AuthenticateResult.Success(new AuthenticationTicket(principal, null, Options.Scheme)));
                }

                string smgov_userdisplayname = context.Request.Headers["smgov_userdisplayname"];
                if (!string.IsNullOrEmpty(smgov_userdisplayname))
                {
                    userSettings.UserDisplayName = smgov_userdisplayname;
                }

                string smgov_businesslegalname = context.Request.Headers["smgov_businesslegalname"];
                if (!string.IsNullOrEmpty(smgov_businesslegalname))
                {
                    userSettings.BusinessLegalName = smgov_businesslegalname;
                }

                // **************************************************
                // Authenticate based on SiteMinder Headers
                // **************************************************
                _logger.LogDebug("Parsing the HTTP headers for SiteMinder authentication credential");

                // At this point userID would only be set if we are logging in through as a DEV user

                if (string.IsNullOrEmpty(userId))
                {
                    _logger.LogDebug("Getting user data from headers");

                    userId = context.Request.Headers[options.SiteMinderUserNameKey];
                    if (string.IsNullOrEmpty(userId))
                    {
                        userId = context.Request.Headers[options.SiteMinderUniversalIdKey];
                    }

                    siteMinderGuid         = context.Request.Headers[options.SiteMinderUserGuidKey];
                    siteMinderBusinessGuid = context.Request.Headers[options.SiteMinderBusinessGuidKey];
                    siteMinderUserType     = context.Request.Headers[options.SiteMinderUserTypeKey];


                    // **************************************************
                    // Validate credentials
                    // **************************************************
                    if (string.IsNullOrEmpty(userId))
                    {
                        _logger.LogDebug(options.MissingSiteMinderUserIdError);
                        return(AuthenticateResult.Fail(options.MissingSiteMinderGuidError));
                    }

                    if (string.IsNullOrEmpty(siteMinderGuid))
                    {
                        _logger.LogDebug(options.MissingSiteMinderGuidError);
                        return(AuthenticateResult.Fail(options.MissingSiteMinderGuidError));
                    }
                    if (string.IsNullOrEmpty(siteMinderUserType))
                    {
                        _logger.LogDebug(options.MissingSiteMinderUserTypeError);
                        return(AuthenticateResult.Fail(options.MissingSiteMinderUserTypeError));
                    }
                }
                else // DEV user, setup a fake session and SiteMinder headers.
                {
                    if (isDeveloperLogin)
                    {
                        _logger.LogDebug("Generating a Development user");
                        userSettings.BusinessLegalName = devCompanyId + " TestBusiness";
                        userSettings.UserDisplayName   = userId + " TestUser";
                        siteMinderGuid         = GuidUtility.CreateIdForDynamics("contact", userSettings.UserDisplayName).ToString();
                        siteMinderBusinessGuid = GuidUtility.CreateIdForDynamics("account", userSettings.BusinessLegalName).ToString();
                        siteMinderUserType     = "Business";
                    }
                    else if (isBCSCDeveloperLogin)
                    {
                        _logger.LogDebug("Generating a Development BC Services user");
                        userSettings.BusinessLegalName = null;
                        userSettings.UserDisplayName   = userId + " Associate";
                        siteMinderGuid         = GuidUtility.CreateIdForDynamics("bcsc", userSettings.UserDisplayName).ToString();
                        siteMinderBusinessGuid = null;
                        siteMinderUserType     = "VerifiedIndividual";
                    }
                }

                // Previously the code would do a database lookup here.  However there is no backing database for the users table now,
                // so we just do a Dynamics lookup on the siteMinderGuid.

                _logger.LogDebug("Loading user external id = " + siteMinderGuid);
                // 3/18/2020 - Note that LoadUser will now work if there is a match on the guid, as well as a match on name in a case where there is no guid.
                userSettings.AuthenticatedUser = await _dynamicsClient.LoadUser(siteMinderGuid, context.Request.Headers, _logger);

                _logger.LogDebug("After getting authenticated user = "******" (" + userId + ")");
                    return(AuthenticateResult.Fail(options.InactivegDbUserIdError));
                }

                if (userSettings.AuthenticatedUser != null && !String.IsNullOrEmpty(siteMinderUserType))
                {
                    userSettings.AuthenticatedUser.UserType = siteMinderUserType;
                }
                userSettings.UserType = siteMinderUserType;

                // This line gets the various claims for the current user.
                ClaimsPrincipal userPrincipal = userSettings.AuthenticatedUser.ToClaimsPrincipal(options.Scheme, userSettings.UserType);

                // **************************************************
                // Create authenticated user
                // **************************************************
                _logger.LogDebug("Authentication successful: " + userId);
                _logger.LogDebug("Setting identity and creating session for: " + userId);

                // create session info for the current user
                userSettings.UserId                = userId;
                userSettings.UserAuthenticated     = true;
                userSettings.IsNewUserRegistration = userSettings.AuthenticatedUser == null;

                // set other session info
                userSettings.SiteMinderGuid         = siteMinderGuid;
                userSettings.SiteMinderBusinessGuid = siteMinderBusinessGuid;
                _logger.LogDebug("Before getting contact and account ids = " + userSettings.GetJson());

                if (userSettings.AuthenticatedUser != null)
                {
                    userSettings.ContactId = userSettings.AuthenticatedUser.ContactId.ToString();
                    // ensure that the given account has a documents folder.

                    if (siteMinderBusinessGuid != null) // BCeID user
                    {
                        var contact = _dynamicsClient.GetContactByExternalId(userSettings.ContactId);
                        if (contact == null)
                        {
                            // try by other means.
                            var contactVM = new Public.ViewModels.Contact();
                            contactVM.CopyHeaderValues(context.Request.Headers);
                            contact = _dynamicsClient.GetContactByContactVmBlankSmGuid(contactVM);
                        }
                        if (contact != null && contact.Contactid != null)
                        {
                            await CreateContactDocumentLocation(_dynamicsClient, _fileManagerClient, contact);
                        }


                        var account = await _dynamicsClient.GetAccountBySiteminderBusinessGuid(siteMinderBusinessGuid);

                        if (account == null)
                        {
                            // try by other means.
                            account = _dynamicsClient.GetAccountByLegalName(userSettings.BusinessLegalName);
                        }
                        if (account != null && account.Accountid != null)
                        {
                            userSettings.AccountId = account.Accountid;
                            userSettings.AuthenticatedUser.AccountId = Guid.Parse(account.Accountid);

                            // ensure that the given account has a documents folder.
                            await CreateAccountDocumentLocation(_dynamicsClient, _fileManagerClient, account);
                        }
                    }
                }

                if (!hostingEnv.IsProduction() && (isDeveloperLogin || isBCSCDeveloperLogin))
                {
                    _logger.LogDebug("DEV MODE Setting identity and creating session for: " + userId);

                    if (isDeveloperLogin)
                    {
                        userSettings.BusinessLegalName = devCompanyId + " TestBusiness";
                        userSettings.UserDisplayName   = userId + " TestUser";

                        // add generated guids
                        userSettings.SiteMinderBusinessGuid = GuidUtility.CreateIdForDynamics("account", userSettings.BusinessLegalName).ToString();
                        userSettings.SiteMinderGuid         = GuidUtility.CreateIdForDynamics("contact", userSettings.UserDisplayName).ToString();
                    }
                    else if (isBCSCDeveloperLogin)
                    {
                        userSettings.BusinessLegalName = null;
                        userSettings.UserDisplayName   = userId + " Associate";

                        // add generated guids
                        userSettings.SiteMinderBusinessGuid = null;
                        userSettings.SiteMinderGuid         = GuidUtility.CreateIdForDynamics("bcsc", userSettings.UserDisplayName).ToString();
                    }

                    if (userSettings.IsNewUserRegistration)
                    {
                        if (isDeveloperLogin)
                        {
                            // add generated guids
                            // set to null to indicate that the user is still registering the account
                            userSettings.AccountId = null;
                            userSettings.ContactId = null;
                        }
                        else if (isBCSCDeveloperLogin)
                        {
                            // set to null for now
                            userSettings.AccountId = null;
                            userSettings.ContactId = null;
                        }

                        _logger.LogDebug("New user registration:" + userSettings.UserDisplayName);
                        _logger.LogDebug("userSettings.SiteMinderBusinessGuid:" + userSettings.SiteMinderBusinessGuid);
                        _logger.LogDebug("userSettings.SiteMinderGuid:" + userSettings.SiteMinderGuid);
                        _logger.LogDebug("userSettings.AccountId:" + userSettings.AccountId);
                        _logger.LogDebug("userSettings.ContactId:" + userSettings.ContactId);
                    }
                    // Set account ID from authenticated user
                    else if (userSettings.AuthenticatedUser != null)
                    {
                        // populate the business GUID.
                        if (string.IsNullOrEmpty(userSettings.AccountId))
                        {
                            userSettings.AccountId = userSettings.AuthenticatedUser.AccountId.ToString();
                        }
                        if (string.IsNullOrEmpty(userSettings.ContactId))
                        {
                            userSettings.ContactId = userSettings.AuthenticatedUser.ContactId.ToString();
                        }
                        _logger.LogDebug("Returning user:"******"userSettings.AccountId:" + userSettings.AccountId);
                        _logger.LogDebug("userSettings.ContactId:" + userSettings.ContactId);
                    }
                }

                // add the worker settings if it is a new user.
                if (userSettings.IsNewUserRegistration)
                {
                    userSettings.NewWorker = new ViewModels.Worker();
                    userSettings.NewWorker.CopyHeaderValues(context.Request.Headers);

                    userSettings.NewContact = new ViewModels.Contact();
                    userSettings.NewContact.CopyHeaderValues(context.Request.Headers);

                    if (isBCSCDeveloperLogin)
                    {
                        userSettings.NewWorker.firstname  = userId;
                        userSettings.NewWorker.lastname   = "Associate";
                        userSettings.NewContact.firstname = userId;
                        userSettings.NewContact.lastname  = "Associate";
                    }
                }
                else if (siteMinderUserType == "VerifiedIndividual")
                {
                    // Verified individual is from BC Service Card which means it's a worker
                    // Update contact and worker with latest info from BC Service Card
                    MicrosoftDynamicsCRMadoxioWorkerCollection workerCollection = _dynamicsClient.Workers.Get(filter: $"_adoxio_contactid_value eq {userSettings.ContactId}");
                    if (workerCollection.Value.Count > 0)
                    {
                        MicrosoftDynamicsCRMadoxioWorker savedWorker = workerCollection.Value[0];
                        ViewModels.Contact contact = new ViewModels.Contact();
                        contact.CopyHeaderValues(context.Request.Headers);

                        MicrosoftDynamicsCRMcontact savedContact = _dynamicsClient.Contacts.GetByKey(userSettings.ContactId);
                        if (savedContact.Address1Line1 != null && savedContact.Address1Line1 != contact.address1_line1)
                        {
                            MicrosoftDynamicsCRMadoxioPreviousaddress prevAddress = new MicrosoftDynamicsCRMadoxioPreviousaddress()
                            {
                                AdoxioStreetaddress = savedContact.Address1Line1,
                                AdoxioProvstate     = savedContact.Address1Stateorprovince,
                                AdoxioCity          = savedContact.Address1City,
                                AdoxioCountry       = savedContact.Address1Country,
                                AdoxioPostalcode    = savedContact.Address1Postalcode,
                                ContactIdODataBind  = _dynamicsClient.GetEntityURI("contacts", savedContact.Contactid)
                            };
                            _dynamicsClient.Previousaddresses.Create(prevAddress);
                        }


                        _dynamicsClient.Contacts.Update(userSettings.ContactId, contact.ToModel());


                        ViewModels.Worker worker = new ViewModels.Worker();
                        worker.CopyHeaderValues(context.Request.Headers);

                        MicrosoftDynamicsCRMadoxioWorker patchWorker = new MicrosoftDynamicsCRMadoxioWorker()
                        {
                            AdoxioFirstname  = worker.firstname,
                            AdoxioLastname   = worker.lastname,
                            AdoxioMiddlename = worker.middlename
                        };
                        if (worker.gender != 0)
                        {
                            patchWorker.AdoxioGendercode = (int)worker.gender;
                        }

                        _dynamicsClient.Workers.Update(savedWorker.AdoxioWorkerid, patchWorker);

                        var updatedWorker = await _dynamicsClient.GetWorkerByIdWithChildren(savedWorker.AdoxioWorkerid);

                        // only create the worker document location if the FEATURE_NO_WET_SIGNATURE setting is blank
                        if (string.IsNullOrEmpty(_configuration["FEATURE_NO_WET_SIGNATURE"]))
                        {
                            // ensure that the worker has a documents folder.
                            await CreateWorkerDocumentLocation(_dynamicsClient, _fileManagerClient, updatedWorker);
                        }
                    }
                }

                // **************************************************
                // Update user settings
                // **************************************************
                UserSettings.SaveUserSettings(userSettings, context);

                // done!
                principal = userPrincipal;
                return(AuthenticateResult.Success(new AuthenticationTicket(principal, null, Options.Scheme)));
            }
            catch (Exception exception)
            {
                _logger.LogError(exception.Message);
                throw;
            }
        }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the MicrosoftDynamicsCRMsocialprofile
 /// class.
 /// </summary>
 public MicrosoftDynamicsCRMsocialprofile(string _modifiedbyValue = default(string), decimal?exchangerate = default(decimal?), string _modifiedonbehalfbyValue = default(string), string influencescore = default(string), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), string profilelink = default(string), string _createdonbehalfbyValue = default(string), int?community = default(int?), string _transactioncurrencyidValue = default(string), string _createdbyValue = default(string), int?statecode = default(int?), bool?blocked = default(bool?), int?utcconversiontimezonecode = default(int?), string socialprofileid = default(string), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), string profilefullname = default(string), string uniqueprofileid = default(string), int?timezoneruleversionnumber = default(int?), int?statuscode = default(int?), string _owninguserValue = default(string), string _owneridValue = default(string), string profilename = default(string), int?importsequencenumber = default(int?), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), string _owningteamValue = default(string), string _owningbusinessunitValue = default(string), string versionnumber = default(string), string _customeridValue = default(string), IList <MicrosoftDynamicsCRMincident> socialprofileCases = default(IList <MicrosoftDynamicsCRMincident>), IList <MicrosoftDynamicsCRMduplicaterecord> socialProfileDuplicateBaseRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMasyncoperation> socialProfileAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), MicrosoftDynamicsCRMsystemuser modifiedonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMbusinessunit owningbusinessunit = default(MicrosoftDynamicsCRMbusinessunit), IList <MicrosoftDynamicsCRMconnection> socialprofileConnections1 = default(IList <MicrosoftDynamicsCRMconnection>), IList <MicrosoftDynamicsCRMconnection> socialprofileConnections2 = default(IList <MicrosoftDynamicsCRMconnection>), MicrosoftDynamicsCRMsystemuser owninguser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMcontact customeridContact = default(MicrosoftDynamicsCRMcontact), IList <MicrosoftDynamicsCRMsyncerror> socialProfileSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> socialprofilePrincipalobjectattributeaccess = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), IList <MicrosoftDynamicsCRMsocialactivity> socialprofileSocialActivities = default(IList <MicrosoftDynamicsCRMsocialactivity>), MicrosoftDynamicsCRMprincipal ownerid = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMtransactioncurrency transactioncurrencyid = default(MicrosoftDynamicsCRMtransactioncurrency), IList <MicrosoftDynamicsCRMprocesssession> socialProfileProcessSessions = default(IList <MicrosoftDynamicsCRMprocesssession>), IList <MicrosoftDynamicsCRMduplicaterecord> socialProfileDuplicateMatchingRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), MicrosoftDynamicsCRMaccount customeridAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMsystemuser createdonbehalfby = default(MicrosoftDynamicsCRMsystemuser))
 {
     this._modifiedbyValue         = _modifiedbyValue;
     Exchangerate                  = exchangerate;
     this._modifiedonbehalfbyValue = _modifiedonbehalfbyValue;
     Influencescore                = influencescore;
     Createdon   = createdon;
     Profilelink = profilelink;
     this._createdonbehalfbyValue = _createdonbehalfbyValue;
     Community = community;
     this._transactioncurrencyidValue = _transactioncurrencyidValue;
     this._createdbyValue             = _createdbyValue;
     Statecode = statecode;
     Blocked   = blocked;
     Utcconversiontimezonecode = utcconversiontimezonecode;
     Socialprofileid           = socialprofileid;
     Modifiedon                                  = modifiedon;
     Profilefullname                             = profilefullname;
     Uniqueprofileid                             = uniqueprofileid;
     Timezoneruleversionnumber                   = timezoneruleversionnumber;
     Statuscode                                  = statuscode;
     this._owninguserValue                       = _owninguserValue;
     this._owneridValue                          = _owneridValue;
     Profilename                                 = profilename;
     Importsequencenumber                        = importsequencenumber;
     Overriddencreatedon                         = overriddencreatedon;
     this._owningteamValue                       = _owningteamValue;
     this._owningbusinessunitValue               = _owningbusinessunitValue;
     Versionnumber                               = versionnumber;
     this._customeridValue                       = _customeridValue;
     SocialprofileCases                          = socialprofileCases;
     SocialProfileDuplicateBaseRecord            = socialProfileDuplicateBaseRecord;
     SocialProfileAsyncOperations                = socialProfileAsyncOperations;
     Modifiedonbehalfby                          = modifiedonbehalfby;
     Owningbusinessunit                          = owningbusinessunit;
     SocialprofileConnections1                   = socialprofileConnections1;
     SocialprofileConnections2                   = socialprofileConnections2;
     Owninguser                                  = owninguser;
     CustomeridContact                           = customeridContact;
     SocialProfileSyncErrors                     = socialProfileSyncErrors;
     SocialprofilePrincipalobjectattributeaccess = socialprofilePrincipalobjectattributeaccess;
     SocialprofileSocialActivities               = socialprofileSocialActivities;
     Ownerid = ownerid;
     Transactioncurrencyid                = transactioncurrencyid;
     SocialProfileProcessSessions         = socialProfileProcessSessions;
     SocialProfileDuplicateMatchingRecord = socialProfileDuplicateMatchingRecord;
     CustomeridAccount = customeridAccount;
     Createdonbehalfby = createdonbehalfby;
     CustomInit();
 }
コード例 #12
0
 public static void CopyValues(this MicrosoftDynamicsCRMcontact to, ViewModels.Contact from)
 {
     to.Emailaddress1 = from.emailaddress1;
     to.Telephone1    = from.telephone1;
     to.CopyValuesNoEmailPhone(from);
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the
 /// MicrosoftDynamicsCRMcustomeraddress class.
 /// </summary>
 public MicrosoftDynamicsCRMcustomeraddress(string _modifiedbyValue = default(string), int?addresstypecode = default(int?), string _owneridValue = default(string), string customeraddressid = default(string), string _createdonbehalfbyValue = default(string), string line2 = default(string), int?utcconversiontimezonecode = default(int?), int?addressnumber = default(int?), string postofficebox = default(string), string telephone1 = default(string), int?utcoffset = default(int?), string line3 = default(string), string _owninguserValue = default(string), int?importsequencenumber = default(int?), string line1 = default(string), string versionnumber = default(string), string _parentidValue = default(string), string postalcode = default(string), int?freighttermscode = default(int?), decimal?exchangerate = default(decimal?), string country = default(string), string county = default(string), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), string _owningbusinessunitValue = default(string), string stateorprovince = default(string), string _createdbyValue = default(string), string _transactioncurrencyidValue = default(string), int?shippingmethodcode = default(int?), string primarycontactname = default(string), string city = default(string), string fax = default(string), string _modifiedonbehalfbyValue = default(string), string objecttypecode = default(string), string telephone2 = default(string), string upszone = default(string), string composite = default(string), string longitude = default(string), int?timezoneruleversionnumber = default(int?), string telephone3 = default(string), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), string latitude = default(string), string name = default(string), IList <MicrosoftDynamicsCRMcontract> customerAddressContractsAsBillingAddress = default(IList <MicrosoftDynamicsCRMcontract>), IList <MicrosoftDynamicsCRMcontract> customerAddressContractsAsServiceAddress = default(IList <MicrosoftDynamicsCRMcontract>), IList <MicrosoftDynamicsCRMcontractdetail> customerAddressContractLineItems = default(IList <MicrosoftDynamicsCRMcontractdetail>), IList <MicrosoftDynamicsCRMbulkdeletefailure> customerAddressBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), MicrosoftDynamicsCRMsystemuser modifiedonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMtransactioncurrency transactioncurrencyid = default(MicrosoftDynamicsCRMtransactioncurrency), IList <MicrosoftDynamicsCRMprocesssession> customerAddressProcessSessions = default(IList <MicrosoftDynamicsCRMprocesssession>), MicrosoftDynamicsCRMaccount parentidAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMcontact parentidContact = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMsystemuser modifiedby = default(MicrosoftDynamicsCRMsystemuser), IList <MicrosoftDynamicsCRMsyncerror> customerAddressSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> customeraddressPrincipalobjectattributeaccess = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), IList <MicrosoftDynamicsCRMasyncoperation> customerAddressAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>))
 {
     this._modifiedbyValue        = _modifiedbyValue;
     Addresstypecode              = addresstypecode;
     this._owneridValue           = _owneridValue;
     Customeraddressid            = customeraddressid;
     this._createdonbehalfbyValue = _createdonbehalfbyValue;
     Line2 = line2;
     Utcconversiontimezonecode = utcconversiontimezonecode;
     Addressnumber             = addressnumber;
     Postofficebox             = postofficebox;
     Telephone1                       = telephone1;
     Utcoffset                        = utcoffset;
     Line3                            = line3;
     this._owninguserValue            = _owninguserValue;
     Importsequencenumber             = importsequencenumber;
     Line1                            = line1;
     Versionnumber                    = versionnumber;
     this._parentidValue              = _parentidValue;
     Postalcode                       = postalcode;
     Freighttermscode                 = freighttermscode;
     Exchangerate                     = exchangerate;
     Country                          = country;
     County                           = county;
     Createdon                        = createdon;
     this._owningbusinessunitValue    = _owningbusinessunitValue;
     Stateorprovince                  = stateorprovince;
     this._createdbyValue             = _createdbyValue;
     this._transactioncurrencyidValue = _transactioncurrencyidValue;
     Shippingmethodcode               = shippingmethodcode;
     Primarycontactname               = primarycontactname;
     City = city;
     Fax  = fax;
     this._modifiedonbehalfbyValue = _modifiedonbehalfbyValue;
     Objecttypecode            = objecttypecode;
     Telephone2                = telephone2;
     Upszone                   = upszone;
     Composite                 = composite;
     Longitude                 = longitude;
     Timezoneruleversionnumber = timezoneruleversionnumber;
     Telephone3                = telephone3;
     Modifiedon                = modifiedon;
     Overriddencreatedon       = overriddencreatedon;
     Latitude                  = latitude;
     Name = name;
     CustomerAddressContractsAsBillingAddress = customerAddressContractsAsBillingAddress;
     CustomerAddressContractsAsServiceAddress = customerAddressContractsAsServiceAddress;
     CustomerAddressContractLineItems         = customerAddressContractLineItems;
     CustomerAddressBulkDeleteFailures        = customerAddressBulkDeleteFailures;
     Modifiedonbehalfby             = modifiedonbehalfby;
     Createdby                      = createdby;
     Createdonbehalfby              = createdonbehalfby;
     Transactioncurrencyid          = transactioncurrencyid;
     CustomerAddressProcessSessions = customerAddressProcessSessions;
     ParentidAccount                = parentidAccount;
     ParentidContact                = parentidContact;
     Modifiedby                     = modifiedby;
     CustomerAddressSyncErrors      = customerAddressSyncErrors;
     CustomeraddressPrincipalobjectattributeaccess = customeraddressPrincipalobjectattributeaccess;
     CustomerAddressAsyncOperations = customerAddressAsyncOperations;
     CustomInit();
 }
コード例 #14
0
        /// <summary>
        /// Import responses to Dynamics.
        /// </summary>
        /// <returns></returns>
        private void ImportWorkerRequestsToDynamics(PerformContext hangfireContext, List <WorkerScreeningRequest> requests)
        {
            if (_dynamics == null)
            {
                hangfireContext.WriteLine("Dynamics not configured properly");
                return;
            }
            foreach (WorkerScreeningRequest workerRequest in requests)
            {
                // add data to dynamics.
                // create a Contact which will be bound to the customer id field.
                MicrosoftDynamicsCRMcontact contact = null;

                if (workerRequest.Contact != null)
                {
                    contact = _dynamics.GetContactByExternalId(workerRequest.Contact.ContactId);

                    if (contact == null)
                    {
                        contact = new MicrosoftDynamicsCRMcontact();
                    }

                    contact.Firstname        = workerRequest.Contact.FirstName;
                    contact.Lastname         = workerRequest.Contact.LastName;
                    contact.SpiceDateofbirth = workerRequest.Contact.BirthDate;
                    contact.Emailaddress1    = workerRequest.Contact.Email;
                    if (workerRequest.Contact.Address != null)
                    {
                        contact.Address1Line1           = workerRequest.Contact.Address.AddressStreet1;
                        contact.Address1Line2           = workerRequest.Contact.Address.AddressStreet2;
                        contact.Address1City            = workerRequest.Contact.Address.City;
                        contact.Address1Stateorprovince = workerRequest.Contact.Address.StateProvince;
                        contact.Address1Postalcode      = workerRequest.Contact.Address.Postal;
                        contact.Address1Country         = workerRequest.Contact.Address.Country;
                    }

                    contact.SpiceBcidcardnumber       = workerRequest.BCIdCardNumber;
                    contact.SpiceDriverslicensenumber = int.Parse(workerRequest.DriversLicence);
                    //contact.Externaluseridentifier = workerRequest.RecordIdentifier;
                    contact.Gendercode = (int?)workerRequest.Gender;

                    if (contact.Contactid == null) // new record
                    {
                        contact = _dynamics.Contacts.Create(contact);
                    }
                    else
                    {
                        _dynamics.Contacts.Update(contact.Contactid, contact);
                    }
                }


                MicrosoftDynamicsCRMincident incident = new MicrosoftDynamicsCRMincident();

                incident.SpiceApplicanttype         = 525840001; // Cannabis
                incident.SpiceCannabisapplicanttype = 525840002; // Worker

                // Screenings are Incidents in Dynamics.

                _dynamics.Incidents.Create(incident);
            }
        }
コード例 #15
0
 /// <summary>
 /// Update entity in contacts
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='contactid'>
 /// key: contactid
 /// </param>
 /// <param name='body'>
 /// New property values
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task UpdateAsync(this IContacts operations, string contactid, MicrosoftDynamicsCRMcontact body, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.UpdateWithHttpMessagesAsync(contactid, body, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the MicrosoftDynamicsCRMcontract
 /// class.
 /// </summary>
 public MicrosoftDynamicsCRMcontract(decimal?exchangerate = default(decimal?), decimal?totaldiscount = default(decimal?), string title = default(string), string entityimageid = default(string), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), decimal?netpriceBase = default(decimal?), string _owninguserValue = default(string), int?contractservicelevelcode = default(int?), string _billingaccountidValue = default(string), string contractid = default(string), string contractnumber = default(string), string _originatingcontractValue = default(string), string _billingcontactidValue = default(string), string _createdonbehalfbyValue = default(string), string versionnumber = default(string), string _billtoaddressValue = default(string), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), int?allotmenttypecode = default(int?), decimal?totalprice = default(decimal?), string _owningteamValue = default(string), int?timezoneruleversionnumber = default(int?), string _customeridValue = default(string), string entityimageUrl = default(string), string effectivitycalendar = default(string), int?billingfrequencycode = default(int?), string _billingcustomeridValue = default(string), string emailaddress = default(string), string _contracttemplateidValue = default(string), decimal?totalpriceBase = default(decimal?), string contractlanguage = default(string), string _createdbyValue = default(string), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), string contracttemplateabbreviation = default(string), System.DateTimeOffset?cancelon = default(System.DateTimeOffset?), int?duration = default(int?), string _transactioncurrencyidValue = default(string), int?importsequencenumber = default(int?), int?utcconversiontimezonecode = default(int?), byte[] entityimage = default(byte[]), System.DateTimeOffset?billingstarton = default(System.DateTimeOffset?), string _serviceaddressValue = default(string), string _contactidValue = default(string), decimal?netprice = default(decimal?), long?entityimageTimestamp = default(long?), string _owneridValue = default(string), string _modifiedonbehalfbyValue = default(string), int?statecode = default(int?), string _owningbusinessunitValue = default(string), string _modifiedbyValue = default(string), string _accountidValue = default(string), int?statuscode = default(int?), decimal?totaldiscountBase = default(decimal?), System.DateTimeOffset?activeon = default(System.DateTimeOffset?), System.DateTimeOffset?billingendon = default(System.DateTimeOffset?), bool?usediscountaspercentage = default(bool?), System.DateTimeOffset?expireson = default(System.DateTimeOffset?), MicrosoftDynamicsCRMsystemuser createdby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser owninguser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteam = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMprincipal ownerid = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMbusinessunit owningbusinessunit = default(MicrosoftDynamicsCRMbusinessunit), IList <MicrosoftDynamicsCRMactivitypointer> contractActivityPointers = default(IList <MicrosoftDynamicsCRMactivitypointer>), IList <MicrosoftDynamicsCRMsyncerror> contractSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMactivityparty> contractActivityParties = default(IList <MicrosoftDynamicsCRMactivityparty>), IList <MicrosoftDynamicsCRMduplicaterecord> contractDuplicateMatchingRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMduplicaterecord> contractDuplicateBaseRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMasyncoperation> contractAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMmailboxtrackingfolder> contractMailboxTrackingFolder = default(IList <MicrosoftDynamicsCRMmailboxtrackingfolder>), IList <MicrosoftDynamicsCRMprocesssession> contractProcessSessions = default(IList <MicrosoftDynamicsCRMprocesssession>), IList <MicrosoftDynamicsCRMbulkdeletefailure> contractBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> contractPrincipalobjectattributeaccess = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), MicrosoftDynamicsCRMtransactioncurrency transactioncurrencyid = default(MicrosoftDynamicsCRMtransactioncurrency), IList <MicrosoftDynamicsCRMappointment> contractAppointments = default(IList <MicrosoftDynamicsCRMappointment>), IList <MicrosoftDynamicsCRMemail> contractEmails = default(IList <MicrosoftDynamicsCRMemail>), IList <MicrosoftDynamicsCRMfax> contractFaxes = default(IList <MicrosoftDynamicsCRMfax>), IList <MicrosoftDynamicsCRMletter> contractLetters = default(IList <MicrosoftDynamicsCRMletter>), IList <MicrosoftDynamicsCRMphonecall> contractPhonecalls = default(IList <MicrosoftDynamicsCRMphonecall>), IList <MicrosoftDynamicsCRMtask> contractTasks = default(IList <MicrosoftDynamicsCRMtask>), IList <MicrosoftDynamicsCRMrecurringappointmentmaster> contractRecurringAppointmentMasters = default(IList <MicrosoftDynamicsCRMrecurringappointmentmaster>), IList <MicrosoftDynamicsCRMsocialactivity> contractSocialActivities = default(IList <MicrosoftDynamicsCRMsocialactivity>), IList <MicrosoftDynamicsCRMconnection> contractConnections1 = default(IList <MicrosoftDynamicsCRMconnection>), IList <MicrosoftDynamicsCRMconnection> contractConnections2 = default(IList <MicrosoftDynamicsCRMconnection>), IList <MicrosoftDynamicsCRMannotation> contractAnnotation = default(IList <MicrosoftDynamicsCRMannotation>), IList <MicrosoftDynamicsCRMserviceappointment> contractServiceAppointments = default(IList <MicrosoftDynamicsCRMserviceappointment>), MicrosoftDynamicsCRMaccount billingcustomeridAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMaccount customeridAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMcontact billingcustomeridContact = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMcontact customeridContact = default(MicrosoftDynamicsCRMcontact), IList <MicrosoftDynamicsCRMincident> contractCases = default(IList <MicrosoftDynamicsCRMincident>), IList <MicrosoftDynamicsCRMcontractdetail> contractLineItems = default(IList <MicrosoftDynamicsCRMcontractdetail>), MicrosoftDynamicsCRMcontract originatingcontract = default(MicrosoftDynamicsCRMcontract), IList <MicrosoftDynamicsCRMcontract> contractOriginatingContract = default(IList <MicrosoftDynamicsCRMcontract>), IList <MicrosoftDynamicsCRMcontact> servicecontractcontactsAssociation = default(IList <MicrosoftDynamicsCRMcontact>), MicrosoftDynamicsCRMcontracttemplate contracttemplateid = default(MicrosoftDynamicsCRMcontracttemplate), MicrosoftDynamicsCRMcustomeraddress billtoaddress = default(MicrosoftDynamicsCRMcustomeraddress), MicrosoftDynamicsCRMcustomeraddress serviceaddress = default(MicrosoftDynamicsCRMcustomeraddress), IList <MicrosoftDynamicsCRMcsuCasetask> contractCsuCasetasks = default(IList <MicrosoftDynamicsCRMcsuCasetask>))
 {
     Exchangerate                           = exchangerate;
     Totaldiscount                          = totaldiscount;
     Title                                  = title;
     Entityimageid                          = entityimageid;
     Overriddencreatedon                    = overriddencreatedon;
     NetpriceBase                           = netpriceBase;
     this._owninguserValue                  = _owninguserValue;
     Contractservicelevelcode               = contractservicelevelcode;
     this._billingaccountidValue            = _billingaccountidValue;
     Contractid                             = contractid;
     Contractnumber                         = contractnumber;
     this._originatingcontractValue         = _originatingcontractValue;
     this._billingcontactidValue            = _billingcontactidValue;
     this._createdonbehalfbyValue           = _createdonbehalfbyValue;
     Versionnumber                          = versionnumber;
     this._billtoaddressValue               = _billtoaddressValue;
     Createdon                              = createdon;
     Allotmenttypecode                      = allotmenttypecode;
     Totalprice                             = totalprice;
     this._owningteamValue                  = _owningteamValue;
     Timezoneruleversionnumber              = timezoneruleversionnumber;
     this._customeridValue                  = _customeridValue;
     EntityimageUrl                         = entityimageUrl;
     Effectivitycalendar                    = effectivitycalendar;
     Billingfrequencycode                   = billingfrequencycode;
     this._billingcustomeridValue           = _billingcustomeridValue;
     Emailaddress                           = emailaddress;
     this._contracttemplateidValue          = _contracttemplateidValue;
     TotalpriceBase                         = totalpriceBase;
     Contractlanguage                       = contractlanguage;
     this._createdbyValue                   = _createdbyValue;
     Modifiedon                             = modifiedon;
     Contracttemplateabbreviation           = contracttemplateabbreviation;
     Cancelon                               = cancelon;
     Duration                               = duration;
     this._transactioncurrencyidValue       = _transactioncurrencyidValue;
     Importsequencenumber                   = importsequencenumber;
     Utcconversiontimezonecode              = utcconversiontimezonecode;
     Entityimage                            = entityimage;
     Billingstarton                         = billingstarton;
     this._serviceaddressValue              = _serviceaddressValue;
     this._contactidValue                   = _contactidValue;
     Netprice                               = netprice;
     EntityimageTimestamp                   = entityimageTimestamp;
     this._owneridValue                     = _owneridValue;
     this._modifiedonbehalfbyValue          = _modifiedonbehalfbyValue;
     Statecode                              = statecode;
     this._owningbusinessunitValue          = _owningbusinessunitValue;
     this._modifiedbyValue                  = _modifiedbyValue;
     this._accountidValue                   = _accountidValue;
     Statuscode                             = statuscode;
     TotaldiscountBase                      = totaldiscountBase;
     Activeon                               = activeon;
     Billingendon                           = billingendon;
     Usediscountaspercentage                = usediscountaspercentage;
     Expireson                              = expireson;
     Createdby                              = createdby;
     Createdonbehalfby                      = createdonbehalfby;
     Modifiedby                             = modifiedby;
     Modifiedonbehalfby                     = modifiedonbehalfby;
     Owninguser                             = owninguser;
     Owningteam                             = owningteam;
     Ownerid                                = ownerid;
     Owningbusinessunit                     = owningbusinessunit;
     ContractActivityPointers               = contractActivityPointers;
     ContractSyncErrors                     = contractSyncErrors;
     ContractActivityParties                = contractActivityParties;
     ContractDuplicateMatchingRecord        = contractDuplicateMatchingRecord;
     ContractDuplicateBaseRecord            = contractDuplicateBaseRecord;
     ContractAsyncOperations                = contractAsyncOperations;
     ContractMailboxTrackingFolder          = contractMailboxTrackingFolder;
     ContractProcessSessions                = contractProcessSessions;
     ContractBulkDeleteFailures             = contractBulkDeleteFailures;
     ContractPrincipalobjectattributeaccess = contractPrincipalobjectattributeaccess;
     Transactioncurrencyid                  = transactioncurrencyid;
     ContractAppointments                   = contractAppointments;
     ContractEmails                         = contractEmails;
     ContractFaxes                          = contractFaxes;
     ContractLetters                        = contractLetters;
     ContractPhonecalls                     = contractPhonecalls;
     ContractTasks                          = contractTasks;
     ContractRecurringAppointmentMasters    = contractRecurringAppointmentMasters;
     ContractSocialActivities               = contractSocialActivities;
     ContractConnections1                   = contractConnections1;
     ContractConnections2                   = contractConnections2;
     ContractAnnotation                     = contractAnnotation;
     ContractServiceAppointments            = contractServiceAppointments;
     BillingcustomeridAccount               = billingcustomeridAccount;
     CustomeridAccount                      = customeridAccount;
     BillingcustomeridContact               = billingcustomeridContact;
     CustomeridContact                      = customeridContact;
     ContractCases                          = contractCases;
     ContractLineItems                      = contractLineItems;
     Originatingcontract                    = originatingcontract;
     ContractOriginatingContract            = contractOriginatingContract;
     ServicecontractcontactsAssociation     = servicecontractcontactsAssociation;
     Contracttemplateid                     = contracttemplateid;
     Billtoaddress                          = billtoaddress;
     Serviceaddress                         = serviceaddress;
     ContractCsuCasetasks                   = contractCsuCasetasks;
     CustomInit();
 }
コード例 #17
0
 /// <summary>
 /// Add new entity to contacts
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// New entity
 /// </param>
 /// <param name='prefer'>
 /// Required in order for the service to return a JSON representation of the
 /// object.
 /// </param>
 public static MicrosoftDynamicsCRMcontact Create(this IContacts operations, MicrosoftDynamicsCRMcontact body, string prefer = "return=representation")
 {
     return(operations.CreateAsync(body, prefer).GetAwaiter().GetResult());
 }
        private async Task CreateSharePointContactDocumentLocation(FileManagerClient _fileManagerClient, MicrosoftDynamicsCRMcontact contact)
        {
            string folderName;
            string logFolderName = "";

            try
            {
                folderName    = contact.GetDocumentFolderName();
                logFolderName = WordSanitizer.Sanitize(folderName);

                var createFolderRequest = new CreateFolderRequest
                {
                    EntityName = "contact",
                    FolderName = folderName
                };

                var createFolderResult = _fileManagerClient.CreateFolder(createFolderRequest);

                if (createFolderResult.ResultStatus == ResultStatus.Fail)
                {
                    _logger.Error($"Error creating folder for contact {logFolderName}. Error is {createFolderResult.ErrorDetail}");
                }
            }
            catch (Exception e)
            {
                _logger.Error(e, $"Error creating folder for contact {logFolderName}");
            }
        }
コード例 #19
0
        public async Task <IActionResult> CreateWorkerContact([FromBody] Contact item)
        {
            // get UserSettings from the session
            var temp         = _httpContextAccessor.HttpContext.Session.GetString("UserSettings");
            var userSettings = JsonConvert.DeserializeObject <UserSettings>(temp);

            // first check to see that we have the correct inputs.
            var contactSiteminderGuid = userSettings.SiteMinderGuid;

            if (contactSiteminderGuid == null || contactSiteminderGuid.Length == 0)
            {
                _logger.LogDebug(LoggingEvents.Error, "No Contact Siteminder Guid exernal id");
                throw new Exception("Error. No ContactSiteminderGuid exernal id");
            }

            // get the contact record.
            MicrosoftDynamicsCRMcontact userContact = null;

            // see if the contact exists.
            try
            {
                userContact = _dynamicsClient.GetActiveContactByExternalId(contactSiteminderGuid);
                if (userContact != null)
                {
                    throw new Exception("Contact already Exists");
                }
            }
            catch (HttpOperationException httpOperationException)
            {
                _logger.LogError(httpOperationException, "Error getting contact by Siteminder Guid.");
                throw new HttpOperationException("Error getting contact by Siteminder Guid");
            }

            // create a new contact.
            var contact = new MicrosoftDynamicsCRMcontact();
            var worker  = new MicrosoftDynamicsCRMadoxioWorker
            {
                AdoxioFirstname  = item.firstname,
                AdoxioMiddlename = item.middlename,
                AdoxioLastname   = item.lastname,
                AdoxioIsmanual   = 0 // 0 for false - is a portal user.
            };


            contact.CopyValues(item);
            // set the type to Retail Worker.
            contact.Customertypecode = 845280000;

            if (userSettings.NewWorker != null)
            {
                // get additional information from the service card headers.
                contact.CopyContactUserSettings(userSettings.NewContact);
                worker.CopyValues(userSettings.NewWorker);
            }

            //Default the country to Canada
            if (string.IsNullOrEmpty(contact.Address1Country))
            {
                contact.Address1Country = "Canada";
            }
            if (string.IsNullOrEmpty(contact.Address2Country))
            {
                contact.Address2Country = "Canada";
            }


            contact.AdoxioExternalid = DynamicsExtensions.GetServiceCardID(contactSiteminderGuid);

            try
            {
                worker.AdoxioContactId = contact;

                worker = await _dynamicsClient.Workers.CreateAsync(worker);

                contact = await _dynamicsClient.GetContactById(Guid.Parse(worker._adoxioContactidValue));
                await CreateSharepointDynamicsLink(worker);
            }
            catch (HttpOperationException httpOperationException)
            {
                _logger.LogError(httpOperationException, "Error updating contact");
                _logger.LogError(httpOperationException.Response.Content);

                //fail
                throw httpOperationException;
            }


            // if we have not yet authenticated, then this is the new record for the user.
            if (userSettings.IsNewUserRegistration)
            {
                userSettings.ContactId = contact.Contactid;

                // we can now authenticate.
                if (userSettings.AuthenticatedUser == null)
                {
                    var user = new User();
                    user.Active    = true;
                    user.ContactId = Guid.Parse(userSettings.ContactId);
                    user.UserType  = userSettings.UserType;
                    user.SmUserId  = userSettings.UserId;
                    userSettings.AuthenticatedUser = user;
                }

                userSettings.IsNewUserRegistration = false;

                var userSettingsString = JsonConvert.SerializeObject(userSettings);
                _logger.LogDebug("userSettingsString --> " + userSettingsString);

                // add the user to the session.
                _httpContextAccessor.HttpContext.Session.SetString("UserSettings", userSettingsString);
                _logger.LogDebug("user added to session. ");
            }
            else
            {
                _logger.LogDebug(LoggingEvents.Error, "Invalid user registration.");
                throw new Exception("Invalid user registration.");
            }

            return(new JsonResult(contact.ToViewModel()));
        }
コード例 #20
0
 /// <summary>
 /// Add new entity to contacts
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// New entity
 /// </param>
 /// <param name='prefer'>
 /// Required in order for the service to return a JSON representation of the
 /// object.
 /// </param>
 /// <param name='customHeaders'>
 /// Headers that will be added to request.
 /// </param>
 public static HttpOperationResponse <MicrosoftDynamicsCRMcontact> CreateWithHttpMessages(this IContacts operations, MicrosoftDynamicsCRMcontact body, string prefer = "return=representation", Dictionary <string, List <string> > customHeaders = null)
 {
     return(operations.CreateWithHttpMessagesAsync(body, prefer, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult());
 }
コード例 #21
0
ファイル: DynamicsUtils.cs プロジェクト: bcgov/jag-spd-spice
        public void CreateAssociate(string clientEntityUri, string accountEntityUri, string screeningId, LegalEntity associateEntity, bool isMarketer)
        {
            if (associateEntity.IsIndividual)
            {
                MicrosoftDynamicsCRMcontact associate = CreateOrUpdateContact(
                    associateEntity.Contact.ContactId,
                    associateEntity.Contact.FirstName,
                    associateEntity.Contact.MiddleName,
                    associateEntity.Contact.LastName,
                    GetGenderCode(associateEntity.Contact.Gender),
                    associateEntity.Contact.Email,
                    associateEntity.Contact.PhoneNumber,
                    associateEntity.Contact.DriversLicenceNumber,
                    associateEntity.Contact.DriverLicenceJurisdiction,
                    associateEntity.Contact.BCIdCardNumber,
                    associateEntity.Contact.BirthDate?.UtcDateTime,
                    associateEntity.Contact.Birthplace,
                    associateEntity.Contact.SelfDisclosure == GeneralYesNo.Yes,
                    associateEntity.Contact.Address?.AddressStreet1,
                    associateEntity.Contact.Address?.AddressStreet2,
                    associateEntity.Contact.Address?.AddressStreet3,
                    associateEntity.Contact.Address?.City,
                    associateEntity.Contact.Address?.Postal,
                    associateEntity.Contact.Address?.StateProvince,
                    associateEntity.Contact.Address?.Country,
                    associateEntity.PreviousAddresses != null ? associateEntity.PreviousAddresses : new List <Address>(),
                    associateEntity.Aliases != null ? associateEntity.Aliases : new List <Alias>(),
                    associateEntity.Title
                    );

                try
                {
                    MicrosoftDynamicsCRMspiceAccountcaseassignment accountContact = _dynamicsClient.Accountcaseassignments.Create(new MicrosoftDynamicsCRMspiceAccountcaseassignment()
                    {
                        SpiceName = associateEntity.Contact.FirstName,
                        SpiceBusinessIdODataBind = accountEntityUri,
                        SpiceContactCaseAssignmentIdODataBind = _dynamicsClient.GetEntityURI("contacts", associate.Contactid),
                        SpicePosition = GetLegalEntityPositions(associateEntity.Positions)
                    });
                }
                catch (OdataerrorException e)
                {
                    _logger.LogError(e, "Failed to create new account case assignment");
                    _logger.LogError(e.Request.Content);
                    _logger.LogError(e.Response.Content);
                    return;
                }

                string servicesFilter = isMarketer ? "spice_name eq 'Marketing Associate - Initial Check'" : "spice_name eq 'Cannabis Associate'";
                var    service        = _dynamicsClient.Serviceses.Get(filter: servicesFilter).Value[0];

                MicrosoftDynamicsCRMincident incident = new MicrosoftDynamicsCRMincident()
                {
                    SpiceApplicanttype         = (int)SpiceApplicantType.Cannabis,
                    SpiceCannabisapplicanttype = isMarketer ? (int)CannabisApplicantType.MarketingAssociate : (int)CannabisApplicantType.Associate,
                    CustomerIdODataBind        = _dynamicsClient.GetEntityURI("contacts", associate.Contactid),
                    ParentCaseIdOdataBind      = _dynamicsClient.GetEntityURI("incidents", screeningId),
                    SpiceServiceIdODataBind    = _dynamicsClient.GetEntityURI("spice_serviceses", service.SpiceServicesid),
                    SpiceClientIdODataBind     = clientEntityUri,
                    SpiceConsentformReceived   = true,
                    SpicePrimeCheckrequired    = !isMarketer
                };
                try
                {
                    // Create the associate incident
                    MicrosoftDynamicsCRMincident createdIncident = _dynamicsClient.Incidents.Create(incident);
                }
                catch (OdataerrorException e)
                {
                    _logger.LogError(e, "Failed to create new incident");
                    _logger.LogError(e.Request.Content);
                    _logger.LogError(e.Response.Content);
                    return;
                }
            }
            else
            {
                foreach (var associate in associateEntity.Account.Associates)
                {
                    CreateAssociate(clientEntityUri, accountEntityUri, screeningId, associate, isMarketer);
                }
            }
        }
コード例 #22
0
 /// <summary>
 /// Update entity in contacts
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='contactid'>
 /// key: contactid of contact
 /// </param>
 /// <param name='body'>
 /// New property values
 /// </param>
 /// <param name='customHeaders'>
 /// Headers that will be added to request.
 /// </param>
 public static HttpOperationResponse UpdateWithHttpMessages(this IContacts operations, string contactid, MicrosoftDynamicsCRMcontact body, Dictionary <string, List <string> > customHeaders = null)
 {
     return(operations.UpdateWithHttpMessagesAsync(contactid, body, customHeaders, CancellationToken.None).ConfigureAwait(false).GetAwaiter().GetResult());
 }
コード例 #23
0
 /// <summary>
 /// Initializes a new instance of the
 /// MicrosoftDynamicsCRMcsuPhonehistory class.
 /// </summary>
 public MicrosoftDynamicsCRMcsuPhonehistory(string _modifiedbyValue = default(string), int?timezoneruleversionnumber = default(int?), string _owningbusinessunitValue = default(string), string _csuPersondetailidValue = default(string), int?importsequencenumber = default(int?), int?statecode = default(int?), string _createdbyValue = default(string), int?statuscode = default(int?), string csuPhonehistoryid = default(string), bool?csuCurrent = default(bool?), string _owningteamValue = default(string), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), string csuNumber = default(string), string _owneridValue = default(string), string versionnumber = default(string), int?utcconversiontimezonecode = default(int?), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), string _owninguserValue = default(string), string _createdonbehalfbyValue = default(string), System.DateTimeOffset?csuUsedfromdate = default(System.DateTimeOffset?), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), int?csuPhonetype = default(int?), System.DateTimeOffset?csuUsedtodate = default(System.DateTimeOffset?), string csuName = default(string), string _modifiedonbehalfbyValue = default(string), MicrosoftDynamicsCRMsystemuser createdby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser owninguser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteam = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMprincipal ownerid = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMbusinessunit owningbusinessunit = default(MicrosoftDynamicsCRMbusinessunit), IList <MicrosoftDynamicsCRMsyncerror> csuPhonehistorySyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMduplicaterecord> csuPhonehistoryDuplicateMatchingRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMduplicaterecord> csuPhonehistoryDuplicateBaseRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMasyncoperation> csuPhonehistoryAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMmailboxtrackingfolder> csuPhonehistoryMailboxTrackingFolders = default(IList <MicrosoftDynamicsCRMmailboxtrackingfolder>), IList <MicrosoftDynamicsCRMprocesssession> csuPhonehistoryProcessSession = default(IList <MicrosoftDynamicsCRMprocesssession>), IList <MicrosoftDynamicsCRMbulkdeletefailure> csuPhonehistoryBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> csuPhonehistoryPrincipalObjectAttributeAccesses = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), MicrosoftDynamicsCRMcontact csuPersonDetailId = default(MicrosoftDynamicsCRMcontact))
 {
     this._modifiedbyValue         = _modifiedbyValue;
     Timezoneruleversionnumber     = timezoneruleversionnumber;
     this._owningbusinessunitValue = _owningbusinessunitValue;
     this._csuPersondetailidValue  = _csuPersondetailidValue;
     Importsequencenumber          = importsequencenumber;
     Statecode                    = statecode;
     this._createdbyValue         = _createdbyValue;
     Statuscode                   = statuscode;
     CsuPhonehistoryid            = csuPhonehistoryid;
     CsuCurrent                   = csuCurrent;
     this._owningteamValue        = _owningteamValue;
     Overriddencreatedon          = overriddencreatedon;
     CsuNumber                    = csuNumber;
     this._owneridValue           = _owneridValue;
     Versionnumber                = versionnumber;
     Utcconversiontimezonecode    = utcconversiontimezonecode;
     Createdon                    = createdon;
     this._owninguserValue        = _owninguserValue;
     this._createdonbehalfbyValue = _createdonbehalfbyValue;
     CsuUsedfromdate              = csuUsedfromdate;
     Modifiedon                   = modifiedon;
     CsuPhonetype                 = csuPhonetype;
     CsuUsedtodate                = csuUsedtodate;
     CsuName = csuName;
     this._modifiedonbehalfbyValue = _modifiedonbehalfbyValue;
     Createdby                 = createdby;
     Createdonbehalfby         = createdonbehalfby;
     Modifiedby                = modifiedby;
     Modifiedonbehalfby        = modifiedonbehalfby;
     Owninguser                = owninguser;
     Owningteam                = owningteam;
     Ownerid                   = ownerid;
     Owningbusinessunit        = owningbusinessunit;
     CsuPhonehistorySyncErrors = csuPhonehistorySyncErrors;
     CsuPhonehistoryDuplicateMatchingRecord          = csuPhonehistoryDuplicateMatchingRecord;
     CsuPhonehistoryDuplicateBaseRecord              = csuPhonehistoryDuplicateBaseRecord;
     CsuPhonehistoryAsyncOperations                  = csuPhonehistoryAsyncOperations;
     CsuPhonehistoryMailboxTrackingFolders           = csuPhonehistoryMailboxTrackingFolders;
     CsuPhonehistoryProcessSession                   = csuPhonehistoryProcessSession;
     CsuPhonehistoryBulkDeleteFailures               = csuPhonehistoryBulkDeleteFailures;
     CsuPhonehistoryPrincipalObjectAttributeAccesses = csuPhonehistoryPrincipalObjectAttributeAccesses;
     CsuPersonDetailId = csuPersonDetailId;
     CustomInit();
 }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the MicrosoftDynamicsCRMappointment
 /// class.
 /// </summary>
 public MicrosoftDynamicsCRMappointment(string subscriptionid = default(string), string category = default(string), bool?isdraft = default(bool?), string location = default(string), System.DateTimeOffset?originalstartdate = default(System.DateTimeOffset?), int?outlookownerapptid = default(int?), int?isunsafe = default(int?), bool?isalldayevent = default(bool?), int?attachmenterrors = default(int?), string subcategory = default(string), int?importsequencenumber = default(int?), string modifiedfieldsmask = default(string), string globalobjectid = default(string), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), IList <MicrosoftDynamicsCRMpostregarding> appointmentPostRegardings = default(IList <MicrosoftDynamicsCRMpostregarding>), IList <MicrosoftDynamicsCRMpostfollow> appointmentPostFollows = default(IList <MicrosoftDynamicsCRMpostfollow>), MicrosoftDynamicsCRMknowledgebaserecord regardingobjectidKnowledgebaserecordAppointment = default(MicrosoftDynamicsCRMknowledgebaserecord), MicrosoftDynamicsCRMlead regardingobjectidLeadAppointment = default(MicrosoftDynamicsCRMlead), MicrosoftDynamicsCRMbookableresourcebooking regardingobjectidBookableresourcebookingAppointment = default(MicrosoftDynamicsCRMbookableresourcebooking), MicrosoftDynamicsCRMbookableresourcebookingheader regardingobjectidBookableresourcebookingheaderAppointment = default(MicrosoftDynamicsCRMbookableresourcebookingheader), MicrosoftDynamicsCRMbulkoperation regardingobjectidBulkoperationAppointment = default(MicrosoftDynamicsCRMbulkoperation), MicrosoftDynamicsCRMcampaign regardingobjectidCampaignAppointment = default(MicrosoftDynamicsCRMcampaign), MicrosoftDynamicsCRMcampaignactivity regardingobjectidCampaignactivityAppointment = default(MicrosoftDynamicsCRMcampaignactivity), IList <MicrosoftDynamicsCRMcampaignresponse> appointmentCampaignresponse = default(IList <MicrosoftDynamicsCRMcampaignresponse>), MicrosoftDynamicsCRMcontract regardingobjectidContractAppointment = default(MicrosoftDynamicsCRMcontract), MicrosoftDynamicsCRMentitlement regardingobjectidEntitlementAppointment = default(MicrosoftDynamicsCRMentitlement), MicrosoftDynamicsCRMentitlementtemplate regardingobjectidEntitlementtemplateAppointment = default(MicrosoftDynamicsCRMentitlementtemplate), MicrosoftDynamicsCRMincident regardingobjectidIncidentAppointment = default(MicrosoftDynamicsCRMincident), MicrosoftDynamicsCRMsite regardingobjectidSiteAppointment = default(MicrosoftDynamicsCRMsite), MicrosoftDynamicsCRMservice serviceidAppointment = default(MicrosoftDynamicsCRMservice), MicrosoftDynamicsCRMinvoice regardingobjectidInvoiceAppointment = default(MicrosoftDynamicsCRMinvoice), MicrosoftDynamicsCRMopportunity regardingobjectidOpportunityAppointment = default(MicrosoftDynamicsCRMopportunity), MicrosoftDynamicsCRMquote regardingobjectidQuoteAppointment = default(MicrosoftDynamicsCRMquote), MicrosoftDynamicsCRMsalesorder regardingobjectidSalesorderAppointment = default(MicrosoftDynamicsCRMsalesorder), MicrosoftDynamicsCRMmsdynPostalbum regardingobjectidMsdynPostalbumAppointment = default(MicrosoftDynamicsCRMmsdynPostalbum), MicrosoftDynamicsCRMcsuComplaints regardingobjectidCsuComplaintsAppointment = default(MicrosoftDynamicsCRMcsuComplaints), MicrosoftDynamicsCRMcsuSubjectofcomplaint regardingobjectidCsuSubjectofcomplaintAppointment = default(MicrosoftDynamicsCRMcsuSubjectofcomplaint), MicrosoftDynamicsCRMcsuVehicledetail regardingobjectidCsuVehicledetailAppointment = default(MicrosoftDynamicsCRMcsuVehicledetail), IList <MicrosoftDynamicsCRMqueueitem> appointmentQueueItem = default(IList <MicrosoftDynamicsCRMqueueitem>), IList <MicrosoftDynamicsCRMannotation> appointmentAnnotation = default(IList <MicrosoftDynamicsCRMannotation>), IList <MicrosoftDynamicsCRMsyncerror> appointmentSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), MicrosoftDynamicsCRMprocessstage stageidProcessstage = default(MicrosoftDynamicsCRMprocessstage), MicrosoftDynamicsCRMrecurringappointmentmaster seriesidRecurringappointmentmaster = default(MicrosoftDynamicsCRMrecurringappointmentmaster), MicrosoftDynamicsCRMbusinessunit owningbusinessunitAppointment = default(MicrosoftDynamicsCRMbusinessunit), IList <MicrosoftDynamicsCRMduplicaterecord> appointmentDuplicateBaseRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMactivityparty> appointmentActivityParties = default(IList <MicrosoftDynamicsCRMactivityparty>), IList <MicrosoftDynamicsCRMasyncoperation> appointmentAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), MicrosoftDynamicsCRMsystemuser modifiedonbehalfbyAppointment = default(MicrosoftDynamicsCRMsystemuser), IList <MicrosoftDynamicsCRMduplicaterecord> appointmentDuplicateMatchingRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMconnection> appointmentConnections1 = default(IList <MicrosoftDynamicsCRMconnection>), IList <MicrosoftDynamicsCRMslakpiinstance> slakpiinstanceAppointment = default(IList <MicrosoftDynamicsCRMslakpiinstance>), MicrosoftDynamicsCRMsystemuser modifiedbyAppointment = default(MicrosoftDynamicsCRMsystemuser), IList <MicrosoftDynamicsCRMactivitymimeattachment> appointmentActivityMimeAttachment = default(IList <MicrosoftDynamicsCRMactivitymimeattachment>), IList <MicrosoftDynamicsCRMbulkdeletefailure> appointmentBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> appointmentPrincipalobjectattributeaccess = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), IList <MicrosoftDynamicsCRMconnection> appointmentConnections2 = default(IList <MicrosoftDynamicsCRMconnection>), IList <MicrosoftDynamicsCRMactioncard> appointmentActioncard = default(IList <MicrosoftDynamicsCRMactioncard>), MicrosoftDynamicsCRMsla slaAppointmentSla = default(MicrosoftDynamicsCRMsla), IList <MicrosoftDynamicsCRMprocesssession> appointmentProcessSessions = default(IList <MicrosoftDynamicsCRMprocesssession>), MicrosoftDynamicsCRMcontact regardingobjectidContactAppointment = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMsystemuser createdonbehalfbyAppointment = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMknowledgearticle regardingobjectidKnowledgearticleAppointment = default(MicrosoftDynamicsCRMknowledgearticle), MicrosoftDynamicsCRMaccount regardingobjectidAccountAppointment = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMactivitypointer activityidActivitypointer = default(MicrosoftDynamicsCRMactivitypointer), MicrosoftDynamicsCRMtransactioncurrency transactioncurrencyidAppointment = default(MicrosoftDynamicsCRMtransactioncurrency), MicrosoftDynamicsCRMsla slainvokedidAppointmentSla = default(MicrosoftDynamicsCRMsla), MicrosoftDynamicsCRMsystemuser createdbyAppointment = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteamAppointment = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMsystemuser owninguserAppointment = default(MicrosoftDynamicsCRMsystemuser))
 {
     Subscriptionid            = subscriptionid;
     Category                  = category;
     Isdraft                   = isdraft;
     Location                  = location;
     Originalstartdate         = originalstartdate;
     Outlookownerapptid        = outlookownerapptid;
     Isunsafe                  = isunsafe;
     Isalldayevent             = isalldayevent;
     Attachmenterrors          = attachmenterrors;
     Subcategory               = subcategory;
     Importsequencenumber      = importsequencenumber;
     Modifiedfieldsmask        = modifiedfieldsmask;
     Globalobjectid            = globalobjectid;
     Overriddencreatedon       = overriddencreatedon;
     AppointmentPostRegardings = appointmentPostRegardings;
     AppointmentPostFollows    = appointmentPostFollows;
     RegardingobjectidKnowledgebaserecordAppointment = regardingobjectidKnowledgebaserecordAppointment;
     RegardingobjectidLeadAppointment = regardingobjectidLeadAppointment;
     RegardingobjectidBookableresourcebookingAppointment       = regardingobjectidBookableresourcebookingAppointment;
     RegardingobjectidBookableresourcebookingheaderAppointment = regardingobjectidBookableresourcebookingheaderAppointment;
     RegardingobjectidBulkoperationAppointment    = regardingobjectidBulkoperationAppointment;
     RegardingobjectidCampaignAppointment         = regardingobjectidCampaignAppointment;
     RegardingobjectidCampaignactivityAppointment = regardingobjectidCampaignactivityAppointment;
     AppointmentCampaignresponse                     = appointmentCampaignresponse;
     RegardingobjectidContractAppointment            = regardingobjectidContractAppointment;
     RegardingobjectidEntitlementAppointment         = regardingobjectidEntitlementAppointment;
     RegardingobjectidEntitlementtemplateAppointment = regardingobjectidEntitlementtemplateAppointment;
     RegardingobjectidIncidentAppointment            = regardingobjectidIncidentAppointment;
     RegardingobjectidSiteAppointment                = regardingobjectidSiteAppointment;
     ServiceidAppointment = serviceidAppointment;
     RegardingobjectidInvoiceAppointment               = regardingobjectidInvoiceAppointment;
     RegardingobjectidOpportunityAppointment           = regardingobjectidOpportunityAppointment;
     RegardingobjectidQuoteAppointment                 = regardingobjectidQuoteAppointment;
     RegardingobjectidSalesorderAppointment            = regardingobjectidSalesorderAppointment;
     RegardingobjectidMsdynPostalbumAppointment        = regardingobjectidMsdynPostalbumAppointment;
     RegardingobjectidCsuComplaintsAppointment         = regardingobjectidCsuComplaintsAppointment;
     RegardingobjectidCsuSubjectofcomplaintAppointment = regardingobjectidCsuSubjectofcomplaintAppointment;
     RegardingobjectidCsuVehicledetailAppointment      = regardingobjectidCsuVehicledetailAppointment;
     AppointmentQueueItem  = appointmentQueueItem;
     AppointmentAnnotation = appointmentAnnotation;
     AppointmentSyncErrors = appointmentSyncErrors;
     StageidProcessstage   = stageidProcessstage;
     SeriesidRecurringappointmentmaster = seriesidRecurringappointmentmaster;
     OwningbusinessunitAppointment      = owningbusinessunitAppointment;
     AppointmentDuplicateBaseRecord     = appointmentDuplicateBaseRecord;
     AppointmentActivityParties         = appointmentActivityParties;
     AppointmentAsyncOperations         = appointmentAsyncOperations;
     ModifiedonbehalfbyAppointment      = modifiedonbehalfbyAppointment;
     AppointmentDuplicateMatchingRecord = appointmentDuplicateMatchingRecord;
     AppointmentConnections1            = appointmentConnections1;
     SlakpiinstanceAppointment          = slakpiinstanceAppointment;
     ModifiedbyAppointment                     = modifiedbyAppointment;
     AppointmentActivityMimeAttachment         = appointmentActivityMimeAttachment;
     AppointmentBulkDeleteFailures             = appointmentBulkDeleteFailures;
     AppointmentPrincipalobjectattributeaccess = appointmentPrincipalobjectattributeaccess;
     AppointmentConnections2                   = appointmentConnections2;
     AppointmentActioncard                     = appointmentActioncard;
     SlaAppointmentSla                            = slaAppointmentSla;
     AppointmentProcessSessions                   = appointmentProcessSessions;
     RegardingobjectidContactAppointment          = regardingobjectidContactAppointment;
     CreatedonbehalfbyAppointment                 = createdonbehalfbyAppointment;
     RegardingobjectidKnowledgearticleAppointment = regardingobjectidKnowledgearticleAppointment;
     RegardingobjectidAccountAppointment          = regardingobjectidAccountAppointment;
     ActivityidActivitypointer                    = activityidActivitypointer;
     TransactioncurrencyidAppointment             = transactioncurrencyidAppointment;
     SlainvokedidAppointmentSla                   = slainvokedidAppointmentSla;
     CreatedbyAppointment                         = createdbyAppointment;
     OwningteamAppointment                        = owningteamAppointment;
     OwninguserAppointment                        = owninguserAppointment;
     CustomInit();
 }
コード例 #25
0
        /// <summary>
        /// Load User from database using their userId and guid
        /// </summary>
        /// <param name="context"></param>
        /// <param name="userId"></param>
        /// <param name="guid"></param>
        /// <returns></returns>
        public static async Task <User> LoadUser(this IDynamicsClient _dynamicsClient, string userId, IHeaderDictionary Headers, ILogger _logger, string guid = null)
        {
            User user = null;
            MicrosoftDynamicsCRMcontact contact = null;
            Guid userGuid;

            if (!string.IsNullOrEmpty(guid))
            {
                user = await _dynamicsClient.GetUserByGuid(guid);
            }

            if (user == null)
            {
                _logger.LogInformation(">>>> LoadUser for BCEID.");
                if (Guid.TryParse(userId, out userGuid))
                {
                    user = _dynamicsClient.GetUserBySmUserId(userId);
                    if (user != null)
                    {
                        _logger.LogInformation(">>>> LoadUser for BCEID: user != null");
                        // Update the contact with info from Siteminder
                        var contactVM = new Public.ViewModels.Contact();
                        contactVM.CopyHeaderValues(Headers);
                        _logger.LogInformation(">>>> After reading headers: " + Newtonsoft.Json.JsonConvert.SerializeObject(contactVM));
                        MicrosoftDynamicsCRMcontact patchContact = new MicrosoftDynamicsCRMcontact();
                        patchContact.CopyValues(contactVM);
                        try
                        {
                            _dynamicsClient.Contacts.Update(user.ContactId.ToString(), patchContact);
                        }
                        catch (OdataerrorException odee)
                        {
                            _logger.LogError("Error updating Contact");
                            _logger.LogError("Request:");
                            _logger.LogError(odee.Request.Content);
                            _logger.LogError("Response:");
                            _logger.LogError(odee.Response.Content);
                            // fail if we can't create.
                            throw (odee);
                        }
                    }
                }
                else
                { //BC service card login
                    _logger.LogInformation(">>>> LoadUser for BC Services Card.");
                    string externalId = GetServiceCardID(userId);
                    contact = _dynamicsClient.GetContactByExternalId(externalId);

                    if (contact != null)
                    {
                        _logger.LogInformation(">>>> LoadUser for BC Services Card: contact != null");

                        /*
                         * user = new User();
                         * user.FromContact(contact);
                         *
                         * // Update the contact and worker with info from Siteminder
                         * var contactVM = new Public.ViewModels.Contact();
                         * var workerVm = new Public.ViewModels.Worker();
                         * contactVM.CopyHeaderValues(Headers);
                         * workerVm.CopyHeaderValues(Headers);
                         * MicrosoftDynamicsCRMcontact patchContact = new MicrosoftDynamicsCRMcontact();
                         * MicrosoftDynamicsCRMadoxioWorker patchWorker = new MicrosoftDynamicsCRMadoxioWorker();
                         * patchContact.CopyValues(contactVM);
                         * patchWorker.CopyValues(workerVm);
                         * try
                         * {
                         *  string filter = $"_adoxio_contactid_value eq {contact.Contactid}";
                         *  var workers = _dynamicsClient.Workers.Get(filter: filter).Value;
                         *  foreach (var item in workers)
                         *  {
                         *      _dynamicsClient.Workers.Update(item.AdoxioWorkerid, patchWorker);
                         *
                         *  }
                         *  _dynamicsClient.Contacts.Update(user.ContactId.ToString(), patchContact);
                         * }
                         * catch (OdataerrorException odee)
                         * {
                         *  _logger.LogError("Error updating Contact");
                         *  _logger.LogError("Request:");
                         *  _logger.LogError(odee.Request.Content);
                         *  _logger.LogError("Response:");
                         *  _logger.LogError(odee.Response.Content);
                         *  // fail if we can't create.
                         *  throw (odee);
                         * }
                         */
                    }
                }
            }

            if (user == null)
            {
                return(null);
            }

            if (guid == null)
            {
                return(user);
            }


            if (!user.ContactId.ToString().Equals(guid, StringComparison.OrdinalIgnoreCase))
            {
                // invalid account - guid doesn't match user credential
                return(null);
            }

            return(user);
        }
コード例 #26
0
 /// <summary>
 /// Add new entity to contacts
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// New entity
 /// </param>
 /// <param name='prefer'>
 /// Required in order for the service to return a JSON representation of the
 /// object.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <MicrosoftDynamicsCRMcontact> CreateAsync(this IContacts operations, MicrosoftDynamicsCRMcontact body, string prefer = "return=representation", CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateWithHttpMessagesAsync(body, prefer, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
コード例 #27
0
        /// <summary>
        /// Update entity in contacts
        /// </summary>
        /// <param name='contactid'>
        /// key: contactid
        /// </param>
        /// <param name='body'>
        /// New property values
        /// </param>
        /// <param name='customHeaders'>
        /// Headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="OdataerrorException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when a required parameter is null
        /// </exception>
        /// <return>
        /// A response object containing the response body and response headers.
        /// </return>
        public async Task <HttpOperationResponse> UpdateWithHttpMessagesAsync(string contactid, MicrosoftDynamicsCRMcontact body, Dictionary <string, List <string> > customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (contactid == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "contactid");
            }
            if (body == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "body");
            }
            // Tracing
            bool   _shouldTrace  = ServiceClientTracing.IsEnabled;
            string _invocationId = null;

            if (_shouldTrace)
            {
                _invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary <string, object> tracingParameters = new Dictionary <string, object>();
                tracingParameters.Add("contactid", contactid);
                tracingParameters.Add("body", body);
                tracingParameters.Add("cancellationToken", cancellationToken);
                ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
            }
            // Construct URL
            var _baseUrl = Client.BaseUri.AbsoluteUri;
            var _url     = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "contacts({contactid})").ToString();

            _url = _url.Replace("{contactid}", System.Uri.EscapeDataString(contactid));
            // Create HTTP transport objects
            var _httpRequest = new HttpRequestMessage();
            HttpResponseMessage _httpResponse = null;

            _httpRequest.Method     = new HttpMethod("PATCH");
            _httpRequest.RequestUri = new System.Uri(_url);
            // Set Headers


            if (customHeaders != null)
            {
                foreach (var _header in customHeaders)
                {
                    if (_httpRequest.Headers.Contains(_header.Key))
                    {
                        _httpRequest.Headers.Remove(_header.Key);
                    }
                    _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
                }
            }

            // Serialize Request
            string _requestContent = null;

            if (body != null)
            {
                _requestContent      = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
                _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
                _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
            }
            // Set Credentials
            if (Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
            }
            // Send Request
            if (_shouldTrace)
            {
                ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);

            if (_shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
            }
            HttpStatusCode _statusCode = _httpResponse.StatusCode;

            cancellationToken.ThrowIfCancellationRequested();
            string _responseContent = null;

            if ((int)_statusCode != 204)
            {
                var ex = new OdataerrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
                try
                {
                    _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                    Odataerror _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject <Odataerror>(_responseContent, Client.DeserializationSettings);
                    if (_errorBody != null)
                    {
                        ex.Body = _errorBody;
                    }
                }
                catch (JsonException)
                {
                    // Ignore the exception
                }
                ex.Request  = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
                ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
                if (_shouldTrace)
                {
                    ServiceClientTracing.Error(_invocationId, ex);
                }
                _httpRequest.Dispose();
                if (_httpResponse != null)
                {
                    _httpResponse.Dispose();
                }
                throw ex;
            }
            // Create Result
            var _result = new HttpOperationResponse();

            _result.Request  = _httpRequest;
            _result.Response = _httpResponse;
            if (_shouldTrace)
            {
                ServiceClientTracing.Exit(_invocationId, _result);
            }
            return(_result);
        }
コード例 #28
0
 /// <summary>
 /// Update entity in contacts
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='contactid'>
 /// key: contactid
 /// </param>
 /// <param name='body'>
 /// New property values
 /// </param>
 public static void Update(this IContacts operations, string contactid, MicrosoftDynamicsCRMcontact body)
 {
     operations.UpdateAsync(contactid, body).GetAwaiter().GetResult();
 }
コード例 #29
0
 /// <summary>
 /// Initializes a new instance of the
 /// MicrosoftDynamicsCRMbulkoperationlog class.
 /// </summary>
 public MicrosoftDynamicsCRMbulkoperationlog(string _owneridValue = default(string), string additionalinfo = default(string), string _createdobjectidValue = default(string), int?utcconversiontimezonecode = default(int?), string _owninguserValue = default(string), string bulkoperationlogid = default(string), int?errornumber = default(int?), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), string _owningbusinessunitValue = default(string), string _regardingobjectidValue = default(string), string _owningteamValue = default(string), string _bulkoperationidValue = default(string), string versionnumber = default(string), string name = default(string), int?importsequencenumber = default(int?), int?timezoneruleversionnumber = default(int?), MicrosoftDynamicsCRMsystemuser owninguser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteam = default(MicrosoftDynamicsCRMteam), IList <MicrosoftDynamicsCRMsyncerror> bulkoperationlogSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMasyncoperation> bulkOperationLogAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMmailboxtrackingfolder> bulkoperationlogMailboxTrackingFolders = default(IList <MicrosoftDynamicsCRMmailboxtrackingfolder>), IList <MicrosoftDynamicsCRMbulkdeletefailure> bulkOperationLogBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> bulkoperationlogPrincipalObjectAttributeAccesses = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), MicrosoftDynamicsCRMaccount createdobjectidAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMaccount regardingobjectidAccount = default(MicrosoftDynamicsCRMaccount), MicrosoftDynamicsCRMactivitypointer bulkoperationidActivitypointer = default(MicrosoftDynamicsCRMactivitypointer), MicrosoftDynamicsCRMactivitypointer createdobjectidActivitypointer = default(MicrosoftDynamicsCRMactivitypointer), MicrosoftDynamicsCRMbulkoperation bulkoperationid = default(MicrosoftDynamicsCRMbulkoperation), MicrosoftDynamicsCRMcontact createdobjectidContact = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMcontact regardingobjectidContact = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMlead createdobjectidLead = default(MicrosoftDynamicsCRMlead), MicrosoftDynamicsCRMlead regardingobjectidLead = default(MicrosoftDynamicsCRMlead), MicrosoftDynamicsCRMopportunity createdobjectidOpportunity = default(MicrosoftDynamicsCRMopportunity))
 {
     this._owneridValue         = _owneridValue;
     Additionalinfo             = additionalinfo;
     this._createdobjectidValue = _createdobjectidValue;
     Utcconversiontimezonecode  = utcconversiontimezonecode;
     this._owninguserValue      = _owninguserValue;
     Bulkoperationlogid         = bulkoperationlogid;
     Errornumber                   = errornumber;
     Overriddencreatedon           = overriddencreatedon;
     this._owningbusinessunitValue = _owningbusinessunitValue;
     this._regardingobjectidValue  = _regardingobjectidValue;
     this._owningteamValue         = _owningteamValue;
     this._bulkoperationidValue    = _bulkoperationidValue;
     Versionnumber                 = versionnumber;
     Name = name;
     Importsequencenumber      = importsequencenumber;
     Timezoneruleversionnumber = timezoneruleversionnumber;
     Owninguser = owninguser;
     Owningteam = owningteam;
     BulkoperationlogSyncErrors                       = bulkoperationlogSyncErrors;
     BulkOperationLogAsyncOperations                  = bulkOperationLogAsyncOperations;
     BulkoperationlogMailboxTrackingFolders           = bulkoperationlogMailboxTrackingFolders;
     BulkOperationLogBulkDeleteFailures               = bulkOperationLogBulkDeleteFailures;
     BulkoperationlogPrincipalObjectAttributeAccesses = bulkoperationlogPrincipalObjectAttributeAccesses;
     CreatedobjectidAccount         = createdobjectidAccount;
     RegardingobjectidAccount       = regardingobjectidAccount;
     BulkoperationidActivitypointer = bulkoperationidActivitypointer;
     CreatedobjectidActivitypointer = createdobjectidActivitypointer;
     Bulkoperationid            = bulkoperationid;
     CreatedobjectidContact     = createdobjectidContact;
     RegardingobjectidContact   = regardingobjectidContact;
     CreatedobjectidLead        = createdobjectidLead;
     RegardingobjectidLead      = regardingobjectidLead;
     CreatedobjectidOpportunity = createdobjectidOpportunity;
     CustomInit();
 }
コード例 #30
0
 /// <summary>
 /// Initializes a new instance of the
 /// MicrosoftDynamicsCRMcsuVehicledetail class.
 /// </summary>
 public MicrosoftDynamicsCRMcsuVehicledetail(string versionnumber = default(string), int?statecode = default(int?), System.DateTimeOffset?createdon = default(System.DateTimeOffset?), string emailaddress = default(string), string _owningteamValue = default(string), string _csuRegisteredownerValue = default(string), string _owneridValue = default(string), int?utcconversiontimezonecode = default(int?), int?importsequencenumber = default(int?), int?statuscode = default(int?), string _createdonbehalfbyValue = default(string), string csuVehicledetailid = default(string), string _owningbusinessunitValue = default(string), int?timezoneruleversionnumber = default(int?), string csuName = default(string), string _modifiedonbehalfbyValue = default(string), string csuColor = default(string), string _modifiedbyValue = default(string), string _createdbyValue = default(string), string csuModel = default(string), System.DateTimeOffset?modifiedon = default(System.DateTimeOffset?), System.DateTimeOffset?overriddencreatedon = default(System.DateTimeOffset?), string csuMake = default(string), string _owninguserValue = default(string), string _csuRelatedlocationbusinessValue = default(string), MicrosoftDynamicsCRMsystemuser createdby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser createdonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser modifiedonbehalfby = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMsystemuser owninguser = default(MicrosoftDynamicsCRMsystemuser), MicrosoftDynamicsCRMteam owningteam = default(MicrosoftDynamicsCRMteam), MicrosoftDynamicsCRMprincipal ownerid = default(MicrosoftDynamicsCRMprincipal), MicrosoftDynamicsCRMbusinessunit owningbusinessunit = default(MicrosoftDynamicsCRMbusinessunit), IList <MicrosoftDynamicsCRMsyncerror> csuVehicledetailSyncErrors = default(IList <MicrosoftDynamicsCRMsyncerror>), IList <MicrosoftDynamicsCRMduplicaterecord> csuVehicledetailDuplicateMatchingRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMduplicaterecord> csuVehicledetailDuplicateBaseRecord = default(IList <MicrosoftDynamicsCRMduplicaterecord>), IList <MicrosoftDynamicsCRMasyncoperation> csuVehicledetailAsyncOperations = default(IList <MicrosoftDynamicsCRMasyncoperation>), IList <MicrosoftDynamicsCRMmailboxtrackingfolder> csuVehicledetailMailboxTrackingFolders = default(IList <MicrosoftDynamicsCRMmailboxtrackingfolder>), IList <MicrosoftDynamicsCRMprocesssession> csuVehicledetailProcessSession = default(IList <MicrosoftDynamicsCRMprocesssession>), IList <MicrosoftDynamicsCRMbulkdeletefailure> csuVehicledetailBulkDeleteFailures = default(IList <MicrosoftDynamicsCRMbulkdeletefailure>), IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess> csuVehicledetailPrincipalObjectAttributeAccesses = default(IList <MicrosoftDynamicsCRMprincipalobjectattributeaccess>), MicrosoftDynamicsCRMcontact csuRegisteredOwner = default(MicrosoftDynamicsCRMcontact), MicrosoftDynamicsCRMaccount csuRelatedLocationBusiness = default(MicrosoftDynamicsCRMaccount), IList <MicrosoftDynamicsCRMannotation> csuVehicledetailAnnotations = default(IList <MicrosoftDynamicsCRMannotation>), IList <MicrosoftDynamicsCRMactivityparty> csuVehicledetailActivityParties = default(IList <MicrosoftDynamicsCRMactivityparty>), IList <MicrosoftDynamicsCRMactivitypointer> csuVehicledetailActivityPointers = default(IList <MicrosoftDynamicsCRMactivitypointer>), IList <MicrosoftDynamicsCRMcsuCasetask> csuVehicledetailCsuCasetasks = default(IList <MicrosoftDynamicsCRMcsuCasetask>), IList <MicrosoftDynamicsCRMconnection> csuVehicledetailConnections1 = default(IList <MicrosoftDynamicsCRMconnection>), IList <MicrosoftDynamicsCRMconnection> csuVehicledetailConnections2 = default(IList <MicrosoftDynamicsCRMconnection>), IList <MicrosoftDynamicsCRMappointment> csuVehicledetailAppointments = default(IList <MicrosoftDynamicsCRMappointment>), IList <MicrosoftDynamicsCRMemail> csuVehicledetailEmails = default(IList <MicrosoftDynamicsCRMemail>), IList <MicrosoftDynamicsCRMfax> csuVehicledetailFaxes = default(IList <MicrosoftDynamicsCRMfax>), IList <MicrosoftDynamicsCRMletter> csuVehicledetailLetters = default(IList <MicrosoftDynamicsCRMletter>), IList <MicrosoftDynamicsCRMphonecall> csuVehicledetailPhoneCalls = default(IList <MicrosoftDynamicsCRMphonecall>), IList <MicrosoftDynamicsCRMtask> csuVehicledetailTasks = default(IList <MicrosoftDynamicsCRMtask>), IList <MicrosoftDynamicsCRMrecurringappointmentmaster> csuVehicledetailRecurringAppointmentMasters = default(IList <MicrosoftDynamicsCRMrecurringappointmentmaster>), IList <MicrosoftDynamicsCRMsocialactivity> csuVehicledetailSocialActivities = default(IList <MicrosoftDynamicsCRMsocialactivity>), IList <MicrosoftDynamicsCRMserviceappointment> csuVehicledetailServiceAppointments = default(IList <MicrosoftDynamicsCRMserviceappointment>), IList <MicrosoftDynamicsCRMfeedback> csuVehicledetailFeedback = default(IList <MicrosoftDynamicsCRMfeedback>), IList <MicrosoftDynamicsCRMcsuCasevehicledetail> csuCsuVehicledetailCsuCasevehicledetailVehicleLicensePlate = default(IList <MicrosoftDynamicsCRMcsuCasevehicledetail>), IList <MicrosoftDynamicsCRMpostregarding> csuVehicledetailPostRegardings = default(IList <MicrosoftDynamicsCRMpostregarding>), IList <MicrosoftDynamicsCRMpostfollow> csuVehicledetailPostFollows = default(IList <MicrosoftDynamicsCRMpostfollow>))
 {
     Versionnumber                 = versionnumber;
     Statecode                     = statecode;
     Createdon                     = createdon;
     Emailaddress                  = emailaddress;
     this._owningteamValue         = _owningteamValue;
     this._csuRegisteredownerValue = _csuRegisteredownerValue;
     this._owneridValue            = _owneridValue;
     Utcconversiontimezonecode     = utcconversiontimezonecode;
     Importsequencenumber          = importsequencenumber;
     Statuscode                    = statuscode;
     this._createdonbehalfbyValue  = _createdonbehalfbyValue;
     CsuVehicledetailid            = csuVehicledetailid;
     this._owningbusinessunitValue = _owningbusinessunitValue;
     Timezoneruleversionnumber     = timezoneruleversionnumber;
     CsuName = csuName;
     this._modifiedonbehalfbyValue = _modifiedonbehalfbyValue;
     CsuColor = csuColor;
     this._modifiedbyValue = _modifiedbyValue;
     this._createdbyValue  = _createdbyValue;
     CsuModel              = csuModel;
     Modifiedon            = modifiedon;
     Overriddencreatedon   = overriddencreatedon;
     CsuMake               = csuMake;
     this._owninguserValue = _owninguserValue;
     this._csuRelatedlocationbusinessValue = _csuRelatedlocationbusinessValue;
     Createdby                  = createdby;
     Createdonbehalfby          = createdonbehalfby;
     Modifiedby                 = modifiedby;
     Modifiedonbehalfby         = modifiedonbehalfby;
     Owninguser                 = owninguser;
     Owningteam                 = owningteam;
     Ownerid                    = ownerid;
     Owningbusinessunit         = owningbusinessunit;
     CsuVehicledetailSyncErrors = csuVehicledetailSyncErrors;
     CsuVehicledetailDuplicateMatchingRecord          = csuVehicledetailDuplicateMatchingRecord;
     CsuVehicledetailDuplicateBaseRecord              = csuVehicledetailDuplicateBaseRecord;
     CsuVehicledetailAsyncOperations                  = csuVehicledetailAsyncOperations;
     CsuVehicledetailMailboxTrackingFolders           = csuVehicledetailMailboxTrackingFolders;
     CsuVehicledetailProcessSession                   = csuVehicledetailProcessSession;
     CsuVehicledetailBulkDeleteFailures               = csuVehicledetailBulkDeleteFailures;
     CsuVehicledetailPrincipalObjectAttributeAccesses = csuVehicledetailPrincipalObjectAttributeAccesses;
     CsuRegisteredOwner                          = csuRegisteredOwner;
     CsuRelatedLocationBusiness                  = csuRelatedLocationBusiness;
     CsuVehicledetailAnnotations                 = csuVehicledetailAnnotations;
     CsuVehicledetailActivityParties             = csuVehicledetailActivityParties;
     CsuVehicledetailActivityPointers            = csuVehicledetailActivityPointers;
     CsuVehicledetailCsuCasetasks                = csuVehicledetailCsuCasetasks;
     CsuVehicledetailConnections1                = csuVehicledetailConnections1;
     CsuVehicledetailConnections2                = csuVehicledetailConnections2;
     CsuVehicledetailAppointments                = csuVehicledetailAppointments;
     CsuVehicledetailEmails                      = csuVehicledetailEmails;
     CsuVehicledetailFaxes                       = csuVehicledetailFaxes;
     CsuVehicledetailLetters                     = csuVehicledetailLetters;
     CsuVehicledetailPhoneCalls                  = csuVehicledetailPhoneCalls;
     CsuVehicledetailTasks                       = csuVehicledetailTasks;
     CsuVehicledetailRecurringAppointmentMasters = csuVehicledetailRecurringAppointmentMasters;
     CsuVehicledetailSocialActivities            = csuVehicledetailSocialActivities;
     CsuVehicledetailServiceAppointments         = csuVehicledetailServiceAppointments;
     CsuVehicledetailFeedback                    = csuVehicledetailFeedback;
     CsuCsuVehicledetailCsuCasevehicledetailVehicleLicensePlate = csuCsuVehicledetailCsuCasevehicledetailVehicleLicensePlate;
     CsuVehicledetailPostRegardings = csuVehicledetailPostRegardings;
     CsuVehicledetailPostFollows    = csuVehicledetailPostFollows;
     CustomInit();
 }