Ejemplo n.º 1
0
        /// <summary>
        /// Returns a the description of some account
        /// Review if the list of donors exists in a cache var and make the queries over this object else
        /// call the interface method
        /// See the comments of the implemented method named Search in ApiServiceDonors for more
        /// information.
        /// </summary>
        /// <param name="id">Account id to make the select query where account_id=id and recive a single object</param>
        /// <returns>Donor account object</returns>
        public static WipService.account GetAccount(string id)
        {
            MPXMobile.WipService.getAccountsResponse cache = (MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors");
            if (cache == null)
            {
                ApiServiceDonors x = new ApiServiceDonors();
                x.Search();
            }
            var donor = ((MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors")).accounts.Where(x => x.accountId.ToString() == id).Single();

            return(donor);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Review if the list of donors exists in cache
        /// if exists the query will be done over the list
        /// else loads the cache list using the interface method
        /// See the comments of the implemented method named Search in ApiServiceDonors for more
        /// information.
        /// </summary>
        /// <param name="keyword">Search keyword parameter</param>
        /// <returns>Returns a list of accounts filtred by keyword</returns>
        public static List <MPXMobile.WipService.account> SearchDonors(string keyword)
        {
            List <MPXMobile.WipService.account> accountsFilter;

            MPXMobile.WipService.getAccountsResponse cache = (MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors");
            if (cache == null)
            {
                ApiServiceDonors x = new ApiServiceDonors();
                x.Search();
            }

            accountsFilter = ((MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors")).accounts.Where(x => x.lastName.ToLower().Contains(keyword.ToLower()) || x.defaultEmailAddress.ToLower().Contains(keyword.ToLower()) ||
                                                                                                                        x.firstName.ToLower().Contains(keyword.ToLower())).ToList <MPXMobile.WipService.account>();
            Models.Util.SaveAction(Util.Actions.SearchFor.ToString() + keyword);
            return(accountsFilter);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns a the description of some account
 /// Review if the list of donors exists in a cache var and make the queries over this object else
 /// call the interface method 
 /// See the comments of the implemented method named Search in ApiServiceDonors for more
 /// information.
 /// </summary>
 /// <param name="id">Account id to make the select query where account_id=id and recive a single object</param>
 /// <returns>Donor account object</returns>
 public static WipService.account GetAccount(string id)
 {
     MPXMobile.WipService.getAccountsResponse cache = (MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors");
     if (cache == null)
     {
         ApiServiceDonors x = new ApiServiceDonors();
         x.Search();
     }
     var donor = ((MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors")).accounts.Where(x => x.accountId.ToString() == id).Single();
     return donor;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Review if the list of donors exists in cache
        /// if exists the query will be done over the list
        /// else loads the cache list using the interface method
        /// See the comments of the implemented method named Search in ApiServiceDonors for more
        /// information.
        /// </summary>
        /// <param name="keyword">Search keyword parameter</param>
        /// <returns>Returns a list of accounts filtred by keyword</returns>
        public static List<MPXMobile.WipService.account> SearchDonors(string keyword)
        {
            List<MPXMobile.WipService.account> accountsFilter;
            MPXMobile.WipService.getAccountsResponse cache = (MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors");
            if (cache == null)
            {
                ApiServiceDonors x = new ApiServiceDonors();
                x.Search();
            }

            accountsFilter = ((MPXMobile.WipService.getAccountsResponse)HttpRuntime.Cache.Get("donors")).accounts.Where(x => x.lastName.ToLower().Contains(keyword.ToLower()) || x.defaultEmailAddress.ToLower().Contains(keyword.ToLower())
                                           || x.firstName.ToLower().Contains(keyword.ToLower())).ToList<MPXMobile.WipService.account>();
            Models.Util.SaveAction(Util.Actions.SearchFor.ToString() + keyword);
            return accountsFilter;
        }