/// <summary> /// Connects to the interface and attempts to apply the query. /// See the comments of the implemented method named BookmarkedByUser in ApiServiceDonors for more /// information. /// Save the action in db using Util.cs /// </summary> /// <param name="idUser">User Id passed by reference to provide the param to know who is the user to search by id in db</param> /// <returns>A list of Bookmarked donors by user</returns> public static List <BookmarkedDonor> BookmarkedByUser(string idUser) { ApiServiceDonors x = new ApiServiceDonors(); Models.Util.SaveAction(Util.Actions.GetBookmarkedDonors.ToString()); return(x.BookmarkedByUser(idUser)); }
/// <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> /// Save donors in db by userId /// Save the user actions /// See the comments of the implemented method named BookmarkDonor in ApiServiceDonors for more /// information. /// </summary> /// <param name="bookmark">Recive an BookmarkedDonor object</param> /// <returns>If the transaction has been succeced or not</returns> public static bool BookmarkDonor(BookmarkedDonor bookmark) { ApiServiceDonors x = new ApiServiceDonors(); var list=x.BookmarkedByUser(bookmark.User_ID.ToString()); var verify=list.Where(r=> r.Donor_ID ==bookmark.Donor_ID); if (verify.Count() == 0) { var donor = x.BookmarkDonor(bookmark); Models.Util.SaveAction(Util.Actions.BookMarked + ":" + bookmark.Donor_ID + " status:" + donor.ToString() + ""); return donor; } return false; }
/// <summary> /// Save donors in db by userId /// Save the user actions /// See the comments of the implemented method named BookmarkDonor in ApiServiceDonors for more /// information. /// </summary> /// <param name="bookmark">Recive an BookmarkedDonor object</param> /// <returns>If the transaction has been succeced or not</returns> public static bool BookmarkDonor(BookmarkedDonor bookmark) { ApiServiceDonors x = new ApiServiceDonors(); var list = x.BookmarkedByUser(bookmark.User_ID.ToString()); var verify = list.Where(r => r.Donor_ID == bookmark.Donor_ID); if (verify.Count() == 0) { var donor = x.BookmarkDonor(bookmark); Models.Util.SaveAction(Util.Actions.BookMarked + ":" + bookmark.Donor_ID + " status:" + donor.ToString() + ""); return(donor); } return(false); }
/// <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> /// Load and returns list of recently Donors using the interface method /// See the comments of the implemented method named RecentlyDonors in ApiServiceDonors for more /// information. /// </summary> /// <param name="id">Recive the account information of the most recent donor and save it in the list of recent donors</param> /// <returns>List of recently donors</returns> public static List <MPXMobile.WipService.account> Recently_Donors(WipService.account account) { ApiServiceDonors x = new ApiServiceDonors(); return(x.RecentlyDonors(account)); }
/// <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> /// Connects to the interface and attempts to apply the query. /// See the comments of the implemented method named BookmarkedByUser in ApiServiceDonors for more /// information. /// Save the action in db using Util.cs /// </summary> /// <param name="idUser">User Id passed by reference to provide the param to know who is the user to search by id in db</param> /// <returns>A list of Bookmarked donors by user</returns> public static List<BookmarkedDonor> BookmarkedByUser(string idUser) { ApiServiceDonors x = new ApiServiceDonors(); Models.Util.SaveAction(Util.Actions.GetBookmarkedDonors.ToString()); return x.BookmarkedByUser(idUser); }
/// <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> /// Load and returns list of recently Donors using the interface method /// See the comments of the implemented method named RecentlyDonors in ApiServiceDonors for more /// information. /// </summary> /// <param name="id">Recive the account information of the most recent donor and save it in the list of recent donors</param> /// <returns>List of recently donors</returns> public static List<MPXMobile.WipService.account> Recently_Donors(WipService.account account) { ApiServiceDonors x = new ApiServiceDonors(); return x.RecentlyDonors(account); }
public HomeController() { Service = new ApiServiceDonors(); GiftService = new ApiServiceGifts(); }