public static OrderAddress GetOrderAddress(this XElement addrElement, Enumerations.AddressType addressType) { string elementName = Enum.GetName(typeof(Enumerations.AddressType), addressType); OrderAddress address = (from addr in addrElement.Elements(elementName) let childAddrElements = addr.Element("Address") select new OrderAddress { Id = addr.AttributeNullValue <string>("id"), Type = addressType, Attention = elementName.Contains("Bill") ? addr.GetElementValue("BillToAttention") : addr.GetElementValue("ShipToAttention"), Name1 = addr.GetElementValue("Name1"), Name2 = addr.GetElementValue("Name2"), Name3 = addr.GetElementValue("Name3"), Name4 = addr.GetElementValue("Name4"), RADIndicator = addr.ElementNullValue <bool>("RADIndicator"), MarkedForDeletion = addr.ElementNullValue <bool>("MarkedForDeletion"), Street = childAddrElements.ElementNullValue <string>("Street"), PoBox = childAddrElements.GetElementValue("POBox"), PoBoxCity = childAddrElements.GetElementValue("POBoxCity"), City = childAddrElements.GetElementValue("City"), District = childAddrElements.GetElementValue("District"), Country = childAddrElements.GetElementValue("Country"), Fax = childAddrElements.GetElementValue("Fax"), PostalCode = childAddrElements.GetElementValue("PostalCode"), Region = childAddrElements.GetElementValue("Region"), CityCode = childAddrElements.GetElementValue("CityCode"), Telephone = childAddrElements.GetElementValue("Telephone") }).Single(); return(address); }
public Partner GetAddress(string accountNumber, string salesOrg, Enumerations.AddressType addressType) { var payload = new SimplePartnerRequest(accountNumber, salesOrg); if (!ModelState.IsValid) { Log(InfoMessage.ERROR_MSG_INVALID_PARTNER_REQUEST_MODEL); } return(addressType == Enumerations.AddressType.BillTo ? _accountService.GetBillToAddress(payload) : _accountService.GetShipToAddress(payload)); }
public PartnerLookupRequestRoot(SimplePartnerRequest req, Enumerations.AddressType addressType) { DISTR_CHAN = SALES_DISTRIBUTION_CHANNEL; DIVISION = SALES_DIVISION; PARTNER_IN = req.PartnerId; SALESORG = req.SalesAreaInfo.SalesOrgId; if (addressType == Enumerations.AddressType.BillTo) { PARTNER_ROLE_IN = SAP_DUPLICATE_BILL_TO; PARTNER_ROLE_OUT = SAP_BILL_TO; } else { PARTNER_ROLE_IN = SAP_SHIP_TO; PARTNER_ROLE_OUT = SAP_SHIP_TO; } }