Exemplo n.º 1
0
        /// <summary>
        /// Insert or update a Doctor
        /// </summary>
        public static int SaveAttendancePhoto(AttendancePhoto item)
        {
            var max = 0;

            if (attendancePhotos.Count > 0)
            {
                max = attendancePhotos.Max(x => x.id);
            }

            if (item.id <= 0)
            {
                item.id = ++max;

//				SyncQueueManager.AddToQueue (item);

                attendancePhotos.Add(item);
            }
            else
            {
                var i = attendancePhotos.Find(x => x.id == item.id);
                if (i != null)
                {
                    i = item;                     // replaces item in collection with updated value
                }
                else
                {
                    attendancePhotos.Add(item);
                }
            }

            WriteXml();
            return(item.id);
        }
Exemplo n.º 2
0
        public override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult (requestCode, resultCode, data);

            if (resultCode == Result.Ok) {
                // Make it available in the gallery
            //				Intent mediaScanIntent = new Intent (Intent.ActionMediaScannerScanFile);
            //				Android.Net.Uri contentUri = Android.Net.Uri.FromFile (file);
            //				mediaScanIntent.SetData (contentUri);
            //
            //				Activity.SendBroadcast (mediaScanIntent);
            //
                AttendancePhoto attPhoto = new AttendancePhoto () {
                    photoPath = file.ToString (),
                    stamp = DateTime.Now,
                    subType = currentPhotoSubTypes[spnPhotoSubTypes.SelectedItemPosition].id
                };

                //Latitude and Longitude
                ExifInterface exif = new ExifInterface (attPhoto.photoPath);
                float[] lat_long = new float[2];
                if (exif.GetLatLong (lat_long)) {
                    attPhoto.latitude = lat_long [0];
                    attPhoto.longitude = lat_long [1];
                }

                newAttendancePhotos.Add (attPhoto);
                AttendancePhotoManager.SetCurrentAttendancePhotos (newAttendancePhotos);

                RefreshPhotoList ();
            }

            // Dispose of the Java side bitmap.
            GC.Collect();
        }
Exemplo n.º 3
0
        public static int AddToQueue(AttendancePhoto attendancePhoto, Attendance attendance)
        {
            SyncQueue queueItem = new SyncQueue()
            {
                type           = SyncQueueType.sqtAttendancePhoto,
                itemID         = attendancePhoto.id,
                attendanceDate = attendance.date
            };

            queueItem.fileLocation = Path.Combine(Common.DatabaseFileDir, fUserName, @"SyncQueue", String.Format("attendancePhoto_{0}.xml", Guid.NewGuid()));

            new FileInfo(queueItem.fileLocation).Directory.Create();
            var serializer = new XmlSerializer(typeof(AttendancePhoto));

            using (var writer = new StreamWriter(queueItem.fileLocation))
            {
                serializer.Serialize(writer, attendancePhoto);
            }

            return(SaveSyncQueue(queueItem, false));
        }
Exemplo n.º 4
0
        public static int AddToQueue(AttendancePhoto attendancePhoto, Attendance attendance)
        {
            SyncQueue queueItem = new SyncQueue() {
                type = SyncQueueType.sqtAttendancePhoto,
                itemID = attendancePhoto.id,
                attendanceDate = attendance.date
            };

            queueItem.fileLocation = Path.Combine(Common.DatabaseFileDir, fUserName, @"SyncQueue", String.Format("attendancePhoto_{0}.xml", Guid.NewGuid()));

            new FileInfo(queueItem.fileLocation).Directory.Create();
            var serializer = new XmlSerializer(typeof(AttendancePhoto));
            using (var writer = new StreamWriter(queueItem.fileLocation))
            {
                serializer.Serialize(writer, attendancePhoto);
            }

            return SaveSyncQueue(queueItem, false);
        }
Exemplo n.º 5
0
 public static int SaveAttendancePhoto(AttendancePhoto item)
 {
     return(AttendancePhotoRepository.SaveAttendancePhoto(item));
 }
Exemplo n.º 6
0
 public static int AddToQueue(AttendancePhoto attendancePhoto, Attendance attendance)
 {
     return SyncQueueRepository.AddToQueue(attendancePhoto, attendance);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Insert or update a Doctor
        /// </summary>
        public static int SaveAttendancePhoto(AttendancePhoto item)
        {
            var max = 0;
            if (attendancePhotos.Count > 0)
                max = attendancePhotos.Max(x => x.id);

            if (item.id <= 0) {
                item.id = ++max;

            //				SyncQueueManager.AddToQueue (item);

                attendancePhotos.Add (item);
            } else {
                var i = attendancePhotos.Find (x => x.id == item.id);
                if (i != null) {
                    i = item; // replaces item in collection with updated value
                } else {
                    attendancePhotos.Add (item);
                }
            }

            WriteXml ();
            return item.id;
        }
Exemplo n.º 8
0
 public static int SaveAttendancePhoto(AttendancePhoto item)
 {
     return AttendancePhotoRepository.SaveAttendancePhoto(item);
 }
Exemplo n.º 9
0
 public static int AddToQueue(AttendancePhoto attendancePhoto, Attendance attendance)
 {
     return(SyncQueueRepository.AddToQueue(attendancePhoto, attendance));
 }