/// <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; }
/// <summary> /// Method to get all seeds by Id. /// </summary> /// <param name="SeedId"></param> /// <returns></returns> public string GetSeedsById(string SeedId, string MemberId) { #region SeedAction objSeed = new SeedAction(); Seed seedData = objSeed.GetSeedBySeedId(SeedId); int likesCount = seedData.Ratings.Where(x => x.likes.Equals("Like")).ToList().Count; int commitmentCount = seedData.Commitments.ToList().Count; int commentsCount = seedData.Comments.ToList().Count; string tmp = seedData.title + "||" + seedData.Member.firstName + " " + seedData.Member.lastName + "||" + seedData.Location.City.name + "||" + seedData.Location.crossStreet + "||" + seedData.Location.City.Region.name + "||" + Convert.ToDateTime(seedData.createDate).ToString("MMMM dd, yyyy") + "||" + seedData.description + "||" + likesCount + " Likes" + "||" + commitmentCount + " Commitments" + "||" + commentsCount + " Comments"; string tmpCategory = ""; foreach (Category c in seedData.Categories) { if (tmpCategory.Length > 0) tmpCategory = tmpCategory + ", " + c.name; else tmpCategory = c.name; } string keyword = ""; if (seedData.Tags != null && seedData.Tags.Count > 0) { keyword = seedData.Tags.FirstOrDefault().name.ToString(); tmp = tmp + "||" + tmpCategory + "||" + keyword; } else { tmp = tmp + "||" + tmpCategory + "||"; } tmp = tmp + "||" + seedData.Member.id.ToString() + "||" + seedData.Location.zipcode; int counter = objSeed.getSeedRatingCountByMemberId(SeedId,MemberId, "Like"); if (counter > 0) { tmp = tmp + "||" + "Disable"; } else { tmp = tmp + "||" + "Enable"; } tmp = tmp + "||" + seedData.Location.localLat.ToString() + "||" + seedData.Location.localLong.ToString(); string imgPath = "No Image"; if (seedData.Media != null && seedData.Media.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"; } } tmp = tmp + "||" + imgPath; return tmp; #endregion }