void UpEndAttendance_Click(object sender, EventArgs e) { isVisitStart = false; Common.SetIsAttendanceRun(user.username, isVisitStart); locMgr.RemoveUpdates(this); // SAVE upPrevBlock.Visibility = ViewStates.Gone; upNextBlock.Visibility = ViewStates.Gone; FragmentManager.BeginTransaction().Remove(fragment).Commit(); fragmentNum = 1; Attendance newAttendance = AttendanceManager.GetCurrentAttendance(); List <AttendanceResult> newAttendanceResults = AttendanceResultManager.GetCurrentAttendanceResults(); List <AttendancePhoto> newAttendancePhotos = AttendancePhotoManager.GetCurrentAttendancePhotos(); // List<AttendanceGPSPoint> newAttendanceGPSPoints = AttendanceGPSPointManager.GetCurrentAttendanceGPSPoints (); int attID = AttendanceManager.SaveAttendance(newAttendance); if (newAttendanceResults != null) { AttendanceResultManager.SaveNewAttendanceResults(attID, newAttendanceResults); } if (newAttendancePhotos != null) { AttendancePhotoManager.SaveNewAttendancePhotos(attID, newAttendancePhotos); } if (attendanceGPSPoints != null) { AttendanceGPSPointManager.SaveNewAttendanceGPSPoints(attID, attendanceGPSPoints); } //Correct Pharmacy Pharmacy pharmacy = PharmacyManager.GetPharmacy(selectedPharmacyID); pharmacy.prev = DateTime.Now; pharmacy.next = DateTimeFormatInfo.CurrentInfo.Calendar.AddWeeks(pharmacy.prev, 2); PharmacyManager.SavePharmacy(pharmacy); //Clear AttendanceManager.SetCurrentAttendance(null); AttendanceResultManager.SetCurrentAttendanceResults(null); AttendancePhotoManager.SetCurrentAttendancePhotos(null); RefreshMainView(); }
public async Task SaveAttendance() { // EO TODO This is ugly as... // Clear list to avoid double ups... this.Attendance.PlayerAttendances.Clear(); // Join both casual and permanents that have been marked as attended try { foreach (var attendance in this.TermPlayerAttendances) //this.Attendance.PlayerAttendances.Add(attendance); { if (attendance.HasAttended) { this.Attendance.PlayerAttendances.Add(attendance); } } foreach (var attendance in this.CasualPlayerAttendances) //this.Attendance.PlayerAttendances.Add(attendance); { if (attendance.HasAttended) { this.Attendance.PlayerAttendances.Add(attendance); } } } catch (Exception ex) { var s = 3; } //this.Attendance.AttendanceDate = DateTime.Now; var attendanceMgr = new AttendanceManager(); // Close after save... var att = await attendanceMgr.SaveAttendance(this.Attendance); this.AttendanceSaved(att); //var termMgr = new TermManager(); }