Пример #1
0
 /// <summary>
 /// Method to manage location.
 /// </summary>
 /// <param name="cityId"></param>
 /// <param name="zipcode"></param>
 /// <param name="localLat"></param>
 /// <param name="localLong"></param>
 /// <param name="crossStreet"></param>
 /// <returns>Location</returns>
 public Location CreateLocation(string cityId, string zipcode, double localLat, double localLong, string crossStreet)
 {
     #region Business Logic
     Location location = null;
     try
     {
         location = new Location();
         location.id = Guid.NewGuid();
         location.cityId = new Guid(cityId);
         location.zipcode = zipcode;
         location.localLat = localLat;
         location.localLong = localLong;
         location.crossStreet = crossStreet;
         repoObj.Create<Location>(location);
     }
     catch (Exception ex)
     {
         WriteError(ex);
     }
     return location;
     #endregion
 }
Пример #2
0
        public ActionResult SortDBData(string id)
        {
            #region
            Member memberData = (Member)SessionStore.GetSessionValue(SessionStore.Memberobject);
            LocationAction objLocation = new LocationAction();
            Location memberLocation = objLocation.GetMemberLocationById(memberData.id.ToString());
            if (memberLocation == null)
            {
                memberLocation = new Location();
                memberLocation.localLong = SystemStatements.DEFAULT_Long;
                memberLocation.localLat = SystemStatements.DEFAULT_Lat;
            }
            ViewData["Memberlocation"] = memberLocation;

            IList<Seed> listSeed = null;
            if (SessionStore.GetSessionValue(SessionStore.MySeeds) != null)
                listSeed = (IList<Seed>)SessionStore.GetSessionValue(SessionStore.MySeeds);

            if (listSeed.Count > 0)
            {
                switch (id)
                {
                    case "Proximity":
                        //listSeed = ProximitySort();
                        //ViewData["StreamSeedList"] = listSeed;
                        break;
                    case "Date":
                        listSeed.OrderByDescending(x => x.createDate).ToList();
                        break;
                    case "Category":
                        listSeed.OrderBy(x => x.Categories.FirstOrDefault() != null ? x.Categories.FirstOrDefault().name : "").ToList();
                        break;
                    case "Likes":
                        listSeed.OrderByDescending(x => x.Ratings.ToList().Count).ToList();
                        break;
                    case "Comments":
                        listSeed.OrderByDescending(x => x.Comments.ToList().Count).ToList();
                        break;
                    case "SeedReplies":
                        listSeed.OrderByDescending(x => x.Seed1.ToList().Count).ToList();
                        break;
                    default:
                        listSeed.OrderByDescending(x => x.createDate).ToList();
                        break;
                }
            }

            ViewData["ListSeed"] = listSeed;
            string markerList = "";
            foreach (Seed s1 in listSeed)
            {
                if (s1.Location.localLat != null && s1.Location.localLong != null)
                {
                    //if (string.IsNullOrEmpty(markerList))
                    //    markerList = s1.Location.localLat + "," + s1.Location.localLong;
                    //else
                    //    markerList += "," + s1.Location.localLat + "," + s1.Location.localLong;
                    markerList += s1.Location.localLat + "," + s1.Location.localLong + "," + s1.title + "-<b>" + s1.status + "</b> <br />" + s1.Location.City.name + " " + s1.Location.zipcode + ",";
                }
            }

            ViewData["LocationData"] = markerList;

            return View("Dashboard");
            #endregion
        }
Пример #3
0
        private void FixupLocation(Location previousValue)
        {
            if (previousValue != null && previousValue.ssStreams.Contains(this))
            {
                previousValue.ssStreams.Remove(this);
            }

            if (Location != null)
            {
                if (!Location.ssStreams.Contains(this))
                {
                    Location.ssStreams.Add(this);
                }
                if (locationId != Location.id)
                {
                    locationId = Location.id;
                }
            }
            else if (!_settingFK)
            {
                locationId = null;
            }
        }
Пример #4
0
 /// <summary>
 /// Method to Update location.
 /// </summary>
 /// <param name="location"></param>
 /// <returns>location</returns>
 public Location UpdateLocation(Location location)
 {
     #region Business Logic
     try
     {
         repoObj.Update<Location>(location);
     }
     catch (Exception ex)
     {
         WriteError(ex);
     }
     return location;
     #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
        }
Пример #6
0
        private void FixupLocation1(Location previousValue)
        {
            if (previousValue != null && previousValue.MemberProfiles1.Contains(this))
            {
                previousValue.MemberProfiles1.Remove(this);
            }

            if (Location1 != null)
            {
                if (!Location1.MemberProfiles1.Contains(this))
                {
                    Location1.MemberProfiles1.Add(this);
                }
                if (locationId != Location1.id)
                {
                    locationId = Location1.id;
                }
            }
            else if (!_settingFK)
            {
                locationId = null;
            }
        }
Пример #7
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
        }
Пример #8
0
        /// <summary>
        /// Method to Update Member profile.
        /// </summary>
        /// <param name="member"></param>
        /// <param name="sex"></param>
        /// <param name="dob"></param>
        /// <param name="location"></param>
        /// <returns></returns>
        public bool UpdateMemberProfile(Member member, string sex, DateTime dob, Location location, string url, string bio)
        {
            #region Business Logic

            bool updated = false;
            try
            {
                //see if member.MemberProfile is empty
                //if empty create new
                //if exists, update

                MemberProfile memberProfileData = repoObj.List<MemberProfile>(x => x.Member.id.Equals(member.id)).FirstOrDefault();

                if (memberProfileData == null)
                {
                    memberProfileData = new MemberProfile();
                    memberProfileData.id = Guid.NewGuid();
                    memberProfileData.locationId = location.id;
                    memberProfileData.memberId = member.id;
                    memberProfileData.sex = sex;
                    memberProfileData.setURL = url;
                    memberProfileData.bio = bio;
                    repoObj.Create<MemberProfile>(memberProfileData);
                }
                else
                {
                    memberProfileData.sex = sex;
                    memberProfileData.locationId = location.id;
                    memberProfileData.setURL = url;
                    memberProfileData.bio = bio;
                    repoObj.Update<MemberProfile>(memberProfileData);
                }
                updated = true;
            }
            catch (Exception ex)
            {
                WriteError(ex);
            }
            return updated;
            #endregion
        }