Esempio n. 1
0
        public static AdoxioLicense ToViewModel(this MicrosoftDynamicsCRMadoxioLicences dynamicsLicense, IDynamicsClient dynamicsClient)
        {
            AdoxioLicense adoxioLicenseVM = new AdoxioLicense();

            adoxioLicenseVM.id = dynamicsLicense.AdoxioLicencesid;

            // fetch the establishment and get name and address
            Guid?adoxioEstablishmentId = null;

            if (!string.IsNullOrEmpty(dynamicsLicense._adoxioEstablishmentValue))
            {
                adoxioEstablishmentId = Guid.Parse(dynamicsLicense._adoxioEstablishmentValue);
            }
            if (adoxioEstablishmentId != null)
            {
                var establishment = dynamicsClient.Establishments.GetByKey(adoxioEstablishmentId.ToString());
                adoxioLicenseVM.establishmentName    = establishment.AdoxioName;
                adoxioLicenseVM.establishmentAddress = establishment.AdoxioAddressstreet
                                                       + ", " + establishment.AdoxioAddresscity
                                                       + " " + establishment.AdoxioAddresspostalcode;
            }
            adoxioLicenseVM.expiryDate = dynamicsLicense.AdoxioExpirydate;

            // fetch the licence status
            int?adoxio_licenceStatusId = dynamicsLicense.Statuscode;

            if (adoxio_licenceStatusId != null)
            {
                adoxioLicenseVM.licenseStatus = dynamicsLicense.Statuscode.ToString();
            }

            // fetch the licence type
            Guid?adoxio_licencetypeId = null;

            if (!string.IsNullOrEmpty(dynamicsLicense._adoxioLicencetypeValue))
            {
                adoxio_licencetypeId = Guid.Parse(dynamicsLicense._adoxioLicencetypeValue);
            }
            if (adoxio_licencetypeId != null)
            {
                var adoxio_licencetype = dynamicsClient.AdoxioLicencetypes.GetByKey(adoxio_licencetypeId.ToString());
                if (adoxio_licencetype != null)
                {
                    adoxioLicenseVM.licenseType = adoxio_licencetype.AdoxioName;
                }
            }

            // fetch license number
            adoxioLicenseVM.licenseNumber = dynamicsLicense.AdoxioLicencenumber;

            return(adoxioLicenseVM);
        }
Esempio n. 2
0
        public List <MicrosoftDynamicsCRMadoxioLicences> ObfuscateLicences(List <MicrosoftDynamicsCRMadoxioLicences> licences)
        {
            List <MicrosoftDynamicsCRMadoxioLicences> result = new List <MicrosoftDynamicsCRMadoxioLicences>();

            foreach (var licence in licences)
            {
                var newItem = new MicrosoftDynamicsCRMadoxioLicences()
                {
                    AdoxioLicencesid    = Guid.NewGuid().ToString(),
                    AdoxioLicencenumber = licence.AdoxioLicencenumber,
                    AdoxioExpirydate    = licence.AdoxioExpirydate,
                    Statuscode          = licence.Statuscode,
                };

                if (licence._adoxioEstablishmentValue != null)
                {
                    newItem.AdoxioEstablishment = new MicrosoftDynamicsCRMadoxioEstablishment
                    {
                        AdoxioEstablishmentid = EstablishmentMap[licence._adoxioEstablishmentValue]
                    };
                }

                if (licence._adoxioLicencetypeValue != null)
                {
                    newItem.AdoxioLicenceType = new MicrosoftDynamicsCRMadoxioLicencetype
                    {
                        AdoxioLicencetypeid = licence._adoxioLicencetypeValue
                    };
                }

                if (licence._adoxioLginValue != null && LocalgovindigenousnationMap.ContainsKey(licence._adoxioLginValue))
                {
                    newItem.AdoxioLGIN = new MicrosoftDynamicsCRMadoxioLocalgovindigenousnation
                    {
                        AdoxioLocalgovindigenousnationid = LocalgovindigenousnationMap[licence._adoxioLginValue]
                    };
                }
                if (licence._adoxioLicenceeValue != null && AccountMap.ContainsKey(licence._adoxioLicenceeValue))
                {
                    newItem.AdoxioLicencee = new MicrosoftDynamicsCRMaccount
                    {
                        Accountid = AccountMap[licence._adoxioLicenceeValue]
                    };
                }
                if (!LicenceMap.ContainsKey(licence.AdoxioLicencesid))
                {
                    LicenceMap.Add(licence.AdoxioLicencesid, newItem.AdoxioLicencesid);
                }
                result.Add(newItem);
            }
            return(result);
        }
        /**
         * Mailing Address (for the licence)
         */
        private SBNCreateProgramAccountRequestBodyMailingAddress getMailingAddress(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            //mailing address for the licence
            var mailingAddress = new SBNCreateProgramAccountRequestBodyMailingAddress();

            mailingAddress.foreignLegacy     = GetForeignLegacyMailing(licence);
            mailingAddress.municipality      = licence.AdoxioEstablishment.AdoxioAddresscity;
            mailingAddress.provinceStateCode = "BC";
            mailingAddress.postalCode        = Utils.FormatPostalCode(licence.AdoxioEstablishment.AdoxioAddresspostalcode);
            mailingAddress.countryCode       = "CA";

            return(mailingAddress);
        }
        /**
         * Business Address (physical location of the store)
         */
        private SBNCreateProgramAccountRequestBodyBusinessAddress getBusinessAddress(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            //physical location of the store
            var businessAddress = new SBNCreateProgramAccountRequestBodyBusinessAddress();

            businessAddress.foreignLegacy     = GetForeignLegacyBusiness(licence);
            businessAddress.municipality      = licence.AdoxioEstablishment.AdoxioAddresscity;
            businessAddress.provinceStateCode = "BC"; // BC is province code for British Columbia
            businessAddress.postalCode        = Utils.FormatPostalCode(licence.AdoxioEstablishment.AdoxioAddresspostalcode);
            businessAddress.countryCode       = "CA"; // CA is country code for Canada

            return(businessAddress);
        }
