Пример #1
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
        }
Пример #2
0
        /// <summary>
        /// Get all seeds by member Id.
        /// </summary>
        /// <param name="MemberId"></param>
        /// <returns></returns>
        public IList<MemberSeeds> GetAllSeedsByMemberId(string MemberId, string counter)
        {
            IList<MemberSeeds> lstMemberSeeds = new List<MemberSeeds>();
            SeedAction objSeed = new SeedAction();

            int getCounter = Convert.ToInt32(counter) + 1;

            IList<Seed> seedData = (objSeed.GetSeedsByUser(MemberId)).Take(getCounter).OrderBy(x => x.createDate).ToList();

            //int i = 0;

            foreach (Seed s in seedData)
            {
                MemberSeeds objMemberSeed = new MemberSeeds();
                string imgPath = "No Image";
                objMemberSeed.SeedID = s.id.ToString();
                objMemberSeed.Title = s.title;
                if (s.Media != null && s.Media.Where(x => x.type.Equals("Image")).Count() > 0)
                {
                    imgPath = s.Media.Where(x => x.type.Equals("Image")).OrderByDescending(x => x.dateUploaded).FirstOrDefault().path;

                    imgPath = imgPath.Substring(imgPath.LastIndexOf('/'));

                    if (imgPath.Length > 1)
                    {

                        imgPath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia" + imgPath;
                    }
                    else
                    {
                        imgPath = "No Image";
                    }

                }
                objMemberSeed.Path = imgPath;
                if (s.Location.City != null)
                {
                    objMemberSeed.City = s.Location.City.name;
                }

                if (s.Location.City.Region != null)
                {
                    objMemberSeed.State = s.Location.City.Region.code;
                }

                if (s.Location != null)
                {
                    objMemberSeed.Zip = s.Location.zipcode;
                    objMemberSeed.Latitude = s.Location.localLat.ToString();
                    objMemberSeed.Longitude = s.Location.localLong.ToString();
                }
                objMemberSeed.CreateDate=s.createDate.ToString();
                lstMemberSeeds.Add(objMemberSeed);
            }

            //if (seedData.Count < 1)
            //{
            //    MemberSeeds objMemberSeed = new MemberSeeds();
            //    objMemberSeed.SeedID = "No Matching Seeds Found##No Matching Seeds Found";
            //    lstMemberSeeds.Add(objMemberSeed);
            //}

            return lstMemberSeeds;
        }
Пример #3
0
        public ActionResult UserDetail(string id)
        {
            #region
            Member memData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            if (memData != null)
            {
                if (Convert.ToString(memData.id) == id)
                    ViewData["ProfileView"] = "Self";
                else
                    ViewData["ProfileView"] = "Other";
            }
            MemberAction objMember = new MemberAction();
            Member memberData = objMember.GetMemberByMemberId(id);
            ViewData["MemberInfo"] = memberData;

            SeedAction objSeed = new SeedAction();
            IList<Seed> listSeed = objSeed.GetSeedsByUser(id).ToList();

            ViewData["ListSeed"] = listSeed;

            IList<Member> followerMemberList = objMember.GetFollowers(id);
            IList<Member> followingMemberList = objMember.GetFollowing(id);
            IList<Seed> seedList = objMember.GetFollowingActivity(id);
            ViewData["LatestActivity"] = seedList;
            ViewData["Following"] = followingMemberList;
            ViewData["Followers"] = followerMemberList;

            IList<Seed> FavSeeds = objSeed.GetAllFavouriteSeeds(id);
            ViewData["FavSeeds"] = FavSeeds;

            StreamAction objStream = new StreamAction();
            IList<ssStream> lstFeeds = objStream.GetAllStreams(id);
            IList<ssStream> lstMyFeeds = lstFeeds.Where(x => x.streamType.Equals(SystemStatements.STREAM_FEED)).OrderByDescending(x => x.createDate).ToList();
            IList<ssStream> lstMyLists = lstFeeds.Where(x => x.streamType.Equals(SystemStatements.STREAM_HANDPICKED)).OrderByDescending(x => x.createDate).ToList();

            ViewData["UserFeeds"] = lstMyFeeds;
            ViewData["UserLists"] = lstMyLists;

            IList<Seed> LatestActivity = objMember.GetFollowingActivity(id);
            ViewData["LatestActivity"] = LatestActivity;

            string[] counts = new string[7];
            counts[0] = Convert.ToString(listSeed.Count());
            counts[1] = Convert.ToString(FavSeeds.Count());
            counts[2] = Convert.ToString(followerMemberList.Count());
            counts[3] = Convert.ToString(lstMyFeeds.Count());
            counts[4] = Convert.ToString(lstMyLists.Count());
            counts[5] = Convert.ToString(followingMemberList.Count());
            counts[6] = Convert.ToString(LatestActivity.Count());
            ViewData["Counts"] = counts;

            ViewData["ParentTabSelectedIndex"] = 0;
            ViewData["ChildTabSelectedIndex"] = 0;
            if (Request.QueryString["PlantedSeedsgridbox-page"] != null)
                ViewData["ParentTabSelectedIndex"] = 0;
            if (Request.QueryString["Likesgridbox-page"] != null)
                ViewData["ParentTabSelectedIndex"] = 1;
            if (Request.QueryString["gridboxFeeds-page"] != null)
                ViewData["ParentTabSelectedIndex"] = 3;
            if (Request.QueryString["gridboxLists-page"] != null)
                ViewData["ParentTabSelectedIndex"] = 4;
            if (Request.QueryString["Following-page"] != null)
            {
                ViewData["ParentTabSelectedIndex"] = 2;
                ViewData["ChildTabSelectedIndex"] = 0;
            }
            if (Request.QueryString["Followers-page"] != null)
            {
                ViewData["ParentTabSelectedIndex"] = 2;
                ViewData["ChildTabSelectedIndex"] = 1;
            }
            if (Request.QueryString["LatestActivitygridbox-page"] != null)
            {
                ViewData["ParentTabSelectedIndex"] = 2;
                ViewData["ChildTabSelectedIndex"] = 2;
            }

            return View();
            #endregion
        }
        public ActionResult ListStreams(string id, string fid)
        {
            #region
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            if (memberData == null)
            {
                string universalURL = "http://" + (Request.ServerVariables["SERVER_NAME"] + Request.ServerVariables["URL"]).ToString();
                SessionStore.SetSessionValue("RequestedURL", universalURL);
                return RedirectToAction("Default", "Member");
            }
            StreamAction objStream = new StreamAction();
            IList<ssStream> lstStream = objStream.GetAllStreams(memberData.id.ToString());
            ViewData["Streams"] = new SelectList(lstStream, "Id", "Title");

            Repository repoObj = new Repository();

            ssStream stream = null;
            if (lstStream.Count > 0)
                stream = objStream.GetStreamById(lstStream[0].id.ToString());
            IList<Seed> lstSeed = null;
            if (stream != null)
            {
                if (stream.streamType == SystemStatements.STREAM_FEED)
                {
                    lstSeed = repoObj.ListPPP<Seed>("usp_SearchSeeds", stream.criteria).ToList();
                    lstSeed = (from s in lstSeed select s).Distinct().ToList();
                }
                if (stream.streamType == SystemStatements.STREAM_HANDPICKED)
                {
                    lstSeed = stream.Seeds.ToList();
                }
            }

            if (!string.IsNullOrEmpty(id))
            {
                if (lstSeed.Count > 0)
                {
                    switch (id)
                    {
                        case "Date":
                            lstSeed.OrderByDescending(x => x.createDate).ToList();
                            break;
                        case "Category":
                            lstSeed.OrderBy(x => x.Categories.FirstOrDefault() != null ? x.Categories.FirstOrDefault().name : "").ToList();
                            break;
                        case "Likes":
                            lstSeed.OrderByDescending(x => x.Ratings.ToList().Count).ToList();
                            break;
                        case "Comments":
                            lstSeed.OrderByDescending(x => x.Comments.ToList().Count).ToList();
                            break;
                        case "SeedReplies":
                            lstSeed.OrderByDescending(x => x.Commitments.ToList().Count).ToList();
                            break;
                        default:
                            lstSeed.OrderByDescending(x => x.createDate).ToList();
                            break;
                    }
                }
            }

            ViewData["StreamSeedList"] = lstSeed;
            if (lstSeed != null)
                ViewData["StreamMarkerList"] = seedMarkers(lstSeed);

            SessionStore.SetSessionValue(SessionStore.StreamSeeds, lstSeed);

            SeedAction objSeed = new SeedAction();
            string[] dashboardCount = new string[4];
            IList<Seed> tempPlanted = objSeed.GetSeedsByUser(memberData.id.ToString()).Where(x => x.parentSeedID == null).ToList();
            int tmpPlant = tempPlanted.Count();
            dashboardCount[0] = tmpPlant.ToString();

            dashboardCount[1] = lstStream.Count().ToString();

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

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

            SessionStore.SetSessionValue(SessionStore.DashboardCount, dashboardCount);
            return View();
            #endregion
        }
        public ActionResult ManageMyFeeds(string id)
        {
            #region
            StreamAction objStream = new StreamAction();
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            IList<ssStream> lstFeeds = objStream.GetAllStreams(memberData.id.ToString());
            IList<ssStream> lstMyFeeds = lstFeeds.Where(x => x.streamType.Equals(SystemStatements.STREAM_FEED)).OrderByDescending(x => x.createDate).ToList();
            IList<ssStream> lstMyLists = lstFeeds.Where(x => x.streamType.Equals(SystemStatements.STREAM_HANDPICKED)).OrderByDescending(x => x.createDate).ToList();

            ViewData["ActiveTab"] = 0;
            if (!string.IsNullOrEmpty(id))
            {
                if (id == "Date")
                {
                    lstMyFeeds = lstMyFeeds.OrderByDescending(x => x.createDate).ToList();
                    ViewData["ActiveTab"] = 0;
                }
                if (id == "MostActivity")
                {
                    lstMyFeeds = lstMyFeeds.OrderByDescending(x => x.Seeds.ToList().Count()).ToList();
                    ViewData["ActiveTab"] = 0;
                }
                if (id == "Date1")
                {
                    lstMyLists = lstMyLists.OrderByDescending(x => x.Seeds.ToList().Count()).ToList();
                    ViewData["ActiveTab"] = 1;
                }
                if (id == "MostActivity1")
                {
                    lstMyLists = lstMyLists.OrderByDescending(x => x.Seeds.ToList().Count()).ToList();
                    ViewData["ActiveTab"] = 1;
                }
            }

            if (TempData["StreamTab"] != null)
            {
                int data = (int)TempData["StreamTab"];
                ViewData["ActiveTab"] = data;
            }

            ViewData["MyFeeds"] = lstMyFeeds;
            ViewData["MyLists"] = lstMyLists;

            SeedAction objSeed = new SeedAction();
            string[] dashboardCount = new string[4];
            IList<Seed> tempPlanted = objSeed.GetSeedsByUser(memberData.id.ToString()).Where(x => x.parentSeedID == null).ToList();
            int tmpPlant = tempPlanted.Count();
            dashboardCount[0] = tmpPlant.ToString();
            dashboardCount[1] = lstFeeds.Count().ToString();

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

            MemberController objMemCtrl = new MemberController();
            IList<Seed> lstNearestSeeds = objMemCtrl.getNewestNearby("15");
            dashboardCount[3] = lstNearestSeeds.Count().ToString();
            SessionStore.SetSessionValue(SessionStore.DashboardCount, dashboardCount);
            return View();
            #endregion
        }
        /// <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
        }
 /// <summary>
 /// Method to get all seeds by member Id.
 /// </summary>
 /// <param name="MemberId"></param>
 /// <returns></returns>
 public int GetTotalSeedsByMemberId(string MemberId)
 {
     #region
     int result = 0;
     SeedAction objSeed = new SeedAction();
     IList<Seed> seedData = objSeed.GetSeedsByUser(MemberId);
     if (seedData != null)
     {
         result = seedData.Count;
     }
     return result;
     #endregion
 }
        /// <summary>
        /// Get all seeds by member Id.
        /// </summary>
        /// <param name="MemberId"></param>
        /// <returns></returns>
        public string GetAllSeedsByMemberId(string MemberId, string counter)
        {
            #region
            SeedAction objSeed = new SeedAction();
            int getCounter = Convert.ToInt32(counter) + 1;
            IList<Seed> seedData = (objSeed.GetSeedsByUser(MemberId)).Take(getCounter).OrderBy(x => x.createDate).ToList();
            string tmp = "";
            foreach (Seed s in seedData)
            {
                string imgPath = "No Image";
                if (s.Media != null && s.Media.Count > 0)
                {
                    imgPath = s.Media.Where(x => x.type.Equals("Image")).OrderByDescending(x => x.dateUploaded).FirstOrDefault().path;
                    imgPath = imgPath.Substring(imgPath.LastIndexOf('/'));
                    if (imgPath.Length > 1)
                    {
                        imgPath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia" + imgPath;
                    }
                    else
                    {
                        imgPath = "No Image";
                    }
                }
                tmp += s.id.ToString() + "||" + s.title;
                if (s.Location.City != null)
                {
                    tmp += "||" + s.Location.City.name;
                }
                if (s.Location.City.Region != null)
                {
                    tmp += "||" + s.Location.City.Region.code;
                }
                if (s.Location != null)
                {
                    tmp += "||" + s.Location.zipcode;
                }
                tmp += "||" + imgPath;
                tmp += "||" + s.createDate;
                tmp += "##";
            }
            if (tmp.Length > 2)
                tmp = tmp.Substring(0, tmp.Length - 2);

            if (seedData.Count < 1)
                tmp = "No Matching Seeds Found##No Matching Seeds Found";

            return tmp;
            #endregion
        }
        public string GetAllMySeeds(string MemberId)
        {
            #region
            SeedAction objSeed = new SeedAction();
            IList<Seed> seedData = objSeed.GetSeedsByUser(MemberId);
            string tmp = "";
            foreach (Seed s in seedData)
            {
                string imgPath = "No Image";
                int likesCount = s.Ratings.Where(x => x.likes.Equals("Like")).ToList().Count;
                int commitmentCount = s.Commitments.ToList().Count;
                int commentsCount = s.Comments.ToList().Count;

                if (s.Media != null && s.Media.Count > 0)
                {
                    imgPath = s.Media.Where(x => x.type.Equals("Image")).OrderByDescending(x => x.dateUploaded).FirstOrDefault().path;
                    imgPath = imgPath.Substring(imgPath.LastIndexOf('/'));
                    if (imgPath.Length > 1)
                        imgPath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia" + imgPath;
                    else
                        imgPath = "No Image";
                }
                tmp += s.id.ToString() + "||" + s.title;

                if (s.Location.City != null)
                {
                    tmp += "||" + s.Location.City.name;
                }

                if (s.Location.City.Region != null)
                {
                    tmp += "||" + s.Location.City.Region.code;
                }

                if (s.Location != null)
                {
                    tmp += "||" + s.Location.zipcode;
                }

                tmp += "||" + imgPath;

                tmp += "||" + s.Member.firstName + " " + s.Member.lastName + "||" + s.Location.crossStreet + "||" + Convert.ToDateTime(s.createDate).ToString("dd MMMM yyyy") + "||" + s.description + "||" + likesCount + " Likes" + "||" + commitmentCount + " Commitments" + "||" + commentsCount + " Comments";

                string tmpCategory = "";
                foreach (Category c in s.Categories)
                {
                    if (tmpCategory.Length > 0)
                        tmpCategory = tmpCategory + "," + c.name;
                    else
                        tmpCategory = c.name;
                }
                tmp = tmp + "||" + tmpCategory;

                tmp += "##";
            }

            if (tmp.Length > 2)
                tmp = tmp.Substring(0, tmp.Length - 2);

            if (seedData.Count < 1)
                tmp = "No Matching Seeds Found";

            return tmp;
            #endregion
        }
Пример #10
0
        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
        }
Пример #11
0
        // *************************************
        // URL: /Seed/All
        // *************************************
        public ActionResult MemberList()
        {
            #region
            SeedAction objSeed = new SeedAction();
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            IList<Seed> listSeed = objSeed.GetSeedsByUser(memberData.id.ToString()).ToList();
            ViewData["ListSeed"] = listSeed;

            return View();
            #endregion
        }
Пример #12
0
        public ActionResult ManageSeeds()
        {
            #region
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            if (memberData == null)
                return RedirectToAction("Default", "Member");
            SeedAction objSeed = new SeedAction();
            IList<Seed> listSeed = objSeed.GetSeedsByUser(memberData.id.ToString()).ToList();
            ViewData["ListSeed"] = listSeed;

            GetGrowingSeeds();
            GetSavedFavoriteSeeds();
            GetUserCommitments();
            GetHarvestedSeeds();

            return View();
            #endregion
        }