Skip to content

Commit

Permalink
client side: featured items, recently posted - apts - around you, als…
Browse files Browse the repository at this point in the history
…o fixed order
  • Loading branch information
Martikos committed Apr 24, 2013
1 parent 5961dfb commit 20d3b45
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Views/Layout.master
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<ul class="menu" id="menu" runat="server">
<li><asp:LinkButton ID="nav_search" runat="server" OnClick="go_search">n</asp:LinkButton></li>
<li><asp:LinkButton ID="nav_post" runat="server" OnClick="go_post">â</asp:LinkButton></li>
<li><asp:LinkButton ID="nav_profile" runat="server" OnClick="go_profile">l</asp:LinkButton></li>
<li><asp:LinkButton ID="nav_profile" runat="server" OnClick="go_profile">Ü</asp:LinkButton></li>
<li><asp:LinkButton ID="nav_notifications" runat="server" OnClick="go_notifications">h</asp:LinkButton></li>
</ul>
</nav>
Expand Down
46 changes: 25 additions & 21 deletions Views/Search.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,45 +101,49 @@ private void putRecentlyListings()
/* get recently posted listings from database */
returnList = ListingDataService.getRecentListings(3);



featured1.InnerHtml = "<span> Recently Posted Items</span>";
foreach (Listing listing in returnList)
featured1.InnerHtml += createFeaturedItemDiv(listing);
for (int i = returnList.Count - 1; i >= 0; i--)
{
featured1.InnerHtml += createFeaturedItemDiv(returnList[i]);
}
}

private void putRecentApts()
{
List<Listing> returnList = new List<Listing>();
// Guid guid = new Guid("12345678-1234-1234-1234-123456789123");
// returnList.Add(new Listing(guid, "something", "description for something", 100, "place of something", DateTime.Now));

/* get recently posted appartments and rooms from database */
string[] tagslist = {"appartment"};
string[] tagslist = {"apt"};
foreach (string tag in tagslist)
returnList.AddRange(searchWithTag(tag));

featured2.InnerHtml = "<span> Nearby Appartments</span>";
foreach (Listing listing in returnList)
featured2.InnerHtml += createFeaturedItemDiv(listing);
featured2.InnerHtml = "<span>Nearby Appartments</span>";
for (int i = returnList.Count - 1; i >= 0; i--)
{
featured2.InnerHtml += createFeaturedItemDiv(returnList[i]);
}
}

private void putHighlights()
{
List<Listing> returnList = new List<Listing>();
//Guid guid = new Guid("12345678-1234-1234-1234-123456789123");
//returnList.Add(new Listing(guid, "something", "description for something", 100, "place of something", DateTime.Now));

string[] tagslist = { "gadget"};
foreach (string tag in tagslist)
returnList.AddRange(searchWithTag(tag));

returnList = returnList.Distinct().ToList();
/* defaults to showing listings around boston */
String location = "boston";
if (User.Identity.IsAuthenticated)
{
MembershipUser user = Membership.GetUser();
Guid userId = (Guid)user.ProviderUserKey;
location = UserDataService.getUser(userId).location;
}

returnList = ListingDataService.getListingsBy("Location", location, 5);

/* get most viewed items from database */
featured3.InnerHtml = "<span> Electronics / Gadgets </span>";
foreach (Listing listing in returnList)
featured3.InnerHtml += createFeaturedItemDiv(listing);
featured3.InnerHtml = "<span> Around You </span>";
for (int i = returnList.Count - 1; i >= 0; i--)
{
featured3.InnerHtml += createFeaturedItemDiv(returnList[i]);
}
}

private void getFeatured()
Expand Down

0 comments on commit 20d3b45

Please sign in to comment.