Esempio n. 5
0
        private SBNChangeNameHeaderCCRAHeaderUserCredentials GetUserCredentials(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var userCredentials = new SBNChangeNameHeaderCCRAHeaderUserCredentials();

            //BN9 of licensee (Owner company)
            userCredentials.businessRegistrationNumber = licence.AdoxioLicencee.Accountnumber;
            //the name of the applicant (licensee)- last name, first name middle initial or company name
            userCredentials.legalName = licence.AdoxioLicencee.Name;
            //establishment (physical location of store)
            userCredentials.postalCode = Utils.FormatPostalCode(licence.AdoxioEstablishment.AdoxioAddresspostalcode);

            return(userCredentials);
        }
Esempio n. 6
0
        public static ApplicationLicenseSummary ToLicenseSummaryViewModel(this MicrosoftDynamicsCRMadoxioLicences licence, IList <MicrosoftDynamicsCRMadoxioApplication> applications)
        {
            ApplicationLicenseSummary licenseSummary = new ViewModels.ApplicationLicenseSummary()
            {
                LicenseId     = licence.AdoxioLicencesid,
                LicenseNumber = licence.AdoxioLicencenumber,
                EstablishmentAddressStreet     = licence.AdoxioEstablishmentaddressstreet,
                EstablishmentAddressCity       = licence.AdoxioEstablishmentaddresscity,
                EstablishmentAddressPostalCode = licence.AdoxioEstablishmentaddresspostalcode,
                ExpiryDate        = licence.AdoxioExpirydate,
                Status            = StatusUtility.GetLicenceStatus(licence, applications),
                AllowedActions    = new List <ApplicationType>(),
                TransferRequested = (TransferRequested?)licence.AdoxioTransferrequested
            };


            if (licence.AdoxioEstablishment != null)
            {
                licenseSummary.EstablishmentName = licence.AdoxioEstablishment.AdoxioName;
            }

            var mainApplication = applications.Where(app => app.Statuscode == (int)Public.ViewModels.AdoxioApplicationStatusCodes.Approved).FirstOrDefault();
            var crsApplication  = applications.Where(app => app.AdoxioApplicationTypeId.AdoxioName == "Cannabis Retail Store").FirstOrDefault();

            if (mainApplication != null)
            {
                licenseSummary.ApplicationId = mainApplication.AdoxioApplicationid;
            }
            if (crsApplication != null)
            {
                licenseSummary.StoreInspected = crsApplication.AdoxioAppchecklistinspectionresults == (int)InspectionStatus.Pass;
            }

            if (licence.AdoxioLicenceType != null)
            {
                licenseSummary.LicenceTypeName = licence.AdoxioLicenceType.AdoxioName;
            }

            if (licence != null &&
                licence.AdoxioLicenceType != null &&
                licence.AdoxioLicenceType.AdoxioLicencetypesApplicationtypes != null)
            {
                foreach (var item in licence.AdoxioLicenceType.AdoxioLicencetypesApplicationtypes)
                {
                    // check to see if there is an existing action on this licence.
                    licenseSummary.AllowedActions.Add(item.ToViewModel());
                }
            }

            return(licenseSummary);
        }
Esempio n. 7
0
        private SBNCreateProgramAccountRequestHeader GetProgramAccountRequestHeader(MicrosoftDynamicsCRMadoxioLicences licence, string suffix)
        {
            var header = new SBNCreateProgramAccountRequestHeader();

            header.requestMode     = OneStopUtils.ASYNCHRONOUS;
            header.documentSubType = OneStopUtils.DOCUMENT_SUBTYPE;
            header.senderID        = OneStopUtils.SENDER_ID;
            header.receiverID      = OneStopUtils.RECEIVER_ID;
            //any note wanted by LCRB. Currently in liquor is: licence Id, licence number - sequence number
            header.partnerNote = licence.AdoxioLicencesid + "," + licence.AdoxioLicencenumber + "-" + suffix;
            header.CCRAHeader  = GetCCRAHeader(licence);

            return(header);
        }
Esempio n. 8
0
        private SBNChangeStatusHeader GetHeader(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var header = new SBNChangeStatusHeader();

            header.requestMode     = OneStopUtils.ASYNCHRONOUS;
            header.documentSubType = OneStopUtils.DOCUMENT_SUBTYPE_CHANGESTATUS;
            header.senderID        = OneStopUtils.SENDER_ID;
            header.receiverID      = OneStopUtils.RECEIVER_ID;
            //any note wanted by LCRB. Currently in liquor is: licence Id, licence number - sequence number
            header.partnerNote = licence.AdoxioLicencenumber + "-" + DateTime.Now.Ticks;

            header.CCRAHeader = GetCCRAHeader(licence);

            return(header);
        }
Esempio n. 9
0
        private SBNProgramAccountDetailsBroadcastBodyOperatingName GetOperatingName(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var operatingName = new SBNProgramAccountDetailsBroadcastBodyOperatingName();


            //store name

            if (licence.AdoxioEstablishment != null)
            {
                operatingName.operatingName = licence.AdoxioEstablishment.AdoxioName;
            }


            //only ever have 1 operating name
            operatingName.operatingNamesequenceNumber = OneStopUtils.OPERATING_NAME_SEQUENCE_NUMBER;

            return(operatingName);
        }
        private SBNCreateProgramAccountRequestBody GetProgramAccountRequestBody(MicrosoftDynamicsCRMadoxioLicences licence, string suffix)
        {
            var programAccountRequestBody = new SBNCreateProgramAccountRequestBody();

            //BN9
            programAccountRequestBody.businessRegistrationNumber = licence.AdoxioLicencee.Accountnumber;
            //this code identifies that the message is from LCRB.  It's the same in every message from LCRB
            programAccountRequestBody.businessProgramIdentifier = OneStopUtils.BUSINESS_PROGRAM_IDENTIFIER;
            //this identifies the licence type. Fixed number assigned by the OneStopHub
            programAccountRequestBody.SBNProgramTypeCode   = OneStopUtils.PROGRAM_TYPE_CODE_CANNABIS_RETAIL_STORE;
            programAccountRequestBody.businessCore         = GetBusinessCore(licence, suffix);
            programAccountRequestBody.programAccountStatus = GetProgramAccountStatus();
            //the name of the applicant(licensee)- lastName, firstName middleName or company name
            programAccountRequestBody.legalName       = licence.AdoxioLicencee.Name;
            programAccountRequestBody.operatingName   = getOperatingName(licence);
            programAccountRequestBody.businessAddress = getBusinessAddress(licence);
            programAccountRequestBody.mailingAddress  = getMailingAddress(licence);

            return(programAccountRequestBody);
        }
