/// <summary> /// Method to get all seeds by member location. /// </summary> /// <param name="MemberId"></param> /// <returns></returns> public string GetSeedByMemberLocation(string MemberId) { #region SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); string returnList = ""; IList<Location> locData = objLocation.GetLocationByMemberId(MemberId); Location memberLocation = objLocation.GetMemberLocationById(MemberId); if (memberLocation == null) { memberLocation = new Location(); memberLocation.localLong = -112.0740373; memberLocation.localLat = 33.4483771; } IList<Seed> tempList1 = objSeed.GetSeedsByUser(MemberId).ToList(); IList<Seed> tempList2 = objSeed.GetAllSeedsCommentedByMe(MemberId); var tempList3 = tempList1.Union(tempList2); IList<Seed> listSeed = (from gs in tempList3 select gs).OrderByDescending(x => x.createDate).Distinct().ToList(); List<Seed> currentSeedList = new List<Seed>(); if (locData == null) { returnList = "33.4483771,-112.0740373"; } else { foreach (Location tempLocation in locData) { IList<Seed> seedList = objSeed.GetSeedByLocationId(tempLocation.id.ToString()); foreach (Seed seedData in seedList) { returnList += "," + tempLocation.localLat.ToString() + "," + tempLocation.localLong.ToString(); } } if (returnList.Length == 0) { returnList = "33.4483771,-112.0740373"; } else { returnList = returnList.Substring(1); } } return returnList; #endregion }
public ActionResult SortDBData(string id) { #region Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject); LocationAction objLocation = new LocationAction(); Location memberLocation = objLocation.GetMemberLocationById(memberData.id.ToString()); if (memberLocation == null) { memberLocation = new Location(); memberLocation.localLong = SystemStatements.DEFAULT_Long; memberLocation.localLat = SystemStatements.DEFAULT_Lat; } ViewData["Memberlocation"] = memberLocation; IList<Seed> listSeed = null; if (SessionStore.GetSessionValue(SessionStore.MySeeds) != null) listSeed = (IList<Seed>)SessionStore.GetSessionValue(SessionStore.MySeeds); if (listSeed.Count > 0) { switch (id) { case "Proximity": //listSeed = ProximitySort(); //ViewData["StreamSeedList"] = listSeed; break; case "Date": listSeed.OrderByDescending(x => x.createDate).ToList(); break; case "Category": listSeed.OrderBy(x => x.Categories.FirstOrDefault() != null ? x.Categories.FirstOrDefault().name : "").ToList(); break; case "Likes": listSeed.OrderByDescending(x => x.Ratings.ToList().Count).ToList(); break; case "Comments": listSeed.OrderByDescending(x => x.Comments.ToList().Count).ToList(); break; case "SeedReplies": listSeed.OrderByDescending(x => x.Seed1.ToList().Count).ToList(); break; default: listSeed.OrderByDescending(x => x.createDate).ToList(); break; } } ViewData["ListSeed"] = listSeed; string markerList = ""; foreach (Seed s1 in listSeed) { if (s1.Location.localLat != null && s1.Location.localLong != null) { //if (string.IsNullOrEmpty(markerList)) // markerList = s1.Location.localLat + "," + s1.Location.localLong; //else // markerList += "," + s1.Location.localLat + "," + s1.Location.localLong; markerList += s1.Location.localLat + "," + s1.Location.localLong + "," + s1.title + "-<b>" + s1.status + "</b> <br />" + s1.Location.City.name + " " + s1.Location.zipcode + ","; } } ViewData["LocationData"] = markerList; return View("Dashboard"); #endregion }
public void miniDashboard() { #region SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject); IList<Location> locData = objLocation.GetLocationByMemberId(memberData.id.ToString()); Location memberLocation = objLocation.GetMemberLocationById(memberData.id.ToString()); if (memberLocation == null) { memberLocation = new Location(); memberLocation.localLong = SystemStatements.DEFAULT_Long; memberLocation.localLat = SystemStatements.DEFAULT_Lat; } IList<Seed> listSeed = objSeed.GetSeedsByUser(memberData.id.ToString()).ToList(); string locations = ""; if (locData == null) { locations = SystemStatements.DEFAULT_Lat + "," + SystemStatements.DEFAULT_Long; } else { int counter = 0; foreach (Location tempLocation in locData) { if (counter == 10) { break; } locations += tempLocation.localLat + "," + tempLocation.localLong + ","; counter++; } locations = locations.Substring(0, locations.Length - 1); } ViewData["ListSeed"] = listSeed; ViewData["LocationData"] = locations; ViewData["Memberlocation"] = memberLocation; #endregion }