Esempio n. 1
0
        public async void UpdateAttendance()
        {
            if (this.IsAttendanceFinished())
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    IsBusy = true;

                    _MarkAttendance                = new MarkAttendance();
                    _MarkAttendance.CourseId       = _SelectedActivity.CourseId;
                    _MarkAttendance.AttendanceList = new List <AttendanceDetail> ();

                    List <string> presentList = new List <string> ();
                    List <string> absentList  = new List <string> ();
                    foreach (ReporteeViewModel vm in ReporteeList)
                    {
                        if (vm.IsPresent)
                        {
                            presentList.Add(vm.UserName);
                        }
                        else
                        {
                            absentList.Add(vm.UserName);
                        }
                    }
                    AttendanceDetail attDetails = new AttendanceDetail()
                    {
                        Date        = ClassDay,
                        PresentList = presentList,
                        AbsentList  = absentList
                    };

                    _MarkAttendance.AttendanceList.Add(attDetails);
                    await AttendanceHandler.GetMarkAttendance(_MarkAttendance,
                                                              (responseMarkAttendance) => {
                        Debug.WriteLine("Success" + responseMarkAttendance.ResponseCode);
                        AttendanceHandler.GetAttendance(_SelectedActivity.CourseId,
                                                        (responseAttendance) => {
                            Debug.WriteLine("Success" + responseAttendance.AttendanceData);
                            PartnerCourseDetailPage _CourseDetailPage = new PartnerCourseDetailPage();
                            _CourseDetailPage.BindingContext          = new PartnerCourseDetailViewModel(_SelectedActivity, _reporteeList, responseAttendance.AttendanceData.AttendanceList, responseAttendance.AttendanceData);
                            NavigationHandler.GlobalNavigator.Navigation.PushAsync(_CourseDetailPage);
                            IsBusy = false;
                        },
                                                        (errorAttendance) => {
                            NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.ServerUnSuccess, Constants.OK_TEXT);
                            IsBusy = false;
                        });
                    },
                                                              (errorResponseMarkAttendance) => {
                        NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.ServerUnSuccess, Constants.OK_TEXT);
                        IsBusy = false;
                    });
                }
                else
                {
                    NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT);
                }
            }
        }
Esempio n. 2
0
 private async void OnCourseSelected()
 {
     if (CrossConnectivity.Current.IsConnected)
     {
         IsBusy = true;
         await ReportHandler.GetParticipantList(App.UserName, SelectedCourse.CourseId,
                                                (responseParticipantList) => {
             //Success callback
             Debug.WriteLine("Success" + responseParticipantList.ResponseCode);
             AttendanceHandler.GetAttendance(SelectedCourse.CourseId,
                                             (responseAttendance) => {
                 Debug.WriteLine("Success" + responseAttendance.AttendanceData);
                 PartnerCourseDetailPage _PartnerCourseDetailPage = new PartnerCourseDetailPage();
                 _PartnerCourseDetailPage.BindingContext          = new PartnerCourseDetailViewModel(SelectedCourse, responseParticipantList.Data.ReportList, responseAttendance.AttendanceData.AttendanceList, responseAttendance.AttendanceData);
                 NavigationHandler.GlobalNavigator.Navigation.PushAsync(_PartnerCourseDetailPage);
                 SelectedCourse = null;
                 IsBusy         = false;
             },
                                             (errorAttendance) => {
                 NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.ServerUnSuccess, Constants.OK_TEXT);
                 IsBusy = false;
             });
         },
                                                (errorResponseParticipantList) => {
             //Error callback
             NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.ServerUnSuccess, Constants.OK_TEXT);
             SelectedCourse = null;
             IsBusy         = false;
         });
     }
     else
     {
         NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT);
     }
 }
 private async Task FetchAttendanceReport(string courseId)
 {
     if (CrossConnectivity.Current.IsConnected)
     {
         IsBusy = true;
         await AttendanceHandler.GetAttendance(courseId,
                                               (response) => {
             this.GetAttendanceViewModelList(response.AttendanceData.AttendanceList, _SelectedCourse);
             IsBusy = false;
         },
                                               (errorRespnose) => {
             //Error callback
             //Debug.WriteLine ("Error:: /nCode: " + errorRespnose.ResponseCode + "/nMessage: " + errorRespnose.Status);
             NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.ServerUnSuccess, Constants.OK_TEXT);
             IsBusy = false;
         });
     }
     else
     {
         NavigationHandler.GlobalNavigator.DisplayAlert(Constants.APP_NAME, Constants.NETWORK_ERROR, Constants.OK_TEXT);
     }
 }