public Response GetMyOpportunityResponses(int contactId, int opportunityId) { var searchString = ",,,," + contactId; var subpageViewRecords = MinistryPlatformService.GetSubpageViewRecords(_contactOpportunityResponses, opportunityId, ApiLogin(), searchString); var list = subpageViewRecords.ToList(); var s = list.SingleOrDefault(); if (s == null) { return null; } var response = new Response { Opportunity_ID = (int) s["Opportunity ID"], Participant_ID = (int) s["Participant ID"], Response_Date = (DateTime) s["Response Date"], Response_Result_ID = (int?) s["Response Result ID"] }; return response; }
public Response GetOpportunityResponse(int contactId, int opportunityId) { var searchString = ",,,," + contactId; var subpageViewRecords = _ministryPlatformService.GetSubpageViewRecords(_contactOpportunityResponses, opportunityId, ApiLogin(), searchString); var record = subpageViewRecords.ToList().SingleOrDefault(); if (record == null) { return null; } var response = new Response(); response.Response_ID = record.ToInt("dp_RecordID"); response.Opportunity_ID = record.ToInt("Opportunity ID"); response.Participant_ID = record.ToInt("Participant ID"); response.Response_Date = record.ToDate("Response Date"); response.Response_Result_ID = record.ToNullableInt("Response Result ID"); return response; }
public List<Response> GetOpportunityResponses(int opportunityId, string token) { var records = _ministryPlatformService.GetSubpageViewRecords(_signedupToServeSubPageViewId, opportunityId, token, ""); var responses = new List<Response>(); foreach (var r in records) { var response = new Response(); response.Event_ID = r.ToInt("Event_ID"); responses.Add(response); } return responses; }
public Response GetOpportunityResponse(int opportunityId, int eventId, Participant participant) { var searchString = string.Format(",{0},{1},{2}", opportunityId, eventId, participant.ParticipantId); List<Dictionary<string, object>> dictionaryList; try { dictionaryList = WithApiLogin( apiToken => (_ministryPlatformService.GetPageViewRecords("ResponseByOpportunityAndEvent", apiToken, searchString, "", 0))); } catch (Exception ex) { throw new ApplicationException( string.Format( "GetOpportunityResponse failed. Participant Id: {0}, Opportunity Id: {1}, Event Id: {2}", participant, opportunityId, eventId), ex.InnerException); } if (dictionaryList.Count == 0) { return new Response(); } var response = new Response(); try { var dictionary = dictionaryList.First(); response.Response_ID = dictionary.ToInt("dp_RecordID"); response.Opportunity_ID = dictionary.ToInt("Opportunity_ID"); response.Participant_ID = dictionary.ToInt("Participant_ID"); response.Response_Result_ID = dictionary.ToInt("Response_Result_ID"); } catch (InvalidOperationException ex) { throw new ApplicationException( string.Format("RespondToOpportunity failed. Participant Id: {0}, Opportunity Id: {1}", participant, opportunityId), ex.InnerException); } return response; }