コード例 #1
0
ファイル: JournalViewModel.cs プロジェクト: hjlfmy/Rubezh
        void OnNewJournal(List<JournalItem> journalItems)
        {
            foreach (var journalItem in journalItems)
            {
                if (FilterRecord(journalItem) == false)
                    continue;

                var journalItemViewModel = new JournalItemViewModel(journalItem);
                if (JournalItems.Count > 0)
                    JournalItems.Insert(0, journalItemViewModel);
                else
                    JournalItems.Add(journalItemViewModel);

                if (JournalItems.Count > JournalFilter.LastRecordsCount)
                    JournalItems.RemoveAt(JournalFilter.LastRecordsCount);
            }

            if (SelectedJournal == null)
                SelectedJournal = JournalItems.FirstOrDefault();
        }
コード例 #2
0
ファイル: JournalReport.cs プロジェクト: saeednazari/Rubezh
		public ReportData GetData()
		{
			ReportArchiveFilter.LoadArchive();
			var data = new ReportData();
			data.ReportDocumentValues.Add("StartDate", ReportArchiveFilter.StartDate);
			data.ReportDocumentValues.Add("EndDate", ReportArchiveFilter.EndDate);

			var table = new DataTable("Journal");
			table.Columns.Add("DeviceDateTime");
			table.Columns.Add("SystemDateTime");
			table.Columns.Add("Name");
			table.Columns.Add("Description");
			table.Columns.Add("ObjectName");
			foreach (var journalItem in ReportArchiveFilter.JournalItems)
			{
				var journalItemViewModel = new JournalItemViewModel(journalItem);
				var objectName = "";
				if (journalItemViewModel.Device != null)
				{
					objectName = journalItemViewModel.Device.PresentationName;
				}
				if (journalItemViewModel.Zone != null)
				{
					objectName = journalItemViewModel.Zone.PresentationName;
				}
				if (journalItemViewModel.Direction != null)
				{
					objectName = journalItemViewModel.Direction.PresentationName;
				}
				table.Rows.Add(
					journalItem.DeviceDateTime,
					journalItem.SystemDateTime,
					journalItem.Name,
					journalItem.Description,
					objectName);
			}
			data.DataTables.Add(table);
			PdfProvider.ReportData = data;
			return data;
		}
コード例 #3
0
		public static void OnNewJournal(List<JournalItem> journalItems)
		{
			if (ClientSettings.AutoActivationSettings.IsAutoActivation)
			{
				if ((Application.Current.MainWindow != null) && (!Application.Current.MainWindow.IsActive))
				{
					Application.Current.MainWindow.WindowState = System.Windows.WindowState.Maximized;
					Application.Current.MainWindow.Activate();
				}
			}
			if (ClientSettings.AutoActivationSettings.IsPlansAutoActivation)
			{
				foreach (var journalItem in journalItems)
				{
					var journalItemViewModel = new JournalItemViewModel(journalItem);

					var globalStateClass = XManager.GetMinStateClass();

					if (journalItem.StateClass <= globalStateClass ||
						(globalStateClass != XStateClass.Fire1 && globalStateClass != XStateClass.Fire2 && globalStateClass != XStateClass.Attention))
					{
						switch (journalItem.JournalItemType)
						{
							case JournalItemType.Device:
								var device = XManager.Devices.FirstOrDefault(x => x.UID == journalItem.ObjectUID);
								if (device != null)
								{
									var existsOnPlan = FiresecManager.PlansConfiguration.AllPlans.Any(x => { return x.ElementXDevices.Any(y => y.XDeviceUID == device.UID); });
									if (existsOnPlan)
									{
										ServiceFactory.Events.GetEvent<ShowXDeviceOnPlanEvent>().Publish(device);
									}
								}
								break;

							case JournalItemType.Zone:
								var zone = XManager.Zones.FirstOrDefault(x => x.UID == journalItem.ObjectUID);
								if (zone != null)
								{
									var existsOnPlan = FiresecManager.PlansConfiguration.AllPlans.Any(x => { return x.ElementRectangleXZones.Any(y => y.ZoneUID == zone.UID); });
									if (existsOnPlan)
									{
										ServiceFactory.Events.GetEvent<ShowXZoneOnPlanEvent>().Publish(zone);
									}
									existsOnPlan = FiresecManager.PlansConfiguration.AllPlans.Any(x => { return x.ElementPolygonXZones.Any(y => y.ZoneUID == zone.UID); });
									if (existsOnPlan)
									{
										ServiceFactory.Events.GetEvent<ShowXZoneOnPlanEvent>().Publish(zone);
									}
								}
								break;

							case JournalItemType.Direction:
								var direction = XManager.Directions.FirstOrDefault(x => x.UID == journalItem.ObjectUID);
								if (direction != null)
								{
									var existsOnPlan = FiresecManager.PlansConfiguration.AllPlans.Any(x => { return x.ElementRectangleXDirections.Any(y => y.DirectionUID == direction.UID); });
									if (existsOnPlan)
									{
										ServiceFactory.Events.GetEvent<ShowXDirectionOnPlanEvent>().Publish(direction);
									}
									existsOnPlan = FiresecManager.PlansConfiguration.AllPlans.Any(x => { return x.ElementPolygonXDirections.Any(y => y.DirectionUID == direction.UID); });
									if (existsOnPlan)
									{
										ServiceFactory.Events.GetEvent<ShowXDirectionOnPlanEvent>().Publish(direction);
									}
								}
								break;
						}
					}
				}
			}
		}
