コード例 #1
0
        /// <summary>
        /// Method to add commitments.
        /// </summary>
        /// <param name="seedId"></param>
        /// <param name="memberId"></param>
        /// <param name="commitmentDate"></param>
        /// <param name="commitmentMsg"></param>
        /// <returns></returns>
        public bool addCommitment(string seedId, string memberId, string commitmentDate, string commitmentMsg)
        {
            #region
            bool actionDone = false;
            SeedAction objSeed = new SeedAction();
            Seed seedData = objSeed.GetSeedBySeedId(seedId);
            seedData.status = SystemStatements.STATUS_GROWING;

            Commitment objCommit = new Commitment();
            objCommit.id = Guid.NewGuid();
            objCommit.commitDate = DateTime.Now;
            objCommit.deadline = Convert.ToDateTime(commitmentDate);
            objCommit.memberId = new Guid(memberId);
            objCommit.seedId = seedData.id;
            objCommit.status = SystemStatements.STATUS_ACTIVE;
            objCommit.msg = commitmentMsg;
            objCommit.isRead = false;

            seedData.Commitments.Add(objCommit);
            seedData = objSeed.UpdateSeed(seedData);
            if (seedData != null)
                actionDone = true;

            return actionDone;
            #endregion
        }
コード例 #2
0
        public void AddCommitment(string Sid, string Deadline, string Msg)
        {
            #region
            SeedAction objSeed = new SeedAction();
            Seed seedData = objSeed.GetSeedBySeedId(Sid);
            seedData.status = SystemStatements.STATUS_GROWING;

            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);

            Commitment objCommit = new Commitment();
            objCommit.id = Guid.NewGuid();
            objCommit.commitDate = DateTime.Now;
            objCommit.deadline = Convert.ToDateTime(Deadline);
            objCommit.memberId = memberData.id;
            objCommit.seedId = seedData.id;
            objCommit.status = SystemStatements.STATUS_ACTIVE;
            objCommit.msg = Msg;
            objCommit.isRead = false;

            seedData.Commitments.Add(objCommit);
            objSeed.UpdateSeed(seedData);

            MailForContribution((seedData.Member.firstName + " " + seedData.Member.lastName).ToString(), (memberData.firstName + " " + memberData.lastName).ToString(), seedData.title, ("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/UserDetail/" + memberData.id), seedData.Member.username.ToString(), "Commitment");

            Response.Redirect("/Seed/SeedDetails/" + seedData.id);
            #endregion
        }
コード例 #3
0
        public ActionResult AddCommentAtHomePage(string SCid, string commentValue)
        {
            #region
            SeedAction objSeed = new SeedAction();
            Seed seedData = objSeed.GetSeedBySeedId(SCid);
            seedData.status = SystemStatements.STATUS_GROWING;

            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);

            Comment objComment = new Comment();
            objComment.id = Guid.NewGuid();
            objComment.commentDate = DateTime.Now;
            objComment.msg = commentValue;
            objComment.seedId = seedData.id;
            objComment.commentById = memberData.id;
            objComment.isRead = false;

            seedData.Comments.Add(objComment);
            objSeed.UpdateSeed(seedData);

            ContributionMailAlert((seedData.Member.firstName + " " + seedData.Member.lastName).ToString(), (memberData.firstName + " " + memberData.lastName).ToString(), seedData.title, ("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/SeedDetails/" + seedData.id), seedData.Member.username.ToString(), "Comment");
            ViewData["commentId"] = seedData.id;
            return PartialView("CommentPartial");
            #endregion
        }
コード例 #4
0
        /// <summary>
        /// Method to add comments.
        /// </summary>
        /// <param name="seedId"></param>
        /// <param name="memberId"></param>
        /// <param name="commentMsg"></param>
        /// <returns></returns>
        public bool addComment(string seedId, string memberId, string commentMsg)
        {
            bool actionDone = false;
            SeedAction objSeed = new SeedAction();
            Seed seedData = objSeed.GetSeedBySeedId(seedId);
            seedData.status = SystemStatements.STATUS_GROWING;

            Comment objComment = new Comment();
            objComment.id = Guid.NewGuid();
            objComment.commentDate = DateTime.Now;
            objComment.msg = commentMsg.Replace("|", "&");
            objComment.seedId = seedData.id;
            objComment.commentById = new Guid(memberId);
            objComment.isRead = false;

            seedData.Comments.Add(objComment);
            seedData = objSeed.UpdateSeed(seedData);
            if (seedData != null)
                actionDone = true;

            return actionDone;
        }
コード例 #5
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
        }
コード例 #6
0
        public ContentResult Titles(string q, int limit, Int64 timestamp)
        {
            StringBuilder responseContentBuilder = new StringBuilder();
            SeedAction objSeed = new SeedAction();
            IList<Seed> finalList = new List<Seed>();

            IList<Seed> lstSeed = objSeed.GetAllSeedsByTitle(q).OrderBy(x => x.title).ToList();

            foreach (Seed s in lstSeed)
            {
                finalList.Add(s);
            }

            foreach (Seed seed in finalList)
                responseContentBuilder.Append(String.Format("{0}|{1}\n", seed.id, seed.title));

            IList<Tag> lstTags = (from t in objSeed.GetAllTagsByName(q)
                                  group t by new { t.name } into g
                                  select new Tag { name = g.Key.name }).ToList();

            foreach (Tag tag in lstTags)
                responseContentBuilder.Append(String.Format("{0}|{1}\n", tag.id, tag.name));

            return Content(responseContentBuilder.ToString());
        }
コード例 #7
0
        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
        }
コード例 #8
0
        public IList<Seed> HomeSearchSeeds(string Criteria, string sortBy, string radius, string counter)
        {
            #region
            SeedAction objSeed = new SeedAction();
            IList<Seed> seedData = new List<Seed>();
            IList<Seed> tmpSeedList = null;
            CategoryAction objCategory = new CategoryAction();

            string searchOthers = "";
            string searchZip = "";
            int seedCounter = Convert.ToInt32(counter) + 1;

            string[] criteriaArr = Criteria.Trim().Split(' ');

            foreach (string str in criteriaArr)
            {
                if (this.checkCriteria(str))
                {
                    searchZip = str;
                }
                else
                {
                    searchOthers = searchOthers + " " + str;
                }
            }

            searchOthers = searchOthers.Trim();

            if (searchZip.Length > 0)
            {
                tmpSeedList = objSeed.GetAllSeedsByZip(radius, searchZip);

                foreach (Seed sData in tmpSeedList)
                {
                    seedData.Add(sData);
                }
            }

            if (searchOthers.Length > 0 && seedData.Distinct().ToList().Count < seedCounter)
            {
                IList<Category> catList = objCategory.GetAllCategoriesByName(searchOthers);

                foreach (Category cat in catList)
                {
                    tmpSeedList = objSeed.GetAllSeedsByCategory(cat.id.ToString());
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    tmpSeedList = objSeed.GetAllSeedsByTitle(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    tmpSeedList = objSeed.GetAllSeedsByDescription(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    tmpSeedList = objSeed.GetSeedByCrossStreet(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }
                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    tmpSeedList = objSeed.GetSeedByCity(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

            }
            seedData = seedData.Distinct().Take(seedCounter).ToList();
            return seedData;
            #endregion
        }
コード例 #9
0
        public IList<Seed> getHomeSearchResult(string city, string catId, string keyword, string zip, string userName)
        {
            #region Logic
            IList<Seed> seedList = new List<Seed>();
            Repository repoObj = new Repository();
            SeedAction objSeed = new SeedAction();

            string searchString = "";
            if (catId != null && catId.Length > 0)
            {
                searchString = "select distinct seed.* from seed, Seed_has_Category where (status='New' or status='Growing')";
            }
            else
            {
                searchString = "select distinct seed.* from seed where (status='New' or status='Growing')";
            }
            bool flag = false;

            #region Search in location table
            if ((!string.IsNullOrEmpty(city) && city != "Set Your location") || (!string.IsNullOrEmpty(zip) && zip != "Zipcode"))
            {
                searchString += " and locationid in ( select distinct(id) from location where ";
                if (city.Length > 0 && city != "City")
                {
                    if (!string.IsNullOrEmpty(zip))
                        searchString += "cityid in (select id from City where name = '" + city + "' )";
                    else
                        searchString += "cityid in (select id from City where name = '" + city + "' ))";
                    flag = true;
                }

                if (!string.IsNullOrEmpty(zip))
                {
                    if (zip.Length > 0 && zip != "Zipcode")
                    {
                        CommonMethods cmnMethod = new CommonMethods();
                        string zipResult = cmnMethod.GetZipByRadiusNew("25", zip);
                        if (flag)
                        {
                            searchString += " or ";
                        }

                        if (!string.IsNullOrEmpty(zipResult))
                        {
                            searchString = searchString.Substring(0, searchString.Length - 1);
                            searchString += " zipcode in (" + zipResult + "))";
                        }
                        else
                        {
                            searchString += " zipcode in (" + zip + "))";
                        }

                        flag = true;
                    }
                }
            }
            #endregion

            #region Search according to categories
            if (catId != null && catId.Length > 0)
            {
                if (!catId.Equals("all"))
                    searchString += " and Seed_has_Category.categoryId in (" + catId + ") and Seed.id=Seed_has_Category.seedId";
            }
            #endregion

            #region Search in username, firstname, lastname
            if (!string.IsNullOrEmpty(userName))
            {
                if (userName != "Search by user, category, keywords")
                {
                    if (userName.Contains('@'))
                    {
                        searchString += " and Seed.ownerId in (Select id from Member where username = '******')";
                    }
                    else
                    {
                        string fName = string.Empty;
                        string lName = string.Empty;
                        string[] splt = userName.Split(' ');
                        if (splt.Count() > 1)
                        {
                            fName = splt[0].ToString();
                            lName = splt[1].ToString();
                            searchString += " and Seed.ownerId in (select id from Member where firstName = '" + fName + "' or lastName='" + lName + "')";
                        }
                        else
                        {
                            fName = splt[0].ToString();
                            searchString += " and Seed.ownerId in (select id from Member where firstName = '" + fName + "')";
                        }
                    }
                }
            }
            #endregion

            #region Search in title or description
            if (!string.IsNullOrEmpty(keyword))
            {
                if (keyword.Length > 0 && keyword != "Search by user, category, keywords")
                {
                    searchString += " or (Seed.title like '%" + keyword + "%' or Seed.description like '%" + keyword + "%')";
                }
            }
            #endregion

            seedList = repoObj.ListPPP<Seed>("usp_SearchSeeds", searchString).ToList();
            IList<Seed> returnSeedList = (from s in seedList select s).Distinct().ToList();
            SessionStore.SetSessionValue(SessionStore.DefaultFeed, searchString);
            return returnSeedList;
            #endregion
        }
コード例 #10
0
        /// <summary>
        /// Method to get commitments by seedId.
        /// </summary>
        /// <param name="SeedId"></param>
        /// <returns></returns>
        public IList<SeedComment> GetCommitmentsById(string SeedId)
        {
            IList<SeedComment> lstSeedComment = new List<SeedComment>();
            SeedAction objSeed = new SeedAction();
            Seed seedData = objSeed.GetSeedBySeedId(SeedId);
            IList<Commitment> tempCommitment = seedData.Commitments.ToList();

            foreach (Commitment commitment in tempCommitment)
            {
                SeedComment objSeedComment = new SeedComment();
                string imagePath = "No Image";

                if (commitment.Member.MemberProfiles.FirstOrDefault() != null)
                {

                    if (commitment.Member.MemberProfiles.FirstOrDefault().imagePath != null)
                    {
                        imagePath = commitment.Member.MemberProfiles.FirstOrDefault().imagePath;

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

                        imagePath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia" + imagePath;

                    }
                }

                // imagePath = commitment.Member.MemberProfiles.FirstOrDefault().imagePath.ToString();

                objSeedComment.Path = imagePath;
                objSeedComment.MemberName = commitment.Member.firstName + " " + commitment.Member.lastName;
                objSeedComment.CommentMessage = commitment.msg.ToString();
                //objSeedComment.CommentDate = Convert.ToDateTime(commitment.commitDate).ToString("MMMM dd yyyy");
                objSeedComment.CommentDate = Convert.ToDateTime(commitment.commitDate).ToString();
                objSeedComment.MemberID = commitment.Member.id.ToString();
                lstSeedComment.Add(objSeedComment);

            }
            return lstSeedComment;
        }
コード例 #11
0
        public IList<MemberSeeds> GetAllSeedsByParrentId(string ParrentId, string counter)
        {
            IList<MemberSeeds> lstMemberSeeds = new List<MemberSeeds>();
            SeedAction objSeed = new SeedAction();

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

            IList<Seed> seedData = (objSeed.GetSeedsByParrentSeedID(ParrentId)).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;
        }
コード例 #12
0
        /// <summary>
        /// This method is used to Add new Seeds.
        /// </summary>
        /// <param name="SeedName"></param>
        /// <param name="Description"></param>
        /// <param name="CityName"></param>
        /// <param name="Street"></param>
        /// <param name="RegionCode"></param>
        /// <param name="LatLong"></param>
        /// <param name="ZipCode"></param>
        /// <param name="ownerId"></param>
        /// <param name="tagName"></param>
        /// <returns></returns>
        public string AddSeedData(string SeedName, string Description, string CityName, string Street, string RegionCode, string Lat, string Lng, string ZipCode, string ownerId, string tagName, string imageName, string categoryNames)
        {
            bool actionCompleted = false;
            Seed seedData = null;
            string imagePath = imageName;
            string result = "Error while seed planting.";
            try
            {
                SeedAction objSeed = new SeedAction();

                Seed objSeedEntity = new Seed();
                Member memberData = new Member();
                Tag objTagEntity = new Tag();

                objSeedEntity.title = SeedName.Replace("|","&");

                objSeedEntity.description = Description.Replace("|", "&");

                LocationAction objLocation = new LocationAction();
                string cityid = objLocation.GetCityIdByCityName(CityName, RegionCode);
                if (string.IsNullOrEmpty(cityid))
                    cityid = objSeed.AddCity(CityName, RegionCode);

                string lat = Lat;
                string longt = Lng;

                if (cityid.Length > 0)
                {
                    Location objLoc = objLocation.CreateLocation(cityid, (ZipCode).ToString(), Convert.ToDouble(lat), Convert.ToDouble(longt), Street);

                    objSeedEntity.locationId = new Guid(objLoc.id.ToString());

                    objSeedEntity.ownerId = new Guid(ownerId);
                    seedData = objSeed.AddSeed(objSeedEntity);

                    actionCompleted = true;
                    result = seedData.id.ToString();
                    if (!string.IsNullOrEmpty(tagName))
                    {
                        if (seedData.id != null && tagName.Length > 0)
                        {
                            if (!tagName.Equals("(null)"))
                            {
                                objTagEntity.name = tagName;
                                objTagEntity.seedId = seedData.id;
                                actionCompleted = objSeed.ManageTag(objTagEntity);
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(imageName))
                    {
                        if (!imageName.Equals("No Image"))
                        {
                            AddMedia("Iphone Image1", imageName, seedData.id.ToString(), "Image", ownerId);

                            imagePath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia/" + imageName;
                        }
                    }
                    if (!string.IsNullOrEmpty(categoryNames))
                    {
                        if (seedData.id != null && categoryNames.Length > 0)
                        {
                            if (!categoryNames.Equals("Select Category"))
                            {
                                string[] arrCategoryIds;
                                string[] arrCategoryNames;
                                string ids = string.Empty;
                                //categoryNames = categoryNames.TrimStart(',');
                                arrCategoryNames = categoryNames.Split(',');
                                CategoryAction objCategory = new CategoryAction();
                                for (int c = 0; c < arrCategoryNames.Length; c++)
                                {
                                    if (!string.IsNullOrEmpty(ids))
                                        ids = ids + "," + objCategory.GetCategoryIdByCategoryName(arrCategoryNames[c].ToString().Trim());
                                    else
                                        ids = objCategory.GetCategoryIdByCategoryName(arrCategoryNames[c].ToString().Trim());
                                }
                                arrCategoryIds = ids.Split(',');
                                if (categoryNames.Trim().ToString() != "" && arrCategoryIds.Length > 0)
                                {
                                    objSeed.AddCategories(seedData.id.ToString(), arrCategoryIds);
                                }
                            }
                        }
                    }

                    result = seedData.id.ToString() + "||" + seedData.title + "||" + CityName + "||" + RegionCode + "||" + ZipCode + "||" + imageName + "||" + imagePath + "||" + DateTime.Now.ToString();
                }
                if (actionCompleted == false)
                {
                    result = "Error while seed planting.";
                }
            }
            catch (Exception ex)
            {
                result = "Error while seed planting.";
            }

            return result;
        }
コード例 #13
0
        /// <summary>
        /// Method to Update seed.
        /// </summary>
        /// <param name="seedId"></param>
        /// <param name="seedName"></param>
        /// <param name="seedDescription"></param>
        /// <returns></returns>
        public string UpdateSeed(string seedId, string seedName, string seedDescription, string SeedTags, string categories, string imageName, string ownerId)
        {
            string isCompleted = "Error in Update Action";
            SeedAction objSeed = new SeedAction();

            try
            {
                Seed seedData = objSeed.GetSeedBySeedId(seedId);

                seedData.title = seedName.Replace("|", "&");
                seedData.description = seedDescription.Replace("|", "&");
                objSeed.UpdateSeed(seedData);

                if (!string.IsNullOrEmpty(imageName))
                {
                    if (!imageName.Equals("No Image"))
                    {
                        AddMedia("Iphone Image1", imageName, seedData.id.ToString(), "Image", ownerId);
                    }
                }
                if (!string.IsNullOrEmpty(categories))
                {
                    if (!categories.Equals("Select Category"))
                    {
                        bool isPlanted = false;
                        string[] arrCategoryIds;
                        string[] arrCategoryNames;
                        string ids = string.Empty;
                        arrCategoryNames = categories.Split(',');
                        CategoryAction objCategory = new CategoryAction();
                        for (int c = 0; c < arrCategoryNames.Length; c++)
                        {
                            if (!string.IsNullOrEmpty(ids))
                                ids = ids + "," + objCategory.GetCategoryIdByCategoryName(arrCategoryNames[c].ToString().Trim());
                            else
                                ids = objCategory.GetCategoryIdByCategoryName(arrCategoryNames[c].ToString().Trim());
                        }
                        arrCategoryIds = ids.Split(',');
                        if (categories.Trim().ToString() != "" && arrCategoryIds.Length > 0)
                        {
                            isPlanted = objSeed.AddCategories(seedData.id.ToString(), arrCategoryIds);
                        }
                    }
                }

                Tag objTagEntity = new Tag();
                if (!string.IsNullOrEmpty(SeedTags))
                {
                    if (!SeedTags.Equals("(null)"))
                    {
                        objTagEntity.name = SeedTags;
                        objTagEntity.seedId = new Guid(seedId);
                        objSeed.ManageTag(objTagEntity);
                    }
                }

                //isCompleted = "Seed Update Successfully";

                if (imageName.Length > 1 && imageName != "No Image")
                {
                    imageName = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia/" + imageName;
                }
                else
                {
                    imageName = "No Image";
                }

                isCompleted = seedData.id.ToString() + "||" + seedData.title + "||" + seedData.Location.City.name + "||" + seedData.Location.City.Region.code + "||" + seedData.Location.zipcode + "||" + imageName;

                //isCompleted = "SeedId: " + seedId + ", Seed Name: " + seedName + ", Seed Description: " + seedDescription;
            }
            catch
            {

            }
            return isCompleted;
        }
コード例 #14
0
        /// <summary>
        /// Method to add rating.
        /// </summary>
        /// <param name="seedId"></param>
        /// <param name="memberId"></param>
        /// <param name="rate"></param>
        /// <returns></returns>
        public string addRating(string seedId, string memberId, string rate)
        {
            bool actionDone = false;
            SeedAction objSeed = new SeedAction();
            actionDone = objSeed.ManageRating(seedId, memberId.ToString(), rate);

            int count = objSeed.getSeedRatingCountBySeedId(seedId, "Like");

            return count + " Likes";
        }
コード例 #15
0
        /// <summary>
        /// Search Seeds
        /// </summary>
        /// <param name="Criteria"></param>
        /// <param name="sortBy"></param>
        /// <param name="radius"></param>
        /// <param name="counter"></param>
        /// <returns></returns>
        public IList<SeedDetail> SearchSeeds(string Criteria, string sortBy, string radius, string counter)
        {
            SeedAction objSeed = new SeedAction();
            IList<Seed> seedData = new List<Seed>();
            IList<Seed> tmpSeedList = null;
            CategoryAction objCategory = new CategoryAction();

            string searchOthers = "";
            string searchZip = "";
            int seedCounter = Convert.ToInt32(counter) + 1;

            string[] criteriaArr = Criteria.Trim().Split(' ');

            foreach (string str in criteriaArr)
            {
                //Checking that searchstring contains zipcode
                if (this.checkCriteria(str))
                {
                    searchZip = str;
                }
                else
                {
                    searchOthers = searchOthers + " " + str;
                }
            }

            searchOthers = searchOthers.Trim();

            if (searchZip.Length > 0)
            {
               // radius = "50";
                tmpSeedList = objSeed.GetAllSeedsByZip(radius, searchZip);

                foreach (Seed sData in tmpSeedList)
                {
                    if (sData.status.Equals(SystemStatements.STATUS_NEW) || sData.status.Equals(SystemStatements.STATUS_GROWING))
                    {
                        seedData.Add(sData);
                    }
                    //seedData.Add(sData);
                }
            }

            if (searchOthers.Length > 0 && seedData.Distinct().ToList().Count < seedCounter)
            {
                //Searching in Category
                IList<Category> catList = objCategory.GetAllCategoriesByName(searchOthers);

                foreach (Category cat in catList)
                {
                    tmpSeedList = objSeed.GetAllSeedsByCategory(cat.id.ToString());
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    tmpSeedList = objSeed.GetAllSeedsByTitle(searchOthers);
                    foreach (Seed sData in tmpSeedList)

                    {
                        seedData.Add(sData);
                    }
                }

                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    //Searching in Description
                    tmpSeedList = objSeed.GetAllSeedsByDescription(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    //Searching in FirstName
                    tmpSeedList = objSeed.GetAllSeedsByUserName(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    //Searching in CrossStreet
                    tmpSeedList = objSeed.GetSeedByCrossStreet(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }
                if (seedData.Distinct().ToList().Count < seedCounter)
                {
                    //Searching in City
                    tmpSeedList = objSeed.GetSeedByCity(searchOthers);
                    foreach (Seed sData in tmpSeedList)
                    {
                        seedData.Add(sData);
                    }
                }

            }

              //  string tmp = "";

            seedData = seedData.Distinct().Take(seedCounter).ToList();

            if (!string.IsNullOrEmpty(sortBy))
            {
                switch (sortBy)
                {
                    case "1":
                        seedData = seedData.OrderBy(x => x.Categories.FirstOrDefault() != null ? x.Categories.FirstOrDefault().name : "").ToList();
                        break;
                    case "2":
                        seedData = seedData.OrderBy(x => x.Location.zipcode).ToList();
                        break;
                    case "3":
                        seedData = seedData.OrderBy(x => x.title).ToList();
                        break;
                    default:
                        seedData = seedData.OrderBy(x => x.title).ToList();
                        break;
                }
            }

            string tmpCName = "";

            IList<SeedDetail> lstSeedList = new List<SeedDetail>();

            foreach (Seed s in seedData)
            {

                SeedDetail objSeedDetail = new SeedDetail();

                string imgPath = "No Image";

                int likesCount = s.Ratings.Where(x => x.likes.Equals("Like")).ToList().Count;
                int replyCount =Convert.ToInt16(objSeed.GetReplySeedCount(s.id.ToString()));// s.Commitments.ToList().Count;
                int commentsCount = s.Comments.ToList().Count;

                if (s.Media != null && s.Media.Count > 0)
                {
                    imgPath = s.Media.FirstOrDefault().path;

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

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

                objSeedDetail.SeedID = s.id.ToString();
                objSeedDetail.Title = s.title;

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

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

                if (s.Location != null)
                {
                    objSeedDetail.Zip = s.Location.zipcode;
                  //  tmp += "||" + s.Location.zipcode;
                }
                objSeedDetail.Path = imgPath;
               // tmp += "||" + imgPath;

                if (s.Categories != null && s.Categories.Count > 0)
                {
                    tmpCName = s.Categories.FirstOrDefault().name;
                }

                if (s.Location != null)
                {

                    objSeedDetail.Latitude = s.Location.localLat.ToString();
                    objSeedDetail.Longitude = s.Location.localLong.ToString();
                }
                objSeedDetail.TempCategory = tmpCName;
               // tmp += "||" + tmpCName;

                objSeedDetail.MemberName = s.Member.firstName + " " + s.Member.lastName;
                objSeedDetail.Address = s.Location.crossStreet;
                objSeedDetail.CreateDate = Convert.ToDateTime(s.createDate).ToString();
                objSeedDetail.Description = s.description;
                objSeedDetail.Likes = likesCount + " Likes";
                objSeedDetail.Comments = commentsCount + " Comments";
                objSeedDetail.ReplySeeds = replyCount + " Reply Seeds";
                objSeedDetail.PopularCount = (likesCount + commentsCount + replyCount).ToString();
                //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;
                }
                objSeedDetail.Categories = tmpCategory;
             //   tmp = tmp + "||" + tmpCategory;

                lstSeedList.Add(objSeedDetail);
            }//For each seed

            return lstSeedList;
        }
コード例 #16
0
 private void GetHarvestedSeeds()
 {
     SeedAction objSeed = new SeedAction();
     IList<Seed> ListHarvestedSeeds = objSeed.GetSeedsByStatus(SystemStatements.STATUS_HARVESTED);
     ViewData["HarvestedSeeds"] = ListHarvestedSeeds;
 }
コード例 #17
0
 private void GetTerminatedSeeds()
 {
     SeedAction objSeed = new SeedAction();
     IList<Seed> ListTerminatedSeeds = objSeed.GetSeedsByStatus(SystemStatements.STATUS_TERMINATED);
     ViewData["TerminatedSeeds"] = ListTerminatedSeeds;
 }
コード例 #18
0
        /// <summary>
        /// Method to get all seeds by Id.
        /// </summary>
        /// <param name="SeedId"></param>
        /// <returns></returns>
        public IList<SeedDetail> GetSeedsById(string SeedId, string MemberId)
        {
            IList<SeedDetail> lstSeedDetail = new List<SeedDetail>();
            SeedDetail objSeedDetail = new SeedDetail();
            SeedAction objSeed = new SeedAction();
            //For finding total reply seeds of the current seed
            //int getCounter = 200;
               // IList<Seed> seedDataCounter = (objSeed.GetSeedsByParrentSeedID(SeedId)).Take(getCounter).OrderBy(x => x.createDate).ToList();
            //

            Seed seedData = objSeed.GetSeedBySeedId(SeedId);
            int likesCount = seedData.Ratings.Where(x => x.likes.Equals("Like")).ToList().Count;
            int replyCount = Convert.ToInt16(objSeed.GetReplySeedCount(SeedId));// seedData.Commitments.ToList().Count;
            int commentsCount = seedData.Comments.ToList().Count;

            objSeedDetail.Title = seedData.title;
            if (seedData.Member.organisationName != null)
            {
                objSeedDetail.MemberName = seedData.Member.organisationName;
            }
            else
            {
                objSeedDetail.MemberName = seedData.Member.firstName + " " + seedData.Member.lastName;
            }

            objSeedDetail.City = seedData.Location.City.name;
            objSeedDetail.Address = seedData.Location.crossStreet;
            objSeedDetail.State = seedData.Location.City.Region.name;
            objSeedDetail.CreateDate = Convert.ToDateTime(seedData.createDate).ToString("MMMM dd, yyyy");
            objSeedDetail.Description = seedData.description;
            objSeedDetail.Likes = likesCount + " Likes";
            objSeedDetail.ReplySeeds = replyCount + " Reply Seeds";
            objSeedDetail.Comments=   commentsCount + " Comments";
            objSeedDetail.RootSeedID =seedData.id.ToString();
            objSeedDetail.ParentSeedID = seedData.parentSeedID != null ? seedData.parentSeedID.ToString() : seedData.id.ToString();
            string tmpCategory = "";
            foreach (Category c in seedData.Categories)
            {
                if (tmpCategory.Length > 0)
                    tmpCategory = tmpCategory + ", " + c.name;
                else
                    tmpCategory = c.name;
            }
            objSeedDetail.Categories = tmpCategory;
            if (seedData.Tags != null && seedData.Tags.Count > 0)
            {
                objSeedDetail.Keywords = seedData.Tags.FirstOrDefault().name.ToString();

            }
            else
            {
                objSeedDetail.Keywords = "";
            }

            objSeedDetail.MemberID = seedData.Member.id.ToString();
            objSeedDetail.Zip = seedData.Location.zipcode;

            int counter = objSeed.getSeedRatingCountByMemberId(SeedId, MemberId, "Like");

            if (counter > 0)
            {
             objSeedDetail.Rating= "Disable";
            }
            else
            {
                objSeedDetail.Rating = "Enable";
            }

            objSeedDetail.Latitude = seedData.Location.localLat.ToString();
            objSeedDetail.Longitude = seedData.Location.localLong.ToString();

            string imgPath = "No Image";

            if (seedData.Media != null && seedData.Media.Where(x => x.type.Equals("Image")).Count() > 0)
            {
                imgPath = seedData.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";
                }
            }

            objSeedDetail.Path = imgPath;

            lstSeedDetail.Add(objSeedDetail);
            return lstSeedDetail;
        }
コード例 #19
0
        public IList<Seed> getNewestNearby(string radius)
        {
            #region
            CommonMethods objCmnMethods = new CommonMethods();
            string strIpAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
            if (strIpAddress == "127.0.0.1")
                strIpAddress = "61.246.241.162";

            string ipLocation = objCmnMethods.IP2AddressAPI(strIpAddress);
            string citySearch = string.Empty;
            string stateSearch = string.Empty;
            string zipCodeSearch = string.Empty;
            string latSearch = string.Empty;
            string lngSearch = string.Empty;
            string[] currentAddress;
            if (!string.IsNullOrEmpty(ipLocation))
            {
                //IPaddressAPI
                currentAddress = ipLocation.Split(',');

                if (string.IsNullOrEmpty(currentAddress[4].Replace("\"", "").ToString()))
                    stateSearch = "AZ";
                else
                    stateSearch = currentAddress[4].Replace("\"", "").ToString();

                if (string.IsNullOrEmpty(currentAddress[6].ToString()))
                    citySearch = "Phoenix";
                else
                    citySearch = currentAddress[6].Replace("\"", "").ToString();

                if (string.IsNullOrEmpty(currentAddress[7].Replace("\"", "").ToString()))
                    zipCodeSearch = "85027";
                else
                    zipCodeSearch = currentAddress[7].Replace("\"", "").ToString();

                latSearch = currentAddress[8].Replace("\"", "").ToString();
                lngSearch = currentAddress[9].Replace("\"", "").ToString();
            }
            else
            {
                //MaxMind
                ipLocation = objCmnMethods.IP2AddressMaxMind();
                currentAddress = ipLocation.Split('\'');

                if (string.IsNullOrEmpty(currentAddress[7].ToString()))
                    stateSearch = "AZ";
                else
                    stateSearch = currentAddress[7].ToString();

                if (string.IsNullOrEmpty(currentAddress[5].ToString()))
                    citySearch = "Phoenix";
                else
                    citySearch = currentAddress[5].ToString();

                if (string.IsNullOrEmpty(currentAddress[15].ToString()))
                    zipCodeSearch = "85027";
                else
                    zipCodeSearch = currentAddress[15].ToString();

                latSearch = currentAddress[11].ToString();
                lngSearch = currentAddress[13].ToString();
            }
            SeedAction objSeed = new SeedAction();
            IList<Seed> lstSeed = objSeed.GetAllSeedsByZip(radius, zipCodeSearch);
            return lstSeed.Where(x => (x.status.Equals(SystemStatements.STATUS_NEW) || x.status.Equals(SystemStatements.STATUS_GROWING))).ToList();
            #endregion
        }
コード例 #20
0
        /// <summary>
        /// Method to get votes by seedId.
        /// </summary>
        /// <param name="SeedId"></param>
        /// <returns></returns>
        public IList<SeedComment> GetVotesById(string SeedId)
        {
            IList<SeedComment> lstGetVotesById = new List<SeedComment>();

            SeedAction objSeed = new SeedAction();
            Seed seedData = objSeed.GetSeedBySeedId(SeedId);
            IList<Rating> tempRating = seedData.Ratings.Where(x => x.likes.Equals("Like")).ToList();
            string tmp = string.Empty;
            foreach (Rating rating in tempRating)
            {
                SeedComment objGetVotesById = new SeedComment();
                string imagePath = "No Image";

                if (rating.Member.MemberProfiles.FirstOrDefault() != null)
                {

                    if (rating.Member.MemberProfiles.FirstOrDefault().imagePath != null)
                    {
                        imagePath = rating.Member.MemberProfiles.FirstOrDefault().imagePath;

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

                        imagePath = System.Configuration.ConfigurationManager.AppSettings["RootURL"].ToString() + "/UploadedMedia" + imagePath;

                    }
                }
                //   imagePath = rating.Member.MemberProfiles.FirstOrDefault().imagePath.ToString();

                objGetVotesById.Path = imagePath;
                objGetVotesById.MemberName = rating.Member.firstName + " " + rating.Member.lastName;
               // objGetVotesById.CommentMessage = "Voted for " + rating.Seed.title + " " + Convert.ToDateTime(rating.ratingDate).ToString();
                objGetVotesById.CommentMessage =Convert.ToDateTime(rating.ratingDate).ToShortDateString() + "-" + rating.Seed.title ;
                //objGetVotesById.CommentDate = Convert.ToDateTime(rating.ratingDate).ToString("MMMM dd yyyy");
                objGetVotesById.CommentDate = Convert.ToDateTime(rating.ratingDate).ToString();
                objGetVotesById.MemberID = rating.Member.id.ToString();
                lstGetVotesById.Add(objGetVotesById);

            }
            return lstGetVotesById;
        }
コード例 #21
0
 public ActionResult LikeSeedPartial(string SLikedid, string partialLike)
 {
     #region
     SeedAction objSeed = new SeedAction();
     Seed seedData = objSeed.GetSeedBySeedId(SLikedid);
     seedData.status = SystemStatements.STATUS_GROWING;
     Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
     MemberAction objMember = new MemberAction();
     bool isDone = objMember.LikeUnlike(memberData.id.ToString(), SLikedid, partialLike);
     seedData = objSeed.GetSeedBySeedId(SLikedid);
     ViewData["LikeData"] = seedData.id;
     return PartialView("LikePartial");
     #endregion
 }
コード例 #22
0
 public void TerminateSeed(string id)
 {
     bool isCompleted = false;
     SeedAction objSeed = new SeedAction();
     isCompleted = objSeed.HarvestTerminateSeed(id, "Terminate");
     if (isCompleted == true)
         Response.Redirect("/Admin/ManageSeeds");
 }
コード例 #23
0
        public ContentResult Tags(string q, int limit, Int64 timestamp)
        {
            StringBuilder responseContentBuilder = new StringBuilder();
            SeedAction objSeed = new SeedAction();
            IList<Tag> lstTags = (from t in objSeed.GetAllTagsByName(q)
                                  group t by new { t.name } into g
                                  select new Tag { name = g.Key.name }).ToList();

            foreach (Tag tag in lstTags)
                responseContentBuilder.Append(String.Format("{0}|{1}\n", tag.id, tag.name));
            return Content(responseContentBuilder.ToString());
        }
コード例 #24
0
 public void unFlagSeed(string id)
 {
     bool isCompleted = false;
     SeedAction objSeed = new SeedAction();
     isCompleted = objSeed.unFlagSeed(id);
     if (isCompleted == true)
         Response.Redirect("/Admin/ManageSeeds");
 }
コード例 #25
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
        }
コード例 #26
0
 private void GetActiveSeeds()
 {
     SeedAction objSeed = new SeedAction();
     IList<Seed> ListActiveSeeds = objSeed.GetSeedsByTwoStatus(SystemStatements.STATUS_NEW, SystemStatements.STATUS_GROWING);
     ViewData["ActiveSeeds"] = ListActiveSeeds;
 }
コード例 #27
0
        public ActionResult Default()
        {
            #region PreviousCoding
            Repository repoObj = new Repository();
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            if (memberData != null)
            {
                //ViewData["LocationData"] = locations;
                //ViewData["Memberlocation"] = memberLocation;
            }
            else
            {
                string logoutString = TempData["Logout"] as string;
                if (logoutString != "Logout")
                {
                    const string myFacebookApiKey = "101151816623334";
                    const string myFacebookSecret = "65f49046dce2d1f54d6991e43c4af675";

                    var connectSession = new ConnectSession(myFacebookApiKey, myFacebookSecret);
                    if (connectSession.IsConnected())
                    {
                        ViewData["FBConnected"] = true;
                        var api = new Api(connectSession);
                        ViewData["FBUser"] = api.Users.GetInfo();
                        ViewData["UserID"] = api.Users.GetInfo().uid;
                        SessionStore.SetSessionValue(SessionStore.FacebookConnect, "FacebookUserLoggedIn");
                        string[] fbDetails = new string[2];
                        fbDetails[0] = Convert.ToString("fb_" + api.Users.GetInfo().uid);
                        fbDetails[1] = api.Users.GetInfo().name;
                        SessionStore.SetSessionValue("FacebookDetails", fbDetails);
                        api.Session.Logout();
                        connectSession.Logout();
                        return RedirectToAction("FBUser", "Member");
                    }
                }
            }
            #endregion

            GetTopPlanters();

            CommonMethods objCmnMethods = new CommonMethods();

            string strIpAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
            if (strIpAddress == "127.0.0.1")
                strIpAddress = "61.246.241.162";

            string citySearch = string.Empty;
            string stateSearch = string.Empty;
            string zipCodeSearch = string.Empty;
            string latSearch = string.Empty;
            string lngSearch = string.Empty;
            string[] currentAddress;

            string ipLocation = objCmnMethods.MaxMindIPData(strIpAddress);
            if (!string.IsNullOrEmpty(ipLocation) && (!ipLocation.Contains("IP_NOT_FOUND")))
            {
                //IPaddressAPI
                currentAddress = ipLocation.Split(',');

                if (string.IsNullOrEmpty(currentAddress[1].Replace("\"", "").ToString()))
                    stateSearch = "AZ";
                else
                {
                    stateSearch = currentAddress[1].Replace("\"", "").ToString();
                    //stateSearch = "WA";
                }

                if (string.IsNullOrEmpty(currentAddress[2].ToString()))
                    citySearch = "Phoenix";
                else
                {
                    citySearch = currentAddress[2].Replace("\"", "").ToString();
                    //citySearch = "Seattle";
                }

                if (string.IsNullOrEmpty(currentAddress[3].Replace("\"", "").ToString()))
                {
                    //zipCodeSearch = "85027";
                    SeedAction objS = new SeedAction();
                    LocationAction objLocation = new LocationAction();
                    string cityId = objLocation.GetCityIdByCityName(citySearch, stateSearch);
                    zipCodeSearch = objS.GetZipOfSeedByCityId(cityId);
                }
                else
                    zipCodeSearch = currentAddress[3].Replace("\"", "").ToString();

                latSearch = currentAddress[4].Replace("\"", "").ToString();
                lngSearch = currentAddress[5].Replace("\"", "").ToString();
            }
            else
            {
                //MaxMind
                ipLocation = objCmnMethods.IP2AddressMaxMind();
                currentAddress = ipLocation.Split('\'');

                if (string.IsNullOrEmpty(currentAddress[7].ToString()))
                    stateSearch = "AZ";
                else
                    stateSearch = currentAddress[7].ToString();

                if (string.IsNullOrEmpty(currentAddress[5].ToString()))
                    citySearch = "Phoenix";
                else
                    citySearch = currentAddress[5].ToString();

                if (string.IsNullOrEmpty(currentAddress[15].ToString()))
                    zipCodeSearch = "85027";
                else
                    zipCodeSearch = currentAddress[15].ToString();

                latSearch = currentAddress[11].ToString();
                lngSearch = currentAddress[13].ToString();
            }

            ViewData["LocLat"] = latSearch;
            ViewData["LocLng"] = lngSearch;
            Session["LocLatLng"] = latSearch + "," + lngSearch;

            SeedAction objSeed = new SeedAction();
            IList<Seed> lstSeed = getHomeSearchResult(citySearch, "", "", zipCodeSearch, "");
            if (lstSeed.Count > 0)
            {
                ViewData["SeedList"] = lstSeed.OrderByDescending(x => x.createDate).ToList();
                ViewData["userLocation"] = "Your Location : " + citySearch + ", " + stateSearch;
                ViewData["CatLocation"] = citySearch + ", " + stateSearch;
            }
            else
            {
                lstSeed = repoObj.List<Seed>().Where(x => x.status.Equals(SystemStatements.STATUS_NEW) || x.status.Equals(SystemStatements.STATUS_GROWING)).OrderByDescending(x => x.createDate).Take(20).ToList();
                ViewData["SeedList"] = lstSeed;
                ViewData["userLocation"] = "Your Location : " + citySearch + ", " + stateSearch;
                ViewData["CatLocation"] = citySearch + ", " + stateSearch;
                ViewData["CitySearchMsg"] = "<span>Sorry, no seeds planted in '" + citySearch + "' area. Showing latest additions.</span>";
                string streamFeed = "Select top 20 * from Seed order by createDate desc";
                SessionStore.SetSessionValue(SessionStore.DefaultFeed, streamFeed);
            }

            string advSearch = TempData["DiscoverSeed"] as string;
            if (advSearch != "AdvanceSearch")
            {
                if (lstSeed.Count > 0)
                    SessionStore.SetSessionValue(SessionStore.DiscoverSeed, lstSeed);
            }

            if (SessionStore.GetSessionValue(SessionStore.DiscoverSeed) != null)
                lstSeed = (IList<Seed>)SessionStore.GetSessionValue(SessionStore.DiscoverSeed);

            int rowCount = lstSeed.Count;
            Session["RowCount"] = rowCount;
            Session["PageCount"] = "1";
            ViewData["SeedList"] = lstSeed.Take(10).ToList();
            ViewData["PrevVisibility"] = "visibility:hidden;";
            if (lstSeed.Count > 10)
                ViewData["NxtVisibility"] = "visibility:visible;";
            else
                ViewData["NxtVisibility"] = "visibility:hidden;";

            foreach (Seed sd in lstSeed)
            {
                sd.seedDistance = (int)objCmnMethods.distance(Convert.ToDouble(latSearch), Convert.ToDouble(lngSearch), Convert.ToDouble(sd.Location.localLat), Convert.ToDouble(sd.Location.localLong));
            }
            if (lstSeed.Count > 0)
                SessionStore.SetSessionValue(SessionStore.DiscoverSeed, lstSeed);
            ViewData["SeedList"] = lstSeed.OrderBy(x => x.seedDistance).ToList();

            ViewData["MarkerList"] = MarkerGenerator((IList<Seed>)ViewData["SeedList"]);

            //ListBox
            if (Session["SelectedCategory"] != null)
            {
                Session["SelectedCategory"] = null;
            }
            else
            {
                if (str != null)
                {
                    string myString = null;
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (i == 0)
                        {
                            myString = str[i];

                        }
                        else
                        {
                            myString = myString + "," + str[i];
                        }
                    }
                    Session["SelectedCategory"] = myString;
                    ViewData["SelectedCategories"] = myString;
                }
            }
            //ListBox
            if (lstSeed.Count > 0)
            {
                CategoryAction objCat = new CategoryAction();
                IList<Category> categ = new List<Category>();
                Category c = null;
                foreach (Seed s in lstSeed)
                {
                    IList<Category> listCategory = s.Categories.ToList();
                    if (listCategory.Count > 0)
                    {
                        foreach (Category c1 in listCategory)
                        {
                            c = objCat.GetCategoryById(s.Categories.FirstOrDefault().id.ToString());
                            if (c != null)
                                categ.Add(c);
                        }
                    }
                }
                ViewData["SeedCategories"] = categ.Distinct().ToList();
            }

            return View();
        }
コード例 #28
0
 private void GetDyingSeeds()
 {
     SeedAction objSeed = new SeedAction();
     IList<Seed> ListDyingSeeds = objSeed.GetAllDyingSeeds();
     ViewData["DyingSeeds"] = ListDyingSeeds;
 }
コード例 #29
0
 public void bindCheckBox()
 {
     SeedAction objSeed = new SeedAction();
     IList<Category> category;
     category = objSeed.GetAllCategories();
     string ids = string.Empty;
     foreach (Category sc in category)
     {
         if (ids.Length > 0)
         {
             ids = ids + "," + sc.id;
         }
         else
         {
             ids = sc.id.ToString();
         }
     }
     ViewData["ids"] = ids;
     ViewData["categoryId"] = category;
 }
コード例 #30
0
 private void GetFlagSeeds()
 {
     SeedAction objSeed = new SeedAction();
     IList<Seed> ListFlagSeeds = objSeed.GetFlaggedSeeds();
     ViewData["FlagSeeds"] = ListFlagSeeds;
 }