Esempio n. 11
0
        private SBNCreateProgramAccountRequestBodyOperatingName getOperatingName(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var operatingName = new SBNCreateProgramAccountRequestBodyOperatingName();

            if (licence.AdoxioEstablishment != null)
            {
                //store name
                operatingName.operatingName = licence.AdoxioEstablishment.AdoxioName;
            }
            else // attempt to get from the Account
            {
                if (licence.AdoxioLicencee != null)
                {
                    operatingName.operatingName = licence.AdoxioLicencee.Name;
                }
            }
            //only ever have 1 operating name
            operatingName.operatingNamesequenceNumber = OneStopUtils.OPERATING_NAME_SEQUENCE_NUMBER;

            return(operatingName);
        }
Esempio n. 12
0
        public ActionResult InitiateTransfer(LicenceTransfer item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            // check access to licence
            MicrosoftDynamicsCRMadoxioLicences adoxioLicense = _dynamicsClient.GetLicenceByIdWithChildren(item.LicenceId);

            if (adoxioLicense == null)
            {
                return(NotFound());
            }

            if (!CurrentUserHasAccessToLicenseOwnedBy(adoxioLicense.AdoxioLicencee.Accountid))
            {
                return(Forbid());
            }

            try
            {
                var yes          = 845280001;
                var patchLicence = new MicrosoftDynamicsCRMadoxioLicences()
                {
                    ProposedOwnerODataBind  = _dynamicsClient.GetEntityURI("accounts", item.AccountId),
                    AdoxioTransferrequested = yes
                };

                // create application
                _dynamicsClient.Licenceses.Update(item.LicenceId, patchLicence);
            }
            catch (HttpOperationException httpOperationException)
            {
                _logger.LogError(httpOperationException, "Error initiating licence transfer");
                // fail if we can't create.
                throw (httpOperationException);
            }
            return(Ok());
        }
Esempio n. 13
0
        private SBNChangeNameBody GetBody(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var body = new SBNChangeNameBody();

            // licence number
            body.partnerInfo1 = licence.AdoxioLicencenumber;

            body.name = new SBNChangeNameBodyName();
            body.name.clientNameTypeCode = OneStopUtils.CLIENT_NAME_TYPE_CODE;
            body.name.name = licence.AdoxioEstablishment.AdoxioName;
            body.name.operatingNamesequenceNumber = 1;
            body.name.updateReasonCode            = OneStopUtils.UPDATE_REASON_CODE;

            body.businessRegistrationNumber = licence.AdoxioLicencee.AdoxioBusinessregistrationnumber;
            body.businessProgramIdentifier  = OneStopUtils.BUSINESS_PROGRAM_IDENTIFIER;

            body.businessProgramAccountReferenceNumber = licence.AdoxioBusinessprogramaccountreferencenumber;

            // partnerInfo1
            body.partnerInfo1 = licence.AdoxioLicencenumber;

            return(body);
        }
        private SBNChangeAddressBody GetBody(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var body = new SBNChangeAddressBody();

            // licence number
            body.partnerInfo1          = licence.AdoxioLicencenumber;
            body.addressTypeCode       = OneStopUtils.ADDRESS_TYPE_CODE;
            body.updateReasonCode      = OneStopUtils.UPDATE_REASON_CODE_ADDRESS;
            body.address               = new SBNChangeAddressBodyAddress();
            body.address.foreignLegacy = new SBNChangeAddressBodyAddressForeignLegacy();
            body.address.foreignLegacy.addressDetailLine1 = licence.AdoxioEstablishment.AdoxioAddressstreet;
            body.address.municipality       = licence.AdoxioEstablishment.AdoxioAddresscity;
            body.address.provinceStateCode  = OneStopUtils.PROVINCE_STATE_CODE;
            body.address.countryCode        = OneStopUtils.COUNTRY_CODE;
            body.businessRegistrationNumber = licence.AdoxioLicencee.AdoxioBusinessregistrationnumber;
            body.businessProgramIdentifier  = OneStopUtils.BUSINESS_PROGRAM_IDENTIFIER;

            body.businessProgramAccountReferenceNumber = licence.AdoxioBusinessprogramaccountreferencenumber;

            // partnerInfo1
            body.partnerInfo1 = licence.AdoxioLicencenumber;

            return(body);
        }
