private AMCustomer.AMRegistration GetAuctionSummary(JToken result) { var AMAuctionSummaryRecord = new AMCustomer.AMRegistration(); AMAuctionSummaryRecord.Customer_id = Convert.ToString(result.SelectToken("customer_id")); AMAuctionSummaryRecord.Paddle = Convert.ToString(result.SelectToken("paddle")); AMAuctionSummaryRecord.Created_at = Convert.ToString(result.SelectToken("created_at")); var amAddress = result.SelectToken("customer").SelectToken("addresses"); var AMCustomerResult = new AMCustomer.AMCustomer { Addresses = new List <AMCustomer.AMAddress>() }; foreach (var address in amAddress) { var addressresult = new AMCustomer.AMAddress { Country_code = Convert.ToString(address.SelectToken("country_code")), Locality = Convert.ToString(address.SelectToken("locality")), Postal_code = Convert.ToString(address.SelectToken("postal_code")), Region = Convert.ToString(address.SelectToken("region")), Street_address = Convert.ToString(address.SelectToken("street_address")), Type = Convert.ToString(address.SelectToken("type")) }; AMCustomerResult.Addresses.Add(addressresult); } AMAuctionSummaryRecord.Customer = AMCustomerResult; return(AMAuctionSummaryRecord); }
// Add Registration details to Customer subTab private string UpdateCustomerRecordRegistration(string auctionInternalId, SuiteContact suiteContact, string paddle, string startDate, string auctionName, string auctionType, string auctionTimeZone, string auctionViewingInfo, string auctionCurrencyCode, string auctionCity, AMCustomer.AMCustomer amCustomer, string logId) { try { if (auctionInternalId != "" && suiteContact.Id != "") { var suiteCustomerAddressRecord = GetSuiteAddressCount(suiteContact.Id, logId); //create address subrecord if (amCustomer.Addresses.Count() > 0 && suiteCustomerAddressRecord == 0) { foreach (var amAddress in amCustomer.Addresses) { InsertSuiteAddress(amAddress, suiteContact, logId); } } } if (CheckForAuctionAvailability(auctionInternalId, logId)) { var recordID = CheckForRegistration(auctionInternalId, suiteContact, paddle, auctionName, logId); return(recordID); } } catch (Exception ex) { SuiteWrapper.WriteTraceLog("UpdateCustomerRecordRegistration", "Error Message : " + ex.Message); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Error : " + ex.Message, Name = "UpdateCustomerRecordRegistration", Entity_c = "Registration" }, logId); } return(""); }