/// <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); }
/// <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); }
/// <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; }
/// <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; }