Esempio n. 1
0
		public OperationResult<bool> Export(JournalExportFilter filter)
		{
			return DbServiceHelper.InTryCatch(() =>
			{
				if (!Directory.Exists(filter.Path))
					throw new Exception("Папка не существует");
				var tableItems = _Table.Where(x => x.EnterTime >= filter.MinDate.CheckDate() & x.EnterTime <= filter.MaxDate.CheckDate());
				var items = tableItems.Select(x => Translate(x)).ToList();
				var serializer = new XmlSerializer(typeof(List<ExportPassJournalItem>));
				using (var fileStream = File.Open(NameXml, FileMode.Create))
				{
					serializer.Serialize(fileStream, items);
				}
				if (filter.Path != null)
				{
					var newPath = Path.Combine(filter.Path, NameXml);
					if (File.Exists(newPath))
						File.Delete(newPath);
					File.Move(NameXml, newPath);
				}
				return true;
			});
		}
Esempio n. 2
0
		public static bool ExportJournal(JournalExportFilter filter)
		{
			var result = ClientManager.RubezhService.ExportJournal(filter);
			return Common.ShowErrorIfExists(result);
		}
Esempio n. 3
0
		public OperationResult<bool> ExportJournal(JournalExportFilter filter)
		{
			return SafeOperationCall(() =>
			{
				var rubezhService = RubezhServiceFactory.Create(TimeSpan.FromMinutes(10));
				using (rubezhService as IDisposable)
					return rubezhService.ExportJournal(RubezhServiceFactory.UID, filter);
			}, "ExportJournal");
		}
Esempio n. 4
0
		public OperationResult<bool> ExportJournal(Guid clientUID, JournalExportFilter filter)
		{
			return SafeOperationCall(clientUID, () => RubezhService.ExportJournal(clientUID, filter), "ExportJournal");
		}
Esempio n. 5
0
		public OperationResult<bool> ExportJournal(Guid clientUID, JournalExportFilter filter)
		{
			var journalResult = new OperationResult<bool>(true);
			var passJournalResult = new OperationResult<bool>(true);
			if (filter.IsExportJournal)
			{
				using (var databaseService = new RubezhDAL.DataClasses.DbService())
				{
					journalResult = databaseService.JournalTranslator.JournalSynchroniser.Export(filter);
				}
			}
			if (filter.IsExportPassJournal)
			{
				using (var databaseService = new RubezhDAL.DataClasses.DbService())
				{
					passJournalResult = databaseService.PassJournalTranslator.Synchroniser.Export(filter);
				}
			}
			return RubezhDAL.DataClasses.DbServiceHelper.ConcatOperationResults(journalResult, passJournalResult);
		}