コード例 #1
0
        public void WriteCustInvAddress(Prism810Context context, CustomerInvoiceConfigModel configModel, Type810Header header)
        {
            if (!context.IsCustomerInvoice)
            {
                return;
            }

            string entityName;
            string entityId;
            string address1;
            string address2;
            string city;
            string state;
            string postalCode;
            var    attn = string.Empty;

            if (configModel.BtCustomAddressLine)
            {
                entityName = configModel.BtEntityName;
                entityId   = configModel.BtEntityId;
                attn       = configModel.BtAttn;
                address1   = configModel.BtEntityAddress1;
                address2   = configModel.BtEntityAddress2;
                city       = configModel.BtEntityCity;
                state      = configModel.BtEntityState;
                postalCode = configModel.BtEntityZip;
            }
            else
            {
                var customer = clientDataAccess.LoadCustomerDetailByEsiId(header.EsiId);
                if (customer == null)
                {
                    logger.ErrorFormat("Could not load Customer from EsiId {0}.", header.EsiId);
                    return;
                }

                entityName = customer.CustName.ToAscii();
                entityId   = customer.CustNo.ToAscii();
                address1   = customer.Address1.ToAscii();
                address2   = customer.Address2.ToAscii();
                city       = customer.City.ToAscii();
                state      = customer.State.ToAscii();
                postalCode = customer.Zip.ToAscii();
            }

            var line = string.Format("05|{0}|BT|{1}|{2}|{3}||{4}|{5}|{6}|{7}|{8}||||||||", context.TradingPartnerId,
                                     entityName, entityId, attn, address1, address2, city, state, postalCode);

            context.AppendLine(line);
            logger.TraceFormat("Wrote 810 \"05\" PRISM line for Header {0}", header.HeaderKey);
        }