コード例 #1
0
        public static int AddToQueue(AttendancePhoto attendancePhoto)
        {
            SyncQueue queueItem = new SyncQueue() {type = SyncQueueType.sqtAttendancePhoto};

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

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

            return SaveSyncQueue(queueItem);
        }
コード例 #2
0
 public static int SaveSyncQueue(SyncQueue item)
 {
     return SyncQueueRepository.SaveSyncQueue(item);
 }
コード例 #3
0
        /// <summary>
        /// Insert or update a Doctor
        /// </summary>
        public static int SaveSyncQueue(SyncQueue item)
        {
            var max = 0;
            if (queue.Count > 0)
                max = queue.Max(x => x.id);

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

            WriteXml ();
            return item.id;
        }