示例#1
0
        async void OnSave(object sender, EventArgs e)
        {
            int      id      = 0;
            string   comment = commentTxt.Text.TrimEnd();
            double   rate    = Math.Round(slider.Value, 2);
            DateTime today   = DateTime.Today;

            //Enterprise Feedback to Applicant
            if (enterprise != null)
            {
                JSFeedback jsfeedback     = new JSFeedback(id, enterprise.CompanyName, enterprise.Username, jobseeker.Name, jobseeker.Username, submission.Id, today, comment, rate);
                var        savejsfeedback = await entmanager.SaveFeedback(jsfeedback);

                if (savejsfeedback != null)
                {
                    submission.Status = "Ent Completed";
                    var updatesubmission = await entmanager.UpdateSubmission(submission);

                    if (updatesubmission != null)
                    {
                        await DisplayAlert("Submitted Successful", "Feedback submitted successfully.", "Cancel");

                        await Navigation.PopModalAsync();
                    }
                    else
                    {
                        await DisplayAlert("Error Message", "Something wents wrong in updating status.", "Cancel");
                    }
                }
                else
                {
                    await DisplayAlert("Sumission Failed", "Feedback fail to submit.", "Cancel");

                    await Navigation.PopModalAsync();
                }
            }
            else
            {
                var ent = await jsmanager.GetEnterprise(job.Entusername);

                EntFeedback entfeedback = new EntFeedback(id, ent.CompanyName, job.Entusername, jobseeker.Name, jobseeker.Username, submission.Id, today, comment, rate);
                var         convert     = JsonConvert.SerializeObject(entfeedback);
                await DisplayAlert("Submitted Successful", convert, "Cancel");

                var savefeedback = await jsmanager.SaveEntFeedback(entfeedback);

                if (savefeedback != null)
                {
                    submission.Status = "User Completed";
                    var updatesubmission = await jsmanager.UpdateSubmission(submission);

                    if (updatesubmission != null)
                    {
                        await DisplayAlert("Submitted Successful", "Feedback submitted successfully.", "Cancel");

                        await Navigation.PopModalAsync();
                    }
                    else
                    {
                        await DisplayAlert("Error Message", "Something wents wrong in updating status.", "Cancel");
                    }
                }
                else
                {
                    await DisplayAlert("Sumission Failed", "Feedback fail to submit.", "Cancel");

                    await Navigation.PopModalAsync();
                }
            }
        }