コード例 #4
0
		public ConfirmationViewModel(JournalItem journalItem)
		{
			Title = "Подтверждение критических событий";
			ConfirmCommand = new RelayCommand(OnConfirm);
			JournalItemViewModel = new JournalItemViewModel(journalItem);
		}
コード例 #5
0
		void OnRead()
		{
			if (StartIndex > EndIndex)
			{
				IsNotEmpty = false;
				return;
			}

			JournalItems.Clear();
			try
			{
				LoadingService.Show("Чтение записей журнала", "Чтение записей журнала", 2 + EndIndex - StartIndex, true);
				for (int i = StartIndex; i <= EndIndex; i++)
				{
					if (LoadingService.IsCanceled)
						break;
					LoadingService.DoStep("Чтение записи " + i);
					var result = FiresecManager.FiresecService.GKReadJournalItem(Device, i);
					if (result.HasError)
					{
						MessageBoxService.Show(result.Error);
						break;
					}
					var journalItemViewModel = new JournalItemViewModel(result.Result);
					JournalItems.Add(journalItemViewModel);
				}
				IsNotEmpty = true;
			}
			finally
			{
				LoadingService.Close();
			}
		}
コード例 #6
0
ファイル: JournalViewModel.cs プロジェクト: xbadcode/Rubezh
		void OnRead()
		{
			if (EndIndex < StartIndex)
			{
				MessageBoxService.ShowError("Конечный номер записи меньше начального");
				IsNotEmpty = false;
				return;
			}
			if (StartIndex < 1 || EndIndex > TotalCount)
			{
				MessageBoxService.ShowError("Номер записи должен быть в диапазоне от 1 до " + TotalCount);
				IsNotEmpty = false;
				return;
			}

			JournalItems.Clear();
			try
			{
				LoadingService.Show("Чтение записей журнала", "Чтение записей журнала", 2 + EndIndex - StartIndex, true);
				for (int i = StartIndex; i <= EndIndex; i++)
				{
					if (LoadingService.IsCanceled)
						break;
					LoadingService.DoStep("Чтение записи " + i);
					var result = ClientManager.RubezhService.GKReadJournalItem(Device, i);
					if (result.HasError)
					{
						MessageBoxService.Show(result.Error);
						break;
					}
					var journalItemViewModel = new JournalItemViewModel(result.Result);
					JournalItems.Add(journalItemViewModel);
				}
				IsNotEmpty = true;
			}
			finally
			{
				LoadingService.Close();
			}
		}
コード例 #7
0
		void OnGetFilteredArchiveCompleted(IEnumerable<JournalItem> journalItems)
		{
			JournalItems = new ObservableCollection<JournalItemViewModel>();
			foreach (var journalItem in journalItems)
			{
				var journalItemViewModel = new JournalItemViewModel(journalItem);
				JournalItems.Add(journalItemViewModel);
			}
			SelectedJournal = JournalItems.FirstOrDefault();

			Status = "Всего записей " + journalItems.Count().ToString();
		}
コード例 #8
0
ファイル: ArchiveViewModel.cs プロジェクト: hjlfmy/Rubezh
        void OnGetFilteredArchiveCompleted(IEnumerable<JournalItem> journalRecords)
        {
            JournalItems = new ObservableCollection<JournalItemViewModel>();
            foreach (var journalRecord in journalRecords)
            {
                var journalRecordViewModel = new JournalItemViewModel(journalRecord);
                JournalItems.Add(journalRecordViewModel);
            }
            SelectedJournal = JournalItems.FirstOrDefault();

            Status = null;
        }