Esempio n. 15
0
        /**
         * Create Program Details Broadcast.
         * XML Message sent to the Hub broadcasting the details of the new cannabis licence issued.
         * The purpose is to broadcast licence details to partners subscribed to the Hub
         */
        public string CreateXML(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            if (licence == null)
            {
                throw new Exception("The licence can not be null");
            }

            if (licence.AdoxioLicencee == null)
            {
                throw new Exception("The licence must have an AdoxioLicencee");
            }
            var programAccountDetailsBroadcast = new SBNProgramAccountDetailsBroadcast1();

            programAccountDetailsBroadcast.header = GetProgramAccountDetailsBroadcastHeader(licence);
            programAccountDetailsBroadcast.body   = GetProgramAccountDetailsBroadcastBody(licence);

            var serializer = new XmlSerializer(typeof(SBNProgramAccountDetailsBroadcast1));

            using (StringWriter textWriter = new StringWriter())
            {
                serializer.Serialize(textWriter, programAccountDetailsBroadcast);
                return(textWriter.ToString());
            }
        }
        private SBNChangeStatusBody GetBody(MicrosoftDynamicsCRMadoxioLicences licence, OneStopHubStatusChange statusChange)
        {
            var body = new SBNChangeStatusBody();

            // licence number
            body.partnerInfo1 = licence.AdoxioLicencenumber;

            body.statusData = new SBNChangeStatusBodyStatusData();


            body.statusData.businessRegistrationNumber = licence.AdoxioLicencee.AdoxioBusinessregistrationnumber;
            body.statusData.businessProgramIdentifier  = OneStopUtils.BUSINESS_PROGRAM_IDENTIFIER;

            body.statusData.businessProgramAccountReferenceNumber = licence.AdoxioBusinessprogramaccountreferencenumber;
            // programAccountStatus
            body.statusData.programAccountStatus = GetProgramAccountStatus(licence, statusChange);

            // partnerInfo1
            body.partnerInfo1 = licence.AdoxioLicencenumber;

            // partnerInfo2 - date

            return(body);
        }
        /**
         * Create Program Details Broadcast.
         * XML Message sent to the Hub broadcasting the details of the new cannabis licence issued.
         * The purpose is to broadcast licence details to partners subscribed to the Hub
         */
        public string CreateXML(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            if (licence == null)
            {
                throw new Exception("The licence can not be null");
            }

            if (licence.AdoxioEstablishment == null)
            {
                throw new Exception("The licence must have an Establishment");
            }

            if (licence.AdoxioLicencee == null)
            {
                throw new Exception("The licence must have an AdoxioLicencee");
            }

            if (licence.AdoxioBusinessprogramaccountreferencenumber == null)
            {
                // set to 1 and handle errors as encountered.
                licence.AdoxioBusinessprogramaccountreferencenumber = "1";
            }

            var sbnChangeAddress = new SBNChangeAddress();

            sbnChangeAddress.header = GetHeader(licence);
            sbnChangeAddress.body   = GetBody(licence);

            var serializer = new XmlSerializer(typeof(SBNChangeAddress));

            using (StringWriter textWriter = new StringWriter())
            {
                serializer.Serialize(textWriter, sbnChangeAddress);
                return(textWriter.ToString());
            }
        }
        private string HandleSBNCreateProgramAccountResponse(string inputXML)
        {
            IDynamicsClient dynamicsClient = DynamicsSetupUtil.SetupDynamics(_configuration);

            Log.Logger.Information("Reached HandleSBNCreateProgramAccountResponse");
            if (!_env.IsProduction())
            {
                Log.Logger.Information($"InputXML is: {inputXML}");
            }

            string httpStatusCode = "200";

            // deserialize the inputXML
            var serializer = new XmlSerializer(typeof(SBNCreateProgramAccountResponse1));
            SBNCreateProgramAccountResponse1 licenseData;

            using (TextReader reader = new StringReader(inputXML))
            {
                licenseData = (SBNCreateProgramAccountResponse1)serializer.Deserialize(reader);
            }


            string licenceNumber = OneStopUtils.GetLicenceNumberFromPartnerNote(licenseData.header.partnerNote);

            Log.Logger.Information($"Getting licence with number of {licenceNumber}");

            // Get licence from dynamics

            string businessProgramAccountNumber = "1";
            MicrosoftDynamicsCRMadoxioLicences licence;

            string filter = $"adoxio_licencenumber eq '{licenceNumber}'";

            try
            {
                licence = dynamicsClient.Licenceses.Get(filter: filter).Value.FirstOrDefault();
                businessProgramAccountNumber = licenseData.body.businessProgramAccountNumber.businessProgramAccountReferenceNumber;
            }
            catch (Exception e)
            {
                Log.Logger.Error($"Unable to get licence data for licence number {licenceNumber} {e.Message}");
                licence = null;
            }


            if (licence == null)
            {
                Log.Logger.Information("licence is null - returning 400.");
                httpStatusCode = "400";
            }
            else
            {
                Log.Logger.Information("Licence record retrieved from Dynamics.");
                //save the program account number to dynamics

                int    tempBpan      = int.Parse(businessProgramAccountNumber);
                string sanitizedBpan = tempBpan.ToString();

                MicrosoftDynamicsCRMadoxioLicences pathLicence = new MicrosoftDynamicsCRMadoxioLicences()
                {
                    AdoxioBusinessprogramaccountreferencenumber = sanitizedBpan,
                    AdoxioOnestopsent = true
                };
                Log.Logger.Information("Sending update to Dynamics for BusinessProgramAccountNumber.");
                try
                {
                    dynamicsClient.Licenceses.Update(licence.AdoxioLicencesid, pathLicence);
                    Log.Logger.Information($"ONESTOP Updated Licence {licenceNumber} record {licence.AdoxioLicencesid} to {businessProgramAccountNumber}");
                }
                catch (HttpOperationException odee)
                {
                    Log.Logger.Error(odee, "Error updating Licence {licence.AdoxioLicencesid}");
                    // fail if we can't get results.
                    throw (odee);
                }

                //Trigger the Send ProgramAccountDetailsBroadcast Message
                BackgroundJob.Enqueue(() => new OneStopUtils(_configuration, _cache).SendProgramAccountDetailsBroadcastMessageRest(null, licence.AdoxioLicencesid));

                Log.Logger.Information("send program account details broadcast done.");
            }

            return(httpStatusCode);
        }
        public static void CopyValuesForChangeOfLocation(this MicrosoftDynamicsCRMadoxioApplication to, MicrosoftDynamicsCRMadoxioLicences from, bool copyAddress)
        {
            // copy establishment information
            if (copyAddress)
            {
                // 12-10-2019 - Removed set to AdoxioAddressCity as it is set by Dynamics Workflow, not the portal
                to.AdoxioEstablishmentaddressstreet     = from.AdoxioEstablishmentaddressstreet;
                to.AdoxioEstablishmentaddresscity       = from.AdoxioEstablishmentaddresscity;
                to.AdoxioEstablishmentaddresspostalcode = from.AdoxioEstablishmentaddresspostalcode;
            }

            if (from.AdoxioEstablishment != null)
            {
                to.AdoxioEstablishmentpropsedname = from.AdoxioEstablishment.AdoxioName;
                to.AdoxioEstablishmentemail       = from.AdoxioEstablishment.AdoxioEmail;
                to.AdoxioEstablishmentphone       = from.AdoxioEstablishment.AdoxioPhone;
                to.AdoxioEstablishmentparcelid    = from.AdoxioEstablishment.AdoxioParcelid;
                to.AdoxioIsoninland                 = from.AdoxioEstablishment.AdoxioIsoninland;
                to.AdoxioPoliceJurisdictionId       = from.AdoxioEstablishment.AdoxioPDJurisdiction;
                to.AdoxioLocalgovindigenousnationid = from.AdoxioEstablishment.AdoxioLGIN;
            }
        }
Esempio n. 20
0
        public static License ToViewModel(this MicrosoftDynamicsCRMadoxioLicences dynamicsLicense, IDynamicsClient dynamicsClient)
        {
            License adoxioLicenseVM = new License();

            adoxioLicenseVM.Id = dynamicsLicense.AdoxioLicencesid;

            if (dynamicsLicense._adoxioLicencesubcategoryidValue != null)
            {
                try
                {
                    var adoxioLicencesubcategory = dynamicsClient.Licencesubcategories.GetByKey(dynamicsLicense._adoxioLicencesubcategoryidValue);
                    adoxioLicenseVM.LicenseSubCategory = adoxioLicencesubcategory.AdoxioName;
                }
                catch (Exception e)
                {
                    adoxioLicenseVM.LicenseSubCategory = null;
                }
            }

            // fetch the establishment and get name and address
            Guid?adoxioEstablishmentId = null;

            if (!string.IsNullOrEmpty(dynamicsLicense._adoxioEstablishmentValue))
            {
                adoxioEstablishmentId = Guid.Parse(dynamicsLicense._adoxioEstablishmentValue);
            }
            if (adoxioEstablishmentId != null)
            {
                var establishment = dynamicsClient.Establishments.GetByKey(adoxioEstablishmentId.ToString());
                adoxioLicenseVM.EstablishmentId      = establishment.AdoxioEstablishmentid;
                adoxioLicenseVM.EstablishmentName    = establishment.AdoxioName;
                adoxioLicenseVM.EstablishmentEmail   = establishment.AdoxioEmail;
                adoxioLicenseVM.EstablishmentPhone   = establishment.AdoxioPhone;
                adoxioLicenseVM.EstablishmentAddress = establishment.AdoxioAddressstreet
                                                       + ", " + establishment.AdoxioAddresscity
                                                       + " " + establishment.AdoxioAddresspostalcode;
            }
            adoxioLicenseVM.ExpiryDate = dynamicsLicense.AdoxioExpirydate;

            // fetch the licence status
            int?adoxio_licenceStatusId = dynamicsLicense.Statuscode;

            if (adoxio_licenceStatusId != null)
            {
                adoxioLicenseVM.LicenseStatus = dynamicsLicense.Statuscode.ToString();
            }

            // fetch the licence type
            Guid?adoxio_licencetypeId = null;

            if (!string.IsNullOrEmpty(dynamicsLicense._adoxioLicencetypeValue))
            {
                adoxio_licencetypeId = Guid.Parse(dynamicsLicense._adoxioLicencetypeValue);
            }
            if (adoxio_licencetypeId != null)
            {
                var adoxio_licencetype = dynamicsClient.Licencetypes.GetByKey(adoxio_licencetypeId.ToString());
                if (adoxio_licencetype != null)
                {
                    adoxioLicenseVM.LicenseType = adoxio_licencetype.AdoxioName;
                }
            }

            // fetch license number
            adoxioLicenseVM.LicenseNumber = dynamicsLicense.AdoxioLicencenumber;

            adoxioLicenseVM.EstablishmentAddressCity       = dynamicsLicense.AdoxioEstablishmentaddresscity;
            adoxioLicenseVM.EstablishmentAddressPostalCode = dynamicsLicense.AdoxioEstablishmentaddresspostalcode;
            adoxioLicenseVM.EstablishmentAddressStreet     = dynamicsLicense.AdoxioEstablishmentaddressstreet;

            if (dynamicsLicense.AdoxioEstablishment != null)
            {
                adoxioLicenseVM.EstablishmentParcelId = dynamicsLicense.AdoxioEstablishment.AdoxioParcelid;
            }


            adoxioLicenseVM.Endorsements            = GetEndorsements(adoxioLicenseVM.Id, dynamicsClient);
            adoxioLicenseVM.OffsiteStorageLocations = GetOffsiteStorage(adoxioLicenseVM.Id, dynamicsClient);
            adoxioLicenseVM.ServiceAreas            = GetServiceAreas(adoxioLicenseVM.Id, dynamicsClient);

            adoxioLicenseVM.RepresentativeFullName    = dynamicsLicense.AdoxioRepresentativename;
            adoxioLicenseVM.RepresentativeEmail       = dynamicsLicense.AdoxioRepresentativeemail;
            adoxioLicenseVM.RepresentativePhoneNumber = dynamicsLicense.AdoxioRepresentativephone;
            adoxioLicenseVM.RepresentativeCanSubmitPermanentChangeApplications = dynamicsLicense.AdoxioCansubmitpermanentchangeapplications;
            adoxioLicenseVM.RepresentativeCanSignTemporaryChangeApplications   = dynamicsLicense.AdoxioCansigntemporarychangeapplications;
            adoxioLicenseVM.RepresentativeCanObtainLicenceInformation          = dynamicsLicense.AdoxioCanobtainlicenceinformation;
            adoxioLicenseVM.RepresentativeCanSignGroceryStoreProofOfSale       = dynamicsLicense.AdoxioCansigngrocerystoreproofofsales;
            adoxioLicenseVM.RepresentativeCanAttendEducationSessions           = dynamicsLicense.AdoxioCanattendeducationsessions;
            adoxioLicenseVM.RepresentativeCanAttendComplianceMeetings          = dynamicsLicense.AdoxioCanattendcompliancemeetings;
            adoxioLicenseVM.RepresentativeCanRepresentAtHearings = dynamicsLicense.AdoxioCanrepresentathearings;

            return(adoxioLicenseVM);
        }
        private string HandleSBNErrorNotification(string inputXML)
        {
            IDynamicsClient dynamicsClient = DynamicsSetupUtil.SetupDynamics(_configuration);

            string result = "200";
            // deserialize the inputXML
            var serializer = new XmlSerializer(typeof(SBNErrorNotification1));
            SBNErrorNotification1 errorNotification;

            using (TextReader reader = new StringReader(inputXML))
            {
                errorNotification = (SBNErrorNotification1)serializer.Deserialize(reader);
            }


            // check to see if it is simply a problem with an old account number.
            if (errorNotification.body.validationErrors[0].errorMessageNumber.Equals("11845")) // Transaction not allowed - Duplicate Client event exists )
            {
                Log.Logger.Error($"CRA has rejected the message due to an incorrect business number.  The business in question may have had multiple business numbers in the past and the number in the record is no longer valid.  Please correct the business number for record with partnernote of {errorNotification.header.partnerNote}");
            }
            else if (errorNotification.body.validationErrors[0].errorMessageNumber.Equals("11409")) // Old account number.
            {
                Log.Logger.Information("Error is old account number is already associated with another account.  Retrying.");
                // retry the request with a higher increment.

                string licenceGuid   = OneStopUtils.GetGuidFromPartnerNote(errorNotification.header.partnerNote);
                int    currentSuffix = OneStopUtils.GetSuffixFromPartnerNote(errorNotification.header.partnerNote, Log.Logger);

                string cacheKey = "_BPAR_" + licenceGuid;

                Log.Logger.Information($"Reading cache value for key {cacheKey}");

                if (!_cache.TryGetValue(cacheKey, out int suffixLimit))
                {
                    suffixLimit = 10;
                }

                // sanity check
                if (currentSuffix < suffixLimit)
                {
                    currentSuffix++;
                    Log.Logger.Information($"Starting resend of send program account request message, with new value of {currentSuffix}");

                    var patchRecord = new MicrosoftDynamicsCRMadoxioLicences()
                    {
                        AdoxioBusinessprogramaccountreferencenumber = currentSuffix.ToString()
                    };
                    dynamicsClient.Licenceses.Update(licenceGuid, patchRecord);

                    BackgroundJob.Schedule(() => new OneStopUtils(_configuration, _cache).SendProgramAccountRequestREST(null, licenceGuid, currentSuffix.ToString("D3")) // zero pad 3 digit.
                                           , TimeSpan.FromSeconds(30));                                                                                                  // Try again after 30 seconds
                }
                else
                {
                    Log.Logger.Error($"Skipping resend of send program account request message as there have been too many tries({currentSuffix} - {suffixLimit}) Partner Note is partner note {errorNotification.header.partnerNote}");
                }
            }
            else
            {
                Log.Logger.Error($"Received error notification for record with partner note {errorNotification.header.partnerNote} Error Code is  {errorNotification.body.validationErrors[0].errorMessageNumber}. Error Text is {errorNotification.body.validationErrors[0].errorMessageText} {inputXML}");
            }

            return(result);
        }
Esempio n. 22
0
 /// <summary>
 /// Update entity in adoxio_licenceses
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='adoxioLicencesid'>
 /// key: adoxio_licencesid
 /// </param>
 /// <param name='body'>
 /// New property values
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task UpdateAsync(this ILicenses operations, string adoxioLicencesid, MicrosoftDynamicsCRMadoxioLicences body, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.UpdateWithHttpMessagesAsync(adoxioLicencesid, body, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Esempio n. 23
0
        public static ApplicationLicenseSummary ToLicenseSummaryViewModel(this MicrosoftDynamicsCRMadoxioLicences licence, IList <MicrosoftDynamicsCRMadoxioApplication> applications, IDynamicsClient dynamicsClient)
        {
            bool missingLicenceFee = applications.Where(app =>
                                                        app._adoxioLicencefeeinvoiceValue != null &&
                                                        app?.AdoxioApplicationTypeId?.AdoxioIsdefault == true &&
                                                        app?.AdoxioLicenceFeeInvoice?.Statuscode != (int)Adoxio_invoicestatuses.Paid
                                                        ).Any();

            ApplicationLicenseSummary licenseSummary = new ApplicationLicenseSummary
            {
                LicenseId                      = licence.AdoxioLicencesid,
                LicenseNumber                  = licence.AdoxioLicencenumber,
                LicenceTypeCategory            = (LicenceTypeCategory)licence?.AdoxioLicenceType?.AdoxioCategory,
                MissingFirstYearLicenceFee     = missingLicenceFee,
                CurrentOwner                   = licence?.AdoxioLicencee?.Name,
                EstablishmentAddressStreet     = licence.AdoxioEstablishmentaddressstreet,
                EstablishmentAddressCity       = licence.AdoxioEstablishmentaddresscity,
                EstablishmentAddressPostalCode = licence.AdoxioEstablishmentaddresspostalcode,
                EstablishmentPhoneNumber       = licence.AdoxioEstablishmentphone,
                EstablishmentEmail             = licence.AdoxioEstablishment?.AdoxioEmail,
                EstablishmentId                = licence.AdoxioEstablishment?.AdoxioEstablishmentid,
                ExpiryDate                     = licence.AdoxioExpirydate,
                Status                      = StatusUtility.GetLicenceStatus(licence, applications),
                AllowedActions              = new List <ApplicationType>(),
                TransferRequested           = licence.AdoxioTransferrequested.HasValue && (EnumYesNo?)licence.AdoxioTransferrequested == EnumYesNo.Yes,
                Dormant                     = licence.AdoxioDormant.HasValue && (EnumYesNo?)licence.AdoxioDormant == EnumYesNo.Yes,
                Suspended                   = licence.AdoxioSuspended.HasValue && (EnumYesNo?)licence.AdoxioSuspended == EnumYesNo.Yes,
                Operated                    = licence.AdoxioOperated.HasValue && (EnumYesNo?)licence.AdoxioOperated == EnumYesNo.Yes,
                ThirdPartyOperatorAccountId = licence._adoxioThirdpartyoperatoridValue,
                TPORequested                = licence.AdoxioTporequested.HasValue && (EnumYesNo?)licence.AdoxioTporequested == EnumYesNo.Yes, // indicate whether a third party operator app has been requested
                RepresentativeFullName      = licence.AdoxioRepresentativename,
                RepresentativeEmail         = licence.AdoxioRepresentativeemail,
                RepresentativePhoneNumber   = licence.AdoxioRepresentativephone,
                RepresentativeCanSubmitPermanentChangeApplications = licence.AdoxioCansubmitpermanentchangeapplications,
                RepresentativeCanSignTemporaryChangeApplications   = licence.AdoxioCansigntemporarychangeapplications,
                RepresentativeCanObtainLicenceInformation          = licence.AdoxioCanobtainlicenceinformation,
                RepresentativeCanSignGroceryStoreProofOfSale       = licence.AdoxioCansigngrocerystoreproofofsales,
                RepresentativeCanAttendEducationSessions           = licence.AdoxioCanattendeducationsessions,
                RepresentativeCanAttendComplianceMeetings          = licence.AdoxioCanattendcompliancemeetings,
                RepresentativeCanRepresentAtHearings = licence.AdoxioCanrepresentathearings,
                AutoRenewal = (licence.AdoxioAutorenewal == true)
            };

            if (licence._adoxioLicencesubcategoryidValue != null)
            {
                try
                {
                    var adoxioLicencesubcategory = dynamicsClient.Licencesubcategories.GetByKey(licence._adoxioLicencesubcategoryidValue);
                    licenseSummary.LicenseSubCategory = adoxioLicencesubcategory.AdoxioName;
                }
                catch (Exception e)
                {
                    licenseSummary.LicenseSubCategory = null;
                }
            }

            if (licence.AdoxioThirdPartyOperatorId != null)
            {
                licenseSummary.ThirdPartyOperatorAccountName = licence.AdoxioThirdPartyOperatorId.Name;
            }

            if (licence.AdoxioEstablishment != null)
            {
                licenseSummary.EstablishmentName   = licence.AdoxioEstablishment.AdoxioName;
                licenseSummary.EstablishmentIsOpen = licence.AdoxioEstablishment.AdoxioIsopen;
            }

            var mainApplication = applications.Where(app => app.Statuscode == (int)AdoxioApplicationStatusCodes.Approved).FirstOrDefault();

            if (mainApplication != null)
            {
                licenseSummary.ApplicationId = mainApplication.AdoxioApplicationid;
                if (mainApplication.AdoxioApplicationTypeId != null)
                {
                    licenseSummary.ApplicationTypeName     = mainApplication.AdoxioApplicationTypeId.AdoxioName;
                    licenseSummary.ApplicationTypeCategory = (ApplicationTypeCategory?)mainApplication.AdoxioApplicationTypeId.AdoxioCategory;
                }
            }

            if (licence.AdoxioLicenceType != null)
            {
                licenseSummary.LicenceTypeName     = licence.AdoxioLicenceType.AdoxioName;
                licenseSummary.LicenceTypeCategory = (LicenceTypeCategory?)licence.AdoxioLicenceType.AdoxioCategory;
            }

            licenseSummary.Endorsements = GetEndorsements(licenseSummary.LicenseId, dynamicsClient);

            if (licence?.AdoxioLicenceType?.AdoxioLicencetypesApplicationtypes != null)
            {
                //Filter out application types that are not ACTIVE
                const int ACTIVE           = 0;
                var       applicationTypes = licence.AdoxioLicenceType.AdoxioLicencetypesApplicationtypes
                                             .Where(appType => appType.Statecode == ACTIVE)
                                             .ToList()
                                             .OrderBy(appType => appType.AdoxioActiontext);

                foreach (var item in applicationTypes)
                {
                    // we don't want to allow you to apply for an endorsement you already have...
                    bool isEndorsementThatIsProcessed = (
                        item.AdoxioIsendorsement != null &&
                        item.AdoxioIsendorsement == true &&
                        licenseSummary.Endorsements.Any(e => e.ApplicationTypeId == item.AdoxioApplicationtypeid)
                        );
                    if (!isEndorsementThatIsProcessed)
                    {
                        licenseSummary.AllowedActions.Add(item.ToViewModel());
                    }
                }
            }

            licenseSummary.OffsiteStorageLocations = GetOffsiteStorage(licenseSummary.LicenseId, dynamicsClient);
            licenseSummary.ServiceAreas            = GetServiceAreas(licenseSummary.LicenseId, dynamicsClient);

            return(licenseSummary);
        }
Esempio n. 24
0
 /// <summary>
 /// Add new entity to adoxio_licenceses
 /// </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 <MicrosoftDynamicsCRMadoxioLicences> CreateAsync(this ILicenses operations, MicrosoftDynamicsCRMadoxioLicences body, string prefer = "return=representation", CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateWithHttpMessagesAsync(body, prefer, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Esempio n. 25
0
 /// <summary>
 /// Update entity in adoxio_licenceses
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='adoxioLicencesid'>
 /// key: adoxio_licencesid
 /// </param>
 /// <param name='body'>
 /// New property values
 /// </param>
 public static void Update(this ILicenses operations, string adoxioLicencesid, MicrosoftDynamicsCRMadoxioLicences body)
 {
     operations.UpdateAsync(adoxioLicencesid, body).GetAwaiter().GetResult();
 }
Esempio n. 26
0
 /// <summary>
 /// Add new entity to adoxio_licenceses
 /// </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 MicrosoftDynamicsCRMadoxioLicences Create(this ILicenses operations, MicrosoftDynamicsCRMadoxioLicences body, string prefer = "return=representation")
 {
     return(operations.CreateAsync(body, prefer).GetAwaiter().GetResult());
 }
Esempio n. 27
0
        public static void CreateLicenceDocumentLocation(this IDynamicsClient _dynamicsClient, MicrosoftDynamicsCRMadoxioLicences licenceEntity, string folderName, string name)
        {
            // set the parent document library.
            var parentDocumentLibraryReference = _dynamicsClient.GetDocumentLocationReferenceByRelativeURL("adoxio_licences");

            var licenceUri = _dynamicsClient.GetEntityURI("adoxio_licenceses", licenceEntity.AdoxioLicencesid);
            // now create a document location to link them.

            // Create the SharePointDocumentLocation entity
            var mdcsdl = new MicrosoftDynamicsCRMsharepointdocumentlocation
            {
                RegardingobjectIdEventODataBind = licenceUri,
                ParentsiteorlocationSharepointdocumentlocationODataBind =
                    _dynamicsClient.GetEntityURI("sharepointdocumentlocations", parentDocumentLibraryReference),
                Relativeurl = folderName,
                Description = "Licence Files",
                Name        = name
            };

            var sharepointdocumentlocationid = _dynamicsClient.DocumentLocationExistsWithCleanup(mdcsdl);

            if (sharepointdocumentlocationid == null)
            {
                try
                {
                    mdcsdl = _dynamicsClient.Sharepointdocumentlocations.Create(mdcsdl);
                }
                catch (HttpOperationException odee)
                {
                    Log.Error(odee, "Error creating SharepointDocumentLocation");
                    mdcsdl = null;
                }

                if (mdcsdl != null)
                {
                    var sharePointLocationData = _dynamicsClient.GetEntityURI("sharepointdocumentlocations",
                                                                              mdcsdl.Sharepointdocumentlocationid);

                    var oDataId = new Odataid
                    {
                        OdataidProperty = sharePointLocationData
                    };
                    try
                    {
                        _dynamicsClient.Licenceses.AddReference(licenceEntity.AdoxioLicencesid,
                                                                "adoxio_licences_SharePointDocumentLocations", oDataId);
                    }
                    catch (HttpOperationException odee)
                    {
                        Log.Error(odee, "Error adding reference to SharepointDocumentLocation");
                    }
                }
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Hangfire job to send LicenceDetailsMessage to One stop.
        /// </summary>
        public async Task SendProgramAccountDetailsBroadcastMessage(PerformContext hangfireContext, string licenceGuidRaw)
        {
            if (hangfireContext != null)
            {
                hangfireContext.WriteLine("Starting OneStop SendLicenceCreationMessage Job.");
            }

            string licenceGuid = Utils.ParseGuid(licenceGuidRaw);

            OneStopHubService.receiveFromPartnerResponse output;
            var serviceClient = new OneStopHubService.http___SOAP_BCPartnerPortTypeClient();

            serviceClient.ClientCredentials.UserName.UserName = Configuration["ONESTOP_HUB_USERNAME"];
            serviceClient.ClientCredentials.UserName.Password = Configuration["ONESTOP_HUB_PASSWORD"];
            var basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);

            basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            serviceClient.Endpoint.Binding = basicHttpBinding;

            using (new OperationContextScope(serviceClient.InnerChannel))
            {
                //Create message header containing the credentials
                var header = new OneStopServiceReference.SoapSecurityHeader("", Configuration["ONESTOP_HUB_USERNAME"],
                                                                            Configuration["ONESTOP_HUB_PASSWORD"], "");
                //Add the credentials message header to the outgoing request
                OperationContext.Current.OutgoingMessageHeaders.Add(header);

                try
                {
                    var req = new ProgramAccountDetailsBroadcast();
                    if (hangfireContext != null)
                    {
                        hangfireContext.WriteLine($"Getting licence {licenceGuid}");
                    }

                    MicrosoftDynamicsCRMadoxioLicences licence = _dynamics.GetLicenceByIdWithChildren(licenceGuid);

                    if (hangfireContext != null)
                    {
                        hangfireContext.WriteLine("Got licence. Creating XML request");
                    }

                    var innerXML = req.CreateXML(licence);
                    hangfireContext.WriteLine("Sending request.");
                    var request = new OneStopHubService.receiveFromPartnerRequest(innerXML, "out");
                    output = serviceClient.receiveFromPartnerAsync(request).GetAwaiter().GetResult();
                }
                catch (Exception ex)
                {
                    if (_logger != null)
                    {
                        _logger.LogError(ex.Message);
                        _logger.LogError(ex.StackTrace);
                    }

                    if (hangfireContext != null)
                    {
                        hangfireContext.WriteLine("Error sending program account details broadcast:");
                        hangfireContext.WriteLine(ex.Message);
                    }

                    throw;
                }
            }

            if (hangfireContext != null)
            {
                hangfireContext.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(output));
                hangfireContext.WriteLine("End ofOneStop SendLicenceCreationMessage  Job.");
            }
        }
Esempio n. 29
0
        private SBNProgramAccountDetailsBroadcastHeaderCCRAHeaderUserCredentials GetUserCredentials(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var userCredentials = new SBNProgramAccountDetailsBroadcastHeaderCCRAHeaderUserCredentials();

            //BN9 of licensee (Owner company)
            userCredentials.businessRegistrationNumber = licence.AdoxioLicencee.Accountnumber;
            //the name of the applicant (licensee)- last name, first name middle initial or company name
            userCredentials.legalName = licence.AdoxioLicencee.Name;
            //establishment (physical location of store)
            userCredentials.postalCode = Utils.FormatPostalCode(licence.AdoxioEstablishment.AdoxioAddresspostalcode);
            //last name of sole proprietor (if not sole prop then null)
            if (licence.AdoxioLicencee != null && licence.AdoxioLicencee.Primarycontactid != null && !string.IsNullOrEmpty(licence.AdoxioLicencee.Primarycontactid.Lastname))
            {
                userCredentials.lastName = licence.AdoxioLicencee.Primarycontactid.Lastname;
            }
            else
            {
                userCredentials.lastName = "N/A";
            }


            return(userCredentials);
        }
Esempio n. 30
0
        private SBNProgramAccountDetailsBroadcastBodyMailingAddressForeignLegacy GetForeignLegacyMailing(MicrosoftDynamicsCRMadoxioLicences licence)
        {
            var foreignLegacyMailing = new SBNProgramAccountDetailsBroadcastBodyMailingAddressForeignLegacy();

            foreignLegacyMailing.addressDetailLine1 = licence.AdoxioEstablishment.AdoxioAddressstreet;
            //foreignLegacyMailing.addressDetailLine2 = "ToGetFromDynamics";

            return(foreignLegacyMailing);
        }