/// <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 ListSeed() { #region Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject); if (memberData == null) return RedirectToAction("Default", "Member"); SeedAction objSeed = new SeedAction(); LocationAction objLocation = new LocationAction(); IList<Location> locData = objLocation.GetLocationByMemberId(memberData.id.ToString()); List<Seed> currentSeedList = new List<Seed>(); if (locData != null) { foreach (Location tempLocation in locData) { IList<Seed> seedList = objSeed.GetSeedByLocationId(tempLocation.id.ToString()); foreach (Seed seedData in seedList) { if (seedData.status == SystemStatements.STATUS_NEW || seedData.status == SystemStatements.STATUS_GROWING) currentSeedList.Add(seedData); } } } ViewData["ListSeed"] = currentSeedList; return View(); #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 }