private BusinessPartnerResponse CreateSetSupplierResponse(SupplierBundleMaintainConfirmationMessage_sync_V1 sapResponse) { BusinessPartnerResponse response = new BusinessPartnerResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.Supplier != null) { var getAllDetails = CreateSupplierQuery(sapResponse.Supplier[0].InternalID); if (getAllDetails.Supplier != null) { response.BpExternalId = getAllDetails.Supplier[0].InternalID; if (getAllDetails.Supplier[0].PurchasingData != null) { response.SupplierDetails = new AccountTypeDetails(); response.SupplierDetails.CurrencyID = getAllDetails.Supplier[0].PurchasingData.PurchaseOrderCurrencyCode; response.SupplierDetails.PaymentTermID = getAllDetails.Supplier[0].PurchasingData.CashDiscountTermsCode != null ? getAllDetails.Supplier[0].PurchasingData.CashDiscountTermsCode.Value : null; } } } return(response); }
private BusinessPartnerResponse ParseCustomerQuery(CustomerResponseMessage_sync sapResponse) { BusinessPartnerResponse response = new BusinessPartnerResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.Customer != null) { response.BpExternalId = sapResponse.Customer[0].InternalID; response.CustomerDetails = new AccountTypeDetails(); if (sapResponse.Customer[0].SalesArrangement != null) { response.CustomerDetails.CurrencyID = sapResponse.Customer[0].SalesArrangement[0].CurrencyCode; response.CustomerDetails.PaymentTermID = sapResponse.Customer[0].SalesArrangement[0].CashDiscountTermsCode != null ? sapResponse.Customer[0].SalesArrangement[0].CashDiscountTermsCode.Value : null; if (sapResponse.Customer[0].PaymentData != null && sapResponse.Customer[0].PaymentData[0].CreditLimitAmount != null) { response.CustomerDetails.CreditLimit = sapResponse.Customer[0].PaymentData[0].CreditLimitAmount.Value; } } } return(response); }
private BusinessPartnerQueryResponse ParseSapQueryResponse(BusinessPartnerResponseMessage_sync sapResponse, BusinessPartnerRequest bpRequest) { BusinessPartnerQueryResponse response = new BusinessPartnerQueryResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.BusinessPartner != null) { response.BpExternalId = sapResponse.BusinessPartner[0].InternalID; response.IsSupplier = sapResponse.BusinessPartner[0].SupplierIndicator; response.IsCustomer = sapResponse.BusinessPartner[0].CustomerIndicator; response.Status = sapResponse.BusinessPartner[0].LifeCycleStatusCode.GetEnumDescription(); } else { return(response); } BusinessPartnerResponse conAndLocData = SetLocationAndContactIds(sapResponse, bpRequest); response.LocationExternalIds = conAndLocData.LocationExternalIds; response.ContactExternalIds = conAndLocData.ContactExternalIds; return(response); }
private BusinessPartnerResponse CreateSetCustomerResponse(CustomerBundleMaintainConfirmationMessage_sync_V1 sapResponse) { BusinessPartnerResponse response = new BusinessPartnerResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.Customer != null) { var getAllDetails = CreateCustomerQuery(sapResponse.Customer[0].InternalID); if (getAllDetails.Customer != null) { response.BpExternalId = getAllDetails.Customer[0].InternalID; if (getAllDetails.Customer[0].SalesArrangement != null) { response.CustomerDetails = new AccountTypeDetails(); response.CustomerDetails.CurrencyID = getAllDetails.Customer[0].SalesArrangement[0].CurrencyCode; response.CustomerDetails.PaymentTermID = getAllDetails.Customer[0].SalesArrangement[0].CashDiscountTermsCode != null ? getAllDetails.Customer[0].SalesArrangement[0].CashDiscountTermsCode.Value : null; if (getAllDetails.Customer[0].PaymentData != null && getAllDetails.Customer[0].PaymentData[0].CreditLimitAmount != null) { response.CustomerDetails.CreditLimit = getAllDetails.Customer[0].PaymentData[0].CreditLimitAmount.Value; } } } } return(response); }
public AccountHierarchyResponse SetAccountHierarchyQueryResponse(BusinessPartnerHierarchyResponseMessage_sync sapResponse, string accountId) { AccountHierarchyResponse response = new AccountHierarchyResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.Hierarchy != null) { response.ParentId = sapResponse.Hierarchy[0].ID.Value; response.ParentName = sapResponse.Hierarchy[0].Name; response.ParentUUID = sapResponse.Hierarchy[0].UUID.Value; if (sapResponse.Hierarchy[0].Group != null) { response.Children = new List <AccountHierarchyChildResponse>(); foreach (var group in sapResponse.Hierarchy[0].Group) { List <string> accountList = new List <string>(); if (group.BusinessPartner != null) { foreach (var account in group.BusinessPartner) { accountList.Add(account.InternalID); } } bool accountIsAssigned = false; if (accountList.Contains(accountId)) { accountIsAssigned = true; } response.Children.Add(new AccountHierarchyChildResponse { ChildName = group.Name, ChildId = group.ID, AssignedToAccount = accountIsAssigned }); } } } if (sapResponse.ProcessingConditions != null) { if (sapResponse.ProcessingConditions.ReturnedQueryHitsNumberValue == 0) { response.Errors = new List <string>(); response.Errors.Add("SAP Server Error. Number of hits = " + sapResponse.ProcessingConditions.ReturnedQueryHitsNumberValue); } } return(response); }
private BusinessPartnerIncomingResponse ParseSapQueryResponseForIncoming(BusinessPartnerResponseMessage_sync sapResponse) { BusinessPartnerIncomingResponse response = SetLocationAndContactIdsForIncoming(sapResponse); if (sapResponse.BusinessPartner != null) { var bp = sapResponse.BusinessPartner[0]; response.AccountDetails = new AccountDetailsIncoming(); response.AccountDetails.ExternalID = bp.InternalID; response.AccountDetails.Status = bp.LifeCycleStatusCode.GetEnumDescription(); response.AccountDetails.Name = bp.Organisation != null ? bp.Organisation.FirstLineName : null; var defaultLocation = response.Locations.Where(x => x.isDefault == true).FirstOrDefault(); if (defaultLocation != null) { response.AccountDetails.Website = defaultLocation.Website; response.AccountDetails.Email = defaultLocation.Email; } response.AccountDetails.VendorNum = bp.ApprovedVendor1; response.AccountDetails.ApprovedVendor = bp.ApprovedVendor; response.AccountDetails.CompanyType = bp.CompanyType; response.AccountDetails.AccountTypes = new List <string>(); if (sapResponse.BusinessPartner[0].CustomerIndicator) { var custResponse = _customerService.GetCustomerDetails(bp.InternalID); response.AccountDetails.CustomerDetails = custResponse.CustomerDetails != null ? custResponse.CustomerDetails : new AccountTypeDetails(); response.AccountDetails.AccountTypes.Add("customer"); //hierarchy var hierarchy = _hierarchyService.IsAccountAssignedToHierarchy(bp.InternalID); if (hierarchy.ParentId != null) { response.AccountDetails.Hierarchy = hierarchy; } } if (sapResponse.BusinessPartner[0].SupplierIndicator) { var suppResponse = _supplierService.GetSupplierDetails(bp.InternalID); response.AccountDetails.SupplierDetails = suppResponse.SupplierDetails != null ? suppResponse.SupplierDetails : new AccountTypeDetails(); response.AccountDetails.AccountTypes.Add("supplier"); } } BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; return(response); }
public SalesOrderDetailsResponse ParseSapQueryResponse(SalesOrderByElementsResponseMessage_sync sapResponse) { SalesOrderDetailsResponse response = new SalesOrderDetailsResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.SalesOrder != null) { response.SalesOrderExternalId = sapResponse.SalesOrder[0].ID.Value; } return(response); }
private BusinessPartnerResponse ParseSapManageResponse(BusinessPartnerBundleMaintainConfirmationMessage_sync sapResponse) { BusinessPartnerResponse response = new BusinessPartnerResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.BusinessPartner != null) { response.BpExternalId = sapResponse.BusinessPartner[0].InternalID; } return(response); }
public AccountHierarchyResponse SetAccountHierarchyManageResponse(BusinessPartnerHierarchyMaintainConfirmationMessage_sync sapResponse) { AccountHierarchyResponse response = new AccountHierarchyResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.BusinessPartnerHierarchy != null) { response.ParentId = sapResponse.BusinessPartnerHierarchy[0].ID.Value; response.ParentUUID = sapResponse.BusinessPartnerHierarchy[0].UUID.Value; } return(response); }
private MaterialResponse ParseQueryResponse(MaterialByElementsResponseMessage_sync sapMessage) { var res = new MaterialResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapMessage.Log); res.Errors = tempRes.Errors; res.Warnings = tempRes.Warnings; if (sapMessage.Material != null) { res.ExternalId = sapMessage.Material[0].InternalID.Value; } return(res); }
private MaterialResponse ParseMaterialValuationResponse(MaterialValuationDataMaintainConfirmationBundleMessage_sync sapMessage) { var res = new MaterialResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapMessage.Log); res.Errors = tempRes.Errors; res.Warnings = tempRes.Warnings; if (sapMessage.MaterialValuationData != null) { res.ExternalId = sapMessage.MaterialValuationData[0].MaterialInternalID.Value; } return(res); }
public QcInspectionResponse ParseSapQcInspectionRead(MaterialInspectionReadByIDResponseMessage_sync sapResponse) { QcInspectionResponse response = new QcInspectionResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; try { if (sapResponse.MaterialInspection != null) { response.ExternalId = sapResponse.MaterialInspection.ID.Value; if (sapResponse.MaterialInspection.IdentifiedStockKey != null) { response.InventoryId = sapResponse.MaterialInspection.IdentifiedStockKey.ID.Value; } if (sapResponse.MaterialInspection.InspectionQuantity != null) { response.InspectionQty = sapResponse.MaterialInspection.InspectionQuantity.Value; } if (sapResponse.MaterialInspection.Decision != null && sapResponse.MaterialInspection.Decision.AttachmentFolder != null && sapResponse.MaterialInspection.Decision.AttachmentFolder.Document != null) { var documents = sapResponse.MaterialInspection.Decision.AttachmentFolder.Document; var pdfDocument = documents.FirstOrDefault(x => x.CategoryCode == "3" && x.TypeCode != null && x.TypeCode.Value == "10001"); response.DocumentExternalId = (pdfDocument != null && pdfDocument.UUID != null) ? pdfDocument.UUID.Value : null; } } } catch (Exception e) { response.Errors.Add("Failed to parse Qc Inspection Read Response from Sap: " + e.Message); return(response); } return(response); }
public ProductSpecResponse ParseProductSpecResponse(PRSMaintainConfirmationBundleMessage_sync response) { ProductSpecResponse parsedResponse = new ProductSpecResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(response.Log); parsedResponse.Errors = tempRes.Errors; parsedResponse.Warnings = tempRes.Warnings; parsedResponse.ProductSpec = new List <ProductSpecObject>(); if (response.ProductRequirementSpecification != null) { foreach (var spec in response.ProductRequirementSpecification) { parsedResponse.ProductSpec.Add(new ProductSpecObject { ProductSpecId = spec.ID.Value, VersionUUID = spec.VersionUUID.Value }); } } return(parsedResponse); }
private BusinessPartnerResponse ParseSupplierQuery(SupplierByElementsResponseMessage sapResponse) { BusinessPartnerResponse response = new BusinessPartnerResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.Supplier != null) { response.BpExternalId = sapResponse.Supplier[0].InternalID; response.SupplierDetails = new AccountTypeDetails(); if (sapResponse.Supplier[0].PurchasingData != null) { response.SupplierDetails.CurrencyID = sapResponse.Supplier[0].PurchasingData.PurchaseOrderCurrencyCode; response.SupplierDetails.PaymentTermID = sapResponse.Supplier[0].PurchasingData.CashDiscountTermsCode != null ? sapResponse.Supplier[0].PurchasingData.CashDiscountTermsCode.Value : null; } } return(response); }
public PurchaseOrderResponse ParseSapManageResponse(PurchaseOrderMaintainConfirmationBundleMessage_sync sapResponse, List <PurchaseOrderLine> lines) { PurchaseOrderResponse response = new PurchaseOrderResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.PurchaseOrder != null) { response.ExternalId = sapResponse.PurchaseOrder[0].BusinessTransactionDocumentID.Value; } response.Items = new List <PairedIdsResponse>(); foreach (var line in lines) { response.Items.Add(new PairedIdsResponse { LocalId = line.ItemDetails.Id, ExternalId = line.ItemDetails.ExternalId }); } return(response); }
public SalesOrderDetailsResponse ParseSapManageResponse(SalesOrderMaintainConfirmationBundleMessage_sync sapResponse, SalesOrderDetailsRequest salesOrder = null) { SalesOrderDetailsResponse response = new SalesOrderDetailsResponse(); BaseResponse tempRes = SapLogParser.ParseSapResponseLog(sapResponse.Log); response.Errors = tempRes.Errors; response.Warnings = tempRes.Warnings; if (sapResponse.SalesOrder != null) { response.SalesOrderExternalId = sapResponse.SalesOrder[0].ID.Value; } if (salesOrder != null && salesOrder.SOLines.Count > 0) { response.Lines = new List <ItemProductSpecs>(); foreach (var line in salesOrder.SOLines) { string trimmedProdSpec = line.ProductSpec; trimmedProdSpec = trimmedProdSpec.TrimStart('0'); response.Lines.Add(new ItemProductSpecs { LineNum = line.LineNum, ProductSpec = trimmedProdSpec }); } response.Items = new List <PairedIdsResponse>(); foreach (var line in salesOrder.SOLines) { response.Items.Add(new PairedIdsResponse { LocalId = line.ItemDetails.Id, ExternalId = line.ItemDetails.ExternalId }); } } return(response); }