예제 #1
0
        /// <summary>
        /// Insert or update a AttendanceGPSPoint
        /// </summary>
        public static int SaveAttendanceGPSPoint(AttendanceGPSPoint item)
        {
            var max = 0;

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

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

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

            WriteXml();
            return(item.id);
        }
예제 #2
0
        public static int AddToQueue(AttendanceGPSPoint attendanceGPSPoint, Attendance attendance)
        {
            SyncQueue queueItem = new SyncQueue()
            {
                type           = SyncQueueType.sqtAttendanceGPSPoint,
                itemID         = attendanceGPSPoint.id,
                attendanceDate = attendance.date
            };

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

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

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

            return(SaveSyncQueue(queueItem, false));
        }
예제 #3
0
 public static int SaveAttendanceGPSPoint(AttendanceGPSPoint item)
 {
     return(AttendanceGPSPointRepository.SaveAttendanceGPSPoint(item));
 }
예제 #4
0
 public static int AddToQueue(AttendanceGPSPoint attendanceGPSPoint, Attendance attendance)
 {
     return(SyncQueueRepository.AddToQueue(attendanceGPSPoint, attendance));
 }