Exemplo n.º 1
0
        private Partner GetPartnerDetails(PartnerLookupResponseRootPARTNERSOUT partnerOut)
        {
            var addressOut = GetAddress(partnerOut);

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

            var partner = new Partner
            {
                PartnerId    = partnerOut.CUSTOMER,
                FirstName    = addressOut.NAME1,
                CompanyName  = addressOut.NAME1,
                Name1        = addressOut.NAME1,
                Name2        = addressOut.NAME2,
                Name3        = addressOut.NAME3,
                Name4        = addressOut.NAME4,
                City         = addressOut.CITY1,
                Street       = addressOut.STREET,
                State        = addressOut.REGION,
                Region       = addressOut.REGION,
                Country      = addressOut.COUNTRY,
                PostalCode   = addressOut.POST_CODE1,
                RadIndicator = partnerOut.RAD_FLAG == "True",
                PartnerType  = GetPartnerType(partnerOut.PARTN_ROLE),
                Telephone    = addressOut.TEL_NUMBER,
                Fax          = addressOut.FAX_NUMBER
            };

            return(partner);
        }
Exemplo n.º 2
0
 private bool RemoveContactsApplyFilters(PartnerLookupResponseRootPARTNERSOUT x, string shipTo, string billTo)
 {
     if (String.IsNullOrEmpty(shipTo) && String.IsNullOrEmpty(billTo))
     {
         return(x.PARTN_ROLE != SAP_CONTACT && x.PARTN_ROLE != SAP_HIERARCHY_NUMBER);
     }
     else if (String.IsNullOrEmpty(billTo))
     {
         return(x.PARTN_ROLE != SAP_CONTACT && x.PARTN_ROLE != SAP_HIERARCHY_NUMBER &&
                x.PARTN_ROLE != SAP_DUPLICATE_BILL_TO && x.PARENT_NO == shipTo);
     }
     else
     {
         return(x.PARTN_ROLE != SAP_CONTACT && x.PARTN_ROLE != SAP_HIERARCHY_NUMBER &&
                x.PARTN_ROLE != SAP_DUPLICATE_BILL_TO &&
                (x.CUSTOMER == shipTo || (x.CUSTOMER == billTo && x.PARENT_NO == shipTo)));
     }
 }
Exemplo n.º 3
0
        private Contact GetContactDetails(PartnerLookupResponseRootPARTNERSOUT partnerOut)
        {
            var addressOut = GetContactAddresses(partnerOut);

            if (addressOut == null)
            {
                return(null);
            }
            var contact = new Contact
            {
                Id            = partnerOut.CUSTOMER,
                EmailAddress  = String.IsNullOrEmpty(partnerOut.E_MAIL) ? "NO EMAIL ADDRESS IN SAP" : partnerOut.E_MAIL,
                LastName      = String.IsNullOrEmpty(addressOut.NAME1) ? "NO LASTNAME FOUND IN SAP" : ParseName(addressOut.NAME1, LAST_NAME_IDX),
                FirstName     = String.IsNullOrEmpty(addressOut.NAME1) ? "NO FIRSTNAME FOUND IN SAP" : ParseName(addressOut.NAME1, FIRST_NAME_IDX),
                ParentAccount = partnerOut.PARENT_NO
            };

            return(contact);
        }
Exemplo n.º 4
0
        private static bool GetPartInfo(PartnerLookupResponseRootPARTNERSOUT x, string shipTo, string billTo, string partnerType)
        {
            if (!string.IsNullOrEmpty(shipTo) && x.CUSTOMER == shipTo && (x.PARTN_ROLE == SAP_SHIP_TO || x.PARTN_ROLE == SAP_SOLD_TO) && partnerType == SAP_SHIP_TO)
            {
                return(true);
            }

            if (!string.IsNullOrEmpty(billTo) && x.CUSTOMER == billTo && x.PARTN_ROLE == SAP_BILL_TO && partnerType == SAP_BILL_TO)
            {
                return(true);
            }

            if (string.IsNullOrEmpty(billTo) && SAP_BILL_TO == partnerType && x.PARTN_ROLE == SAP_BILL_TO)
            {
                return(true);
            }

            if (string.IsNullOrEmpty(shipTo) && SAP_SHIP_TO == partnerType && x.PARTN_ROLE == SAP_SHIP_TO)
            {
                return(true);
            }

            return(x.PARTN_ROLE == SAP_SOLD_TO && partnerType == SAP_SOLD_TO);
        }
Exemplo n.º 5
0
 private PartnerLookupResponseRootADDRESSOUT GetContactAddresses(PartnerLookupResponseRootPARTNERSOUT partnerItem)
 {
     return(ADDRESS_OUT.Where(x => partnerItem.ADDRESS == x.ADDRNUMBER && partnerItem.PARTN_ROLE == SAP_CONTACT).First());
 }
Exemplo n.º 6
0
 private PartnerLookupResponseRootADDRESSOUT GetAddress(PartnerLookupResponseRootPARTNERSOUT partnerItem)
 {
     return(ADDRESS_OUT.FirstOrDefault(x => partnerItem.ADDRESS == x.ADDRNUMBER));
 }
Exemplo n.º 7
0
 private static bool RemoveAllButContacts(PartnerLookupResponseRootPARTNERSOUT x)
 {
     return(x.PARTN_ROLE == SAP_CONTACT && x.PARTN_ROLE != SAP_HIERARCHY_NUMBER);
 }
Exemplo n.º 8
0
 private static bool RemoveContactsAndDuplicateBillTos(PartnerLookupResponseRootPARTNERSOUT x)
 {
     return(x.PARTN_ROLE != SAP_CONTACT && x.PARTN_ROLE != SAP_DUPLICATE_BILL_TO);
 }