Ejemplo n.º 1
0
        public static string GetStates(string token)
        {
            var mpObject = MinistryPlatformService.GetRecords(Convert.ToInt32(ConfigurationManager.AppSettings["States"]), token);
            var json     = MPFormatConversion.MPFormatToJson(mpObject);

            return(json.ToString());
        }
Ejemplo n.º 2
0
        public List <Dictionary <string, object> > GetSubPageRecords(int subPageId, int recordId, String token)
        {
            SelectQueryResult result = Call <SelectQueryResult>(token,
                                                                platformClient => platformClient.GetSubpageRecords(subPageId, recordId, string.Empty, string.Empty, 0));

            return(MPFormatConversion.MPFormatToList(result));
        }
Ejemplo n.º 3
0
        public List <Dictionary <string, object> > GetPageViewRecords(string viewKey, string token, string searchString = "", string sort = "",
                                                                      int top = 0)
        {
            var result = Call <SelectQueryResult>(token,
                                                  platformClient => platformClient.GetPageViewRecords(GetMinistryPlatformId(viewKey), searchString, sort, top));

            return(MPFormatConversion.MPFormatToList(result));
        }
Ejemplo n.º 4
0
        public List <Dictionary <string, object> > GetSubpageViewRecords(int viewId, int recordId,
                                                                         string token, string searchString = "", string sort = "", int top = 0)
        {
            var result = Call <SelectQueryResult>(token,
                                                  platformClient => platformClient.GetSubpageViewRecords(viewId, recordId, searchString, sort, top));

            return(MPFormatConversion.MPFormatToList(result));
        }
Ejemplo n.º 5
0
        public Dictionary <string, object> GetSubPageRecord(string subPageKey, int recordId, String token)
        {
            var subPageId = GetMinistryPlatformId(subPageKey);
            var result    = Call <SelectQueryResult>(token,
                                                     platformClient => platformClient.GetSubpageRecord(subPageId, recordId, false));

            return(MPFormatConversion.MPFormatToDictionary(result));
        }
Ejemplo n.º 6
0
        public List <MpInvitation> GetInvitations(int sourceId, int invitationTypeId)
        {
            var mpInvitations = new List <MpInvitation>();

            try
            {
                var searchString = $",,,\"{invitationTypeId}\",\"{sourceId}\",,false";
                var mpResults    = _ministryPlatformService.GetRecords(_invitationPageId, ApiLogin(), searchString, string.Empty);
                var invitations  = MPFormatConversion.MPFormatToList(mpResults);

                // Translate object format from MP to an MpInvitaion object
                if (invitations != null && invitations.Count > 0)
                {
                    mpInvitations.AddRange(
                        invitations.Select(
                            p =>
                            new MpInvitation
                    {
                        SourceId       = p.ToInt("Source_ID"),
                        EmailAddress   = p.ToString("Email_address"),
                        GroupRoleId    = p.ToInt("Group_Role_ID"),
                        InvitationType = p.ToInt("Invitation_Type_ID"),
                        RecipientName  = p.ToString("Recipient_Name"),
                        RequestDate    = p.ToDate("Invitation_Date")
                    }));
                }
                else
                {
                    _logger.Debug($"No pending invitations found for SourceId = {sourceId}, InvitationTypeId = {invitationTypeId} ");
                }
            }
            catch (Exception exception)
            {
                _logger.Debug($"Exception thrown while retrieving invitations for SourceId = {sourceId}, InvitationTypeId = {invitationTypeId} ");
                _logger.Debug($"Exception message:  {exception.Message} ");
            }
            return(mpInvitations);
        }
Ejemplo n.º 7
0
 public List <Dictionary <string, object> > GetSelectionsDict(int selectionId, String token, String search = "", String sort = "")
 {
     return(MPFormatConversion.MPFormatToList(GetSelectionRecords(selectionId, token, search, sort)));
 }
Ejemplo n.º 8
0
 public List <Dictionary <string, object> > GetRecordsDict(string pageKey, String token, String search = "", String sort = "")
 {
     return(MPFormatConversion.MPFormatToList(GetRecords(GetMinistryPlatformId(pageKey), token, search, sort)));
 }
Ejemplo n.º 9
0
 public JArray GetRecordsArr(int pageId, String token, String search = "", String sort = "")
 {
     return(MPFormatConversion.MPFormatToJson(GetRecords(pageId, token, search, sort)));
 }
Ejemplo n.º 10
0
 public Dictionary <string, object> GetLookupRecord(String token, int pageId, string search, string sort, int maxNumberOfRecordsToReturn = 100)
 {
     return(MPFormatConversion.MPFormatToDictionary(GetPageLookupRecords(token, pageId, search, sort, maxNumberOfRecordsToReturn)));
 }
Ejemplo n.º 11
0
 public List <Dictionary <string, object> > GetLookupRecords(int pageId, String token)
 {
     return(MPFormatConversion.MPFormatToList(GetPageLookupRecords(token, pageId, string.Empty, string.Empty, 0)));
 }
Ejemplo n.º 12
0
 public Dictionary <string, object> GetRecordDict(int pageId, int recordId, String token, bool quickadd = false)
 {
     return(MPFormatConversion.MPFormatToDictionary(GetRecord(pageId, recordId, token, quickadd)));
 }
Ejemplo n.º 13
0
 public JArray GetRecordArr(int pageId, int recordId, String token, bool quickadd = false)
 {
     return(MPFormatConversion.MPFormatToJson(GetRecord(pageId, recordId, token, quickadd)));
 }
Ejemplo n.º 14
0
 public static List <Dictionary <string, object> > GetRecordsDict(int pageId, String token, String search = "",
                                                                  String sort = "")
 {
     return(MPFormatConversion.MPFormatToList(GetRecords(pageId, token, search, sort)));
 }