/// <summary> /// Добавление или обновление записи о синхронизации /// </summary> public static int SaveSyncQueue(SyncQueue item, bool isWriteXml = true) { 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); } } if (isWriteXml) { WriteXml(); } return(item.id); }
public static int AddToQueue(AttendanceResult attendanceResult, Attendance attendance) { SyncQueue queueItem = new SyncQueue() { type = SyncQueueType.sqtAttendanceResult, itemID = attendanceResult.id, attendanceDate = attendance.date }; queueItem.fileLocation = Path.Combine(Common.DatabaseFileDir, fUserName, @"SyncQueue", String.Format("attendanceResult_{0}.xml", Guid.NewGuid())); new FileInfo(queueItem.fileLocation).Directory.Create(); var serializer = new XmlSerializer(typeof(AttendanceResult)); using (var writer = new StreamWriter(queueItem.fileLocation)) { serializer.Serialize(writer, attendanceResult); } return SaveSyncQueue(queueItem, false); }
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)); }
/// <summary> /// Добавление или обновление записи о синхронизации /// </summary> public static int SaveSyncQueue(SyncQueue item, bool isWriteXml = true) { 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); } } if (isWriteXml) { WriteXml (); } return item.id; }
public static int DeleteSyncQueue(SyncQueue item) { return DeleteSyncQueue(item.id); }
public static int SaveSyncQueue(SyncQueue item, bool isWriteXml) { return SyncQueueRepository.SaveSyncQueue(item, isWriteXml); }
public static int SaveSyncQueue(SyncQueue item, bool isWriteXml) { return(SyncQueueRepository.SaveSyncQueue(item, isWriteXml)); }
public static int DeleteSyncQueue(SyncQueue item) { return(DeleteSyncQueue(item.id)); }