Example #1
0
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
                return;
            IsBusy = true;
            try
            {
                var user = App.Database.GetLoggedUser();
                #region Get ToReview List
                var toReview = await (new MyReviewServices()).GetReviewToReview(user.Id);
                SavedUserCount = toReview.Total;
                var n = toReview.Data;
                for (int i = 0; i < n.Count(); i++)
                {
                    MyNetworkModel h = n.ElementAt(i);
                    h.AverageRatingCount = h.Rating.ToString() + " (" + h.NoOfRatingUserCount.ToString() + ")";
                    if (h.Status)
                    {
                        h.bgcolor = "#32BDA0";
                        h.textcolor = "#FFFFFF";
                        h.helperStatus = "Available";
                    }
                    else
                    {
                        h.bgcolor = "#EAE9E9";
                        h.textcolor = "#000000";
                        h.helperStatus = "Not Available";
                    }

                    if (h.BookMark)
                        h.BookmarkImage = "save_filled.png";
                    else
                        h.BookmarkImage = "save.png";
                    n.Select(x => x.UserName == h.UserName ? h : x);
                }
                ToReviewList = new ObservableCollection<MyNetworkModel>(n);
                #endregion
                 
                #region Get Review List by me
                // byMeList = await (new MyReviewServices()).GetReviewByMe(user.Id);
                #endregion

                #region Get Review List about me
                var ReviewAboutMe = await (new MyReviewServices()).GetReviewAboutMe(user.Id);
                if(ReviewAboutMe.Total!=0)
                {
                    AboutMeList = ReviewAboutMe.Data;

                    AboutMeList.Where(x => (x.ReviewData == null || x.ReviewData.Count <= 0)).ToList().ForEach(y => y.isReplied = true);
                    AboutMeList.Where(x => (x.ReviewData != null && x.ReviewData.Count > 0)).ToList().ForEach(y => y.isNotReplied = true);
                }
                #endregion
                //aiFindHelper.IsRunning = false;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;
            try
            {
                RegisterUserModel user            = App.Database.GetLoggedUser();
                HelpersServices   helpersServices = new HelpersServices();
                var myNetwork = await helpersServices.GetMyNetworks(user.Id);

                var n = myNetwork.Data;
                for (int i = 0; i < n.Count(); i++)
                {
                    MyNetworkModel h = n.ElementAt(i);
                    // if (h.Service != null && h.Service.Count() != 0)
                    {
                        //HService hserv = h.Service.Where(x => x.ServiceName == "ChildCare").FirstOrDefault();
                        //if (hserv == null)
                        //{
                        //    hserv = h.Service.ElementAt(h.Service.Count() - 1);
                        //    h.ServiceName = hserv.ServiceName;
                        //    if (hserv.price.Daily)
                        //        h.ServicePriceLabel = "from $" + hserv.price.Min.Remove(hserv.price.Min.IndexOf(".")) + "-$" + hserv.price.Max.Remove(hserv.price.Max.IndexOf(".")) + "/Day";
                        //    else if (hserv.price.Monthly)
                        //        h.ServicePriceLabel = "from $" + hserv.price.Min.Remove(hserv.price.Min.IndexOf(".")) + "-$" + hserv.price.Max.Remove(hserv.price.Max.IndexOf(".")) + "/Month";
                        //    else if (hserv.price.Hours)
                        //        h.ServicePriceLabel = "from $" + hserv.price.Min.Remove(hserv.price.Min.IndexOf(".")) + "-$" + hserv.price.Max.Remove(hserv.price.Max.IndexOf(".")) + "/Hour";
                        //    if (hserv.Location != null && hserv.Location.Count() > 0)
                        //        h.ServiceLocationName = hserv.Location.ElementAt(0).LocationName;
                        //if (h.NoOfRatingUserCount == null)
                        //{
                        //    h.AverageRatingCount = "(0)";
                        //}
                        //else
                        //{
                        h.AverageRatingCount = h.Rating.ToString() + " (" + h.NoOfRatingUserCount.ToString() + ")";
                        //}
                        if (h.Status)
                        {
                            h.bgcolor      = "#32BDA0";
                            h.textcolor    = "#FFFFFF";
                            h.helperStatus = "Available";
                        }
                        else
                        {
                            h.bgcolor      = "#EAE9E9";
                            h.textcolor    = "#000000";
                            h.helperStatus = "Not Available";
                        }
                        n.Select(x => x.UserName == h.UserName ? h : x);
                    }
                }
                MyNetworkList = new ObservableCollection <MyNetworkModel>(n);
                //aiFindHelper.IsRunning = false;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;
            try
            {
                var user = App.Database.GetLoggedUser();
                #region get saved user
                HelpersServices helpersServices = new HelpersServices();
                var             savedUser       = await helpersServices.GetSavedUsers(user.Id);

                SavedUserCount = savedUser.Total;
                var n = savedUser.Data;
                for (int i = 0; i < n.Count(); i++)
                {
                    MyNetworkModel h = n.ElementAt(i);
                    h.AverageRatingCount = h.Rating.ToString() + " (" + h.NoOfRatingUserCount.ToString() + ")";
                    if (h.Status)
                    {
                        h.bgcolor      = "#32BDA0";
                        h.textcolor    = "#FFFFFF";
                        h.helperStatus = "Available";
                    }
                    else
                    {
                        h.bgcolor      = "#EAE9E9";
                        h.textcolor    = "#000000";
                        h.helperStatus = "Not Available";
                    }
                    n.Select(x => x.UserName == h.UserName ? h : x);
                }
                SavedUserList = new ObservableCollection <MyNetworkModel>(n);
                #endregion

                #region get saved job posts
                JobServices jobServices = new JobServices();
                var         js          = await jobServices.GetSavedJobs(user.Id);

                SavedJobsCount = js.Total;
                for (int i = 0; i < js.Data.Count(); i++)
                {
                    JobsHome j = js.Data.ElementAt(i);
                    if (j != null)
                    {
                        if (j.JobType == "N")
                        {
                            j.JobType      = "Normal";
                            j.JobBgColor   = "#289EF5";
                            j.JobTextColor = "#FFFFFF";
                        }
                        else if (j.JobType == "U")
                        {
                            j.JobType      = "Urgent";
                            j.JobBgColor   = "#F63D38";
                            j.JobTextColor = "#FFFFFF";
                        }
                        else
                        {
                            j.JobType      = "Sponsored";
                            j.JobBgColor   = "#FCDC55";
                            j.JobTextColor = "#000000";
                        }
                    }
                    if (j.Location != null && j.Location.Count() > 0)
                    {
                        j.JobLocationName = j.Location.ElementAt(0).LocationName;
                    }
                    if (j.IsDaily)
                    {
                        j.JobPriceLabel = "From $" + j.MinDailyPrice.Remove(j.MinDailyPrice.IndexOf(".")) + "-$" + j.MaxDailyPrice.Remove(j.MaxDailyPrice.IndexOf(".")) + "/Day";
                    }
                    else
                    if (j.IsMonthly)
                    {
                        j.JobPriceLabel = "From $" + j.MinMonthlyPrice.Remove(j.MinMonthlyPrice.IndexOf(".")) + "-$" + j.MaxMonthlyPrice.Remove(j.MaxMonthlyPrice.IndexOf(".")) + "/Month";
                    }
                    else
                    if (j.IsHourly)
                    {
                        j.JobPriceLabel = "From $" + j.MinHourlyPrice.Remove(j.MinHourlyPrice.IndexOf(".")) + "-$" + j.MaxHourlyPrice.Remove(j.MaxHourlyPrice.IndexOf(".")) + "/Hour";
                    }
                    j.createDate = j.CreateDate.Substring(0, 10);
                    js.Data.Select(x => x.JobId == j.JobId ? j : x);
                }
                SavedJobPostsList = new ObservableCollection <JobsHome>(js.Data);
                #endregion
                //aiFindHelper.IsRunning = false;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }