public GetListofAMRegistrationResponse GetListofAMRegistration(string logId) { SuiteWrapper.WriteTraceLog("GetRegistration", "---------------- REGISTRATION SYNC START ------------------------- "); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Registration sync started", Name = "GetRegistration", Entity_c = "Registration" }, logId); var amWrapper = new AMWrapper(); var ret = new GetListofAMRegistrationResponse(); try { var req = new ReadEntryListRequest(); req.AccessToken = amWrapper.apiAccessToken; req.ModuleName = "auction"; var AMRegistration_List = amWrapper.GetAMList <AMCustomer.AMAuction>(req, $"{amWrapper.apiUrl}/v1/auction/upcoming").GetAwaiter().GetResult(); var result_page = JObject.Parse(AMRegistration_List).SelectToken("result_page"); var listOfUpcomingAuction = ReadAllAMAuctionUpcoming(result_page); ProcessSuiteRegistration(listOfUpcomingAuction, logId); var query_info = JObject.Parse(AMRegistration_List).SelectToken("query_info"); var next_page_url = string.Empty; foreach (var next_page in query_info.SelectTokens("next_page")) { next_page_url = next_page.ToString(); while (!string.IsNullOrEmpty(next_page_url)) { var jstr_Next = amWrapper.GetAMList <AMCustomer.AMAuction>(req, next_page_url).GetAwaiter().GetResult(); var result_page_Next = JObject.Parse(jstr_Next).SelectToken("result_page"); listOfUpcomingAuction = ReadAllAMAuctionUpcoming(result_page_Next); ProcessSuiteRegistration(listOfUpcomingAuction, logId); var query_info_Next = JObject.Parse(jstr_Next).SelectToken("query_info"); foreach (var next_page1 in query_info_Next.SelectTokens("next_page")) { next_page_url = string.Empty; next_page_url = next_page1.ToString(); } } } ret.StatusCode = AMAPI.ClsConstant.SuccessCode; ret.Message = AMAPI.ClsConstant.SuccessMessage; return(ret); } catch (Exception ex) { SuiteWrapper.WriteTraceLog("GetListofAMRegistration", "Error Message : " + ex.Message); ret.StatusCode = AMAPI.ClsConstant.ServerErrorCode; ret.Message = AMAPI.ClsConstant.ServerErrorMsg; return(ret); } }
// Get Auction registrations customer ID private List <AMCustomer.AMRegistration> GetAuctionRegistrationArray(string AuctionID, string LogId) { var amAuctionSummary = new List <AMCustomer.AMRegistration>(); var amWrapper = new AMWrapper(); var ret = new GetListofAMAuctionResponse(); var GetListofAMAuctionReq = new GetListofAMAuctionRequest(); ret.ReferenceID = GetListofAMAuctionReq.ReferenceID; try { var req = new ReadEntryListRequest(); req.AccessToken = req.AccessToken; req.ModuleName = "auction"; var list = amWrapper.GetAMList <AMCustomer.AMRegistration>(req, $"{amWrapper.apiUrl}/v2/admin/auction/" + AuctionID + "/registrations?fieldset=customer-addresses").GetAwaiter().GetResult(); var result_page = JObject.Parse(list).SelectToken("result_page"); foreach (var result in result_page) { amAuctionSummary.Add(GetAuctionSummary(result)); } var query_info = JObject.Parse(list).SelectToken("query_info"); var next_page_url = string.Empty; foreach (var next_page in query_info.SelectTokens("next_page")) { next_page_url = next_page.ToString(); while (!string.IsNullOrEmpty(next_page_url)) { var jstr_Next = amWrapper.GetAMList <AMCustomer.AMAuction>(req, next_page_url).GetAwaiter().GetResult(); var result_page_Next = JObject.Parse(jstr_Next).SelectToken("result_page"); foreach (var result in result_page) { amAuctionSummary.Add(GetAuctionSummary(result)); } var query_info_Next = JObject.Parse(jstr_Next).SelectToken("query_info"); foreach (var next_page1 in query_info_Next.SelectTokens("next_page")) { next_page_url = string.Empty; next_page_url = next_page1.ToString(); } } } } catch (Exception ex) { SuiteWrapper.WriteTraceLog("GetSuiteAddress", "Error : " + ex.Message); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Error Message : " + ex.Message, Name = "GetSuiteAddress", Entity_c = "Registration" }, LogId); } return(amAuctionSummary); }
private string GetAuctionIntegrationId(string aucId) { var amWrapper = new AMWrapper(); var ret = new GetListofAMAuctionResponse(); var getListofAMAuctionReq = new GetListofAMAuctionRequest(); ret.ReferenceID = getListofAMAuctionReq.ReferenceID; var aucIntId = string.Empty; try { var req = new ReadEntryListRequest(); req.AccessToken = req.AccessToken; req.ModuleName = "auction"; var auction_Details = amWrapper.GetAMList <AMCustomer.AMAuction>(req, $"{amWrapper.apiUrl}/v1/auction/" + aucId + "/").GetAwaiter().GetResult(); var result_page = JObject.Parse(auction_Details).SelectToken("response"); foreach (var result in result_page.SelectTokens("integration_id")) { aucIntId = result.ToString(); } } catch (Exception ex) { SuiteWrapper.WriteTraceLog("GetAuctionIntegrationId", "Error Message : " + ex.Message); } return(aucIntId); }
// Get Auction Summary private AMCustomer.AMAuctionSummary GetAuctionSummary(string auctionID, string logId) { var amWrapper = new AMWrapper(); var ret = new GetListofAMAuctionResponse(); var getListofAMAuctionReq = new GetListofAMAuctionRequest(); ret.ReferenceID = getListofAMAuctionReq.ReferenceID; try { var req = new ReadEntryListRequest(); req.AccessToken = req.AccessToken; req.ModuleName = "auction"; var auctionDetails = amWrapper.GetAMList <AMCustomer.AMAuction>(req, $"{amWrapper.apiUrl}/v1/auction/" + auctionID + "/summary").GetAwaiter().GetResult(); var result_page = JObject.Parse(auctionDetails).SelectToken("response"); var amAuctionSummaryRecord = new AMCustomer.AMAuctionSummary(); amAuctionSummaryRecord.Row_id = result_page.Value <string>("row_id"); amAuctionSummaryRecord.Auction_type = result_page.Value <string>("auction_type"); amAuctionSummaryRecord.Time_start = result_page.Value <string>("time_start"); amAuctionSummaryRecord.Timezone = result_page.Value <string>("timezone"); amAuctionSummaryRecord.Auction_code = result_page.Value <string>("auction_code"); amAuctionSummaryRecord.Title = result_page.Value <string>("title"); amAuctionSummaryRecord.Truncated_description = result_page.Value <string>("truncated_description"); amAuctionSummaryRecord.Viewing_information = result_page.Value <string>("viewing_information"); amAuctionSummaryRecord.Currency_code = result_page.Value <string>("currency_code"); amAuctionSummaryRecord.Location_name = result_page.Value <string>("location_name"); return(amAuctionSummaryRecord); } catch (Exception ex) { SuiteWrapper.WriteTraceLog("GetAuctionSummary", "Error : " + ex.Message); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Error : " + ex.Message, Name = "GetAuctionSummary", Entity_c = "Registration" }, logId); } return(null); }
public GetListofAMCustomerResponse GetListofAMCustomer(DateTime startDate, DateTime endDate, string logId) { SuiteWrapper.WriteTraceLog("GetCustomer", "---------------- CUSTOMER SYNC START ------------------------- "); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Customer sync started", Name = "GetCustomer", Entity_c = "Customer" }, logId); var amWrapper = new AMWrapper(); var ret = new GetListofAMCustomerResponse(); try { var request = new ReadEntryListRequest { AccessToken = amWrapper.apiAccessToken, ModuleName = "customer" }; var result_AMCustomers = amWrapper.GetAMList <AMCustomer.AMCustomer>(request, $"{amWrapper.apiUrl}/v2/admin/customer").GetAwaiter().GetResult(); var result_page = JObject.Parse(result_AMCustomers).SelectToken("result_page"); ReadAMContact(result_page, startDate, endDate, logId); var query_info = JObject.Parse(result_AMCustomers).SelectToken("query_info"); var next_page_url = string.Empty; foreach (var next_page in query_info.SelectTokens("next_page")) { next_page_url = next_page.ToString(); while (!string.IsNullOrEmpty(next_page_url)) { var jstr_Next = amWrapper.GetAMList <AMCustomer.AMCustomer>(request, next_page_url).GetAwaiter().GetResult(); var result_page_Next = JObject.Parse(jstr_Next).SelectToken("result_page"); ReadAMContact(result_page_Next, startDate, endDate, logId); var query_info_Next = JObject.Parse(jstr_Next).SelectToken("query_info"); foreach (var next_page1 in query_info_Next.SelectTokens("next_page")) { next_page_url = string.Empty; next_page_url = next_page1.ToString(); } } } ret.StatusCode = AMAPI.ClsConstant.SuccessCode; ret.Message = AMAPI.ClsConstant.SuccessMessage; return(ret); } catch (Exception ex) { SuiteWrapper.WriteTraceLog("GetListofAMCustomer", "Error Message : " + ex.Message); ret.StatusCode = AMAPI.ClsConstant.ServerErrorCode; ret.Message = AMAPI.ClsConstant.ServerErrorMsg; return(ret); } }