예제 #1
0
        async void ViewProfile(object sender, ItemTappedEventArgs e)
        {
            Submission submit = (Submission)e.Item;
            int        count = 0, divide = 0;
            double     rate = 0, total = 0;
            string     admin = null;

            var searchjs = await entmanager.GetJobSeekerByUsername(submit.Username);

            if (searchjs != null)
            {
                jobseeker = searchjs;
            }

            var feedback = await jsmanager.GetAllJSFeedback(jobseeker.Username);

            foreach (JSFeedback jsfeedback in feedback)
            {
                if (jsfeedbacks.All(b => b.Id != jsfeedback.Id))
                {
                    divide++;
                    rate += jsfeedback.Rating;
                }
            }

            rate = rate / divide;

            //tap method to view user profile
            if (job.Status.Equals("End") && (submit.Status.Equals("User Approved") || submit.Status.Equals("JS Completed")))
            {
                var check = await entmanager.CheckJSFeedback(submit.Id);

                foreach (JSFeedback jsfeedback in check)
                {
                    if (jsfeedbacks.All(b => b.Id != jsfeedback.Id))
                    {
                        if (jsfeedback.Submissionid != submit.Id)
                        {
                            count++;
                        }
                    }
                }

                if (count == 0)
                {
                    await Navigation.PushModalAsync(new Feedback(job, jobseeker, enterprise, submit));
                }
                else
                {
                    // view job seeker profile
                    await Navigation.PushModalAsync(new ProfileJobSeeker(jobseeker, enterprise, rate, admin));
                }
            }
            else
            {
                //view job seeker profile
                await Navigation.PushModalAsync(new ProfileJobSeeker(jobseeker, enterprise, rate, admin));
            }
        }