/// <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
        }
Exemplo n.º 2
0
        // *************************************
        // URL: /Member/Dashboard
        // *************************************
        public ActionResult Dashboard(string id)
        {
            #region
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            if (memberData == null)
                return RedirectToAction("Default", "Member");

            SeedAction objSeed = new SeedAction();

            IList<Seed> tempPlanted = objSeed.GetSeedsByUser(memberData.id.ToString()).Where(x => x.parentSeedID == null).ToList();
            IList<Seed> tempCommented = objSeed.GetAllSeedsCommentedByMe(memberData.id.ToString());
            tempCommented = tempCommented.Where(x => x.ownerId != memberData.id).ToList();
            IList<Seed> tempReply = objSeed.GetAllReplySeedsbyMember(memberData.id.ToString());
            var tempCmtReply = tempCommented.Union(tempReply);
            IList<Seed> tempFavSeeds = objSeed.GetAllFavouriteSeeds(memberData.id.ToString());

            string replySeedCount = objSeed.GetReplySeedCountbyOwnerId(memberData.id.ToString());

            if (!string.IsNullOrEmpty(id))
            {
                if (id == "Date")
                    tempPlanted = tempPlanted.OrderByDescending(x => x.createDate).ToList();

                if (id == "Category")
                    tempPlanted = tempPlanted.OrderBy(x => x.Categories.FirstOrDefault() != null ? x.Categories.FirstOrDefault().name : "").ToList();

                if (id == "Likes")
                    tempPlanted = tempPlanted.OrderByDescending(x => x.Ratings.ToList().Count).ToList();

                if (id == "Comments")
                    tempPlanted = tempPlanted.OrderByDescending(x => x.Comments.ToList().Count).ToList();

                if (id == "SeedReply")
                    tempPlanted = tempPlanted.OrderByDescending(x => x.Seed1.ToList().Count).ToList();
            }

            ViewData["MyPlantedSeeds"] = tempPlanted;
            ViewData["PlantedSeedCount"] = tempPlanted.Count();

            ViewData["MyCommentsAndReply"] = (from gs in tempCmtReply select gs).OrderByDescending(x => x.createDate).Distinct().ToList();
            ViewData["CommentsAndReplyCount"] = (from gs in tempCmtReply select gs).OrderByDescending(x => x.createDate).Distinct().ToList().Count();

            ViewData["MyFavSeeds"] = tempFavSeeds;
            ViewData["FavSeedsCount"] = tempFavSeeds.Count();

            SessionStore.SetSessionValue(SessionStore.MySeeds, tempPlanted);

            string[] dashboardCount = new string[4];
            int tmpPlant = tempPlanted.Count();
            int cmtReply = (from gs in tempCmtReply select gs).OrderByDescending(x => x.createDate).Distinct().ToList().Count();
            int fav = tempFavSeeds.Count();
            int MySeedsCount = tmpPlant + cmtReply + fav;
            dashboardCount[0] = MySeedsCount.ToString();

            StreamAction objStream = new StreamAction();
            IList<ssStream> lstStream = objStream.GetAllStreams(memberData.id.ToString());
            dashboardCount[1] = lstStream.Count().ToString();

            MemberAction objMember = new MemberAction();
            IList<Member> followingMemberList = objMember.GetFollowing(memberData.id.ToString());
            dashboardCount[2] = followingMemberList.Count().ToString();

            IList<Seed> lstNearestSeeds = getNewestNearby("15");
            dashboardCount[3] = lstNearestSeeds.Count().ToString();

            SessionStore.SetSessionValue(SessionStore.DashboardCount, dashboardCount);

            ViewData["SelectedIndex"] = 0;
            if (Request.QueryString["gridCmtReply-page"] != null)
                ViewData["SelectedIndex"] = 1;
            if (Request.QueryString["gridFavs-page"] != null)
                ViewData["SelectedIndex"] = 2;

            return View();
            #endregion
        }
Exemplo n.º 3
0
 private void GetGrowingSeeds()
 {
     SeedAction objSeed = new SeedAction();
     Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
     IList<Seed> tempList1 = objSeed.GetAllSeedsByStatus(memberData.id.ToString(), SystemStatements.STATUS_GROWING);
     IList<Seed> tempList2 = objSeed.GetAllSeedsCommentedByMe(memberData.id.ToString());
     var tempList3 = tempList1.Union(tempList2);
     IList<Seed> ListGrowingSeeds = (from gs in tempList3 select gs).OrderByDescending(x => x.createDate).Distinct().ToList();
     ViewData["GrowingSeeds"] = ListGrowingSeeds;
 }