public OrganisationDoorViewModel(Organisation organisation, GKDoor door) { DoorUID = door.UID; PresentationName = door.PresentationName; No = door.No; IsChecked = organisation != null && organisation.DoorUIDs.Contains(door.UID); }
/* RG-1324 Если в однопроходной ТД зажата кнопка на выход, то, при повторном включении ТД, должен включаться отсчёт удержания */ public void TestOneWayDoorCase1() { var lockDevice = AddDevice(kauDevice11, GKDriverType.RSR2_RM_1); var enterDevice = AddDevice(kauDevice11, GKDriverType.RSR2_CardReader); var exitDevice = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); var door = new GKDoor { No = 1, Name = "Точка доступа", DoorType = GKDoorType.OneWay, EnterDevice = enterDevice, EnterDeviceUID = enterDevice.UID, ExitDevice = exitDevice, ExitDeviceUID = exitDevice.UID, LockDevice = lockDevice, LockDeviceUID = lockDevice.UID, Hold = 60, Delay = 0}; GKManager.AddDoor(door); SetConfigAndRestartImitator(); WaitWhileState(door, XStateClass.Off, 10000, "Ждём состояние Закрыто в ТД"); Assert.IsTrue(door.State.StateClass == XStateClass.Off, "Проверка того, ТД Закрыта"); ConrtolGKBase(exitDevice, GKStateBit.Fire1, "Зажатие кнопки на выход"); WaitWhileState(exitDevice, XStateClass.Fire1, 3000, "Ждём Сработку1 кнопки на выход"); Assert.IsTrue(exitDevice.State.StateClass == XStateClass.Fire1, "Проверка того, что кнопка на выход в Сработке1"); WaitWhileState(door, XStateClass.On, 3000, "Ждём Включено в ТД"); Assert.IsTrue(door.State.StateClass == XStateClass.On, "Проверяем, что ТД Включена"); ConrtolGKBase(door, GKStateBit.TurnOff_InAutomatic, "Выключение ТД"); WaitWhileState(door, XStateClass.On, 3000, "Ждём Включено в ТД"); Assert.IsTrue(door.State.StateClass == XStateClass.On, "Проверяем, что ТД Выключена"); // RG 1324 Assert.IsTrue(door.State.HoldDelay > 0, "Проверка того, что ТД на Удeржании"); Thread.Sleep(1000); CheckJournal(7, JournalItem(exitDevice, JournalEventNameType.Сработка_1), JournalItem(door, JournalEventNameType.Включено), JournalItem(lockDevice, JournalEventNameType.Включено), JournalItem(door, JournalEventNameType.Выключено), JournalItem(lockDevice, JournalEventNameType.Выключено), JournalItem(door, JournalEventNameType.Включено), JournalItem(lockDevice, JournalEventNameType.Включено)); }
public Door(GKDoor door) : base(door) { No = door.No; GKDescriptorNo = door.GKDescriptorNo; DoorTypeString = door.DoorType.ToDescription(); DoorType = door.DoorType; Desription = door.Description; Delay = door.Delay; Hold = door.Hold; ImageSource = door.ImageSource.Replace("/Controls;component/", ""); if (door.EnterDevice != null) EnterDevice = new DoorDevice(door.EnterDevice); if (door.ExitDevice != null) ExitDevice = new DoorDevice(door.ExitDevice); if (door.EnterButton != null) EnterButton = new DoorDevice(door.EnterButton); if (door.ExitButton != null) ExitButton = new DoorDevice(door.ExitButton); if (door.LockDevice != null) LockDevice = new DoorDevice(door.LockDevice); if (door.LockDeviceExit != null) LockDeviceExit = new DoorDevice(door.LockDeviceExit); if (door.LockControlDevice != null) LockControlDevice = new DoorDevice(door.LockControlDevice); if (door.LockControlDeviceExit != null) LockControlDeviceExit = new DoorDevice(door.LockControlDeviceExit); var zone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.ExitZoneUID); if (zone != null) ExitZone = new Tuple<string, Guid>(zone.PresentationName, zone.UID); zone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.EnterZoneUID); if (zone != null) EnterZone = new Tuple<string, Guid>(zone.PresentationName, zone.UID); OpenRegimeLogic = GKManager.GetPresentationLogic(door.OpenRegimeLogic.OnClausesGroup); NormRegimeLogic = GKManager.GetPresentationLogic(door.NormRegimeLogic.OnClausesGroup ); CloseRegimeLogic = GKManager.GetPresentationLogic(door.CloseRegimeLogic.OnClausesGroup); State = DoorStateClassToStringConverter.Converter(door.State.StateClass); StateIcon = door.State.StateClass.ToString(); StateClasses = door.State.StateClasses.Select(x => new StateClass { Name = DoorStateClassToStringConverter.Converter(x), IconData = x.ToString() }).ToList(); StateColor = "'#" + new XStateClassToColorConverter2().Convert(door.State.StateClass, null, null, null).ToString().Substring(3) + "'"; HasHoldDelay = door.State.StateClasses.Contains(XStateClass.On) && door.State.HoldDelay > 0; HasOffDelay = door.State.StateClasses.Contains(XStateClass.TurningOff) && door.State.OffDelay > 0; OffDelay = HasOffDelay? door.State.OffDelay.ToString(): string.Empty; HoldDelay = HasHoldDelay? door.State.HoldDelay.ToString(): string.Empty; var controlRegime = door.State.StateClasses.Contains(XStateClass.Ignore) ? DeviceControlRegime.Ignore : !door.State.StateClasses.Contains(XStateClass.AutoOff) ? DeviceControlRegime.Automatic : DeviceControlRegime.Manual; //ControlRegimeIcon = "data:image/gif;base64," + InternalConverter.GetImageResource(((string)new DeviceControlRegimeToIconConverter().Convert(controlRegime)) ?? string.Empty).Item1; ControlRegimeName = controlRegime.ToDescription(); ControlRegimeIcon = (new DeviceControlRegimeToIconConverter()).Convert(controlRegime); CanSetAutomaticState = (controlRegime != DeviceControlRegime.Automatic); CanSetManualState = (controlRegime != DeviceControlRegime.Manual); CanSetIgnoreState = (controlRegime != DeviceControlRegime.Ignore); IsControlRegime = (controlRegime == DeviceControlRegime.Manual); }
public DoorViewModel(GKDoor door) { Door = door; DoorDetailsViewModel = new DoorDetailsViewModel(door); State.StateChanged -= OnStateChanged; State.StateChanged += OnStateChanged; OnStateChanged(); EnterDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.EnterDeviceUID); ExitDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.ExitDeviceUID); EnterButton = GKManager.Devices.FirstOrDefault(x => x.UID == Door.EnterButtonUID); ExitButton = GKManager.Devices.FirstOrDefault(x => x.UID == Door.ExitButtonUID); LockDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockDeviceUID); LockDeviceExit = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockDeviceExitUID); LockControlDevice = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockControlDeviceUID); LockControlDeviceExit = GKManager.Devices.FirstOrDefault(x => x.UID == Door.LockControlDeviceExitUID); EnterZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == Door.EnterZoneUID); ExitZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == Door.ExitZoneUID); ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan); ShowJournalCommand = new RelayCommand(OnShowJournal); ShowPropertiesCommand = new RelayCommand(OnShowProperties); ShowOnPlanOrPropertiesCommand = new RelayCommand(OnShowOnPlanOrProperties); ShowDeviceCommand = new RelayCommand<GKDevice>(OnShowDevice); ShowZoneCommand = new RelayCommand<GKSKDZone>(OnShowZone); }
public void TestOneWayHasNoDevices() { var enterDevice = AddDevice(kauDevice11, GKDriverType.RSR2_CardReader); var exitDevice = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); var lockDevice = AddDevice(kauDevice11, GKDriverType.RSR2_RM_1); var lockControlDevice = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); var door = new GKDoor { DoorType = GKDoorType.OneWay, EnterDeviceUID = enterDevice.UID, ExitDeviceUID = exitDevice.UID, LockDeviceUID = lockDevice.UID, LockControlDeviceUID = lockControlDevice.UID, }; GKManager.Doors.Clear(); GKManager.Doors.Add(door); var errors = Validate(); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на вход")); door.EnterDeviceUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на вход")); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на выход")); door.ExitDeviceUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на выход")); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключен замок")); door.LockDeviceUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключен замок")); }
public DoorPropertiesViewModel(GKDoor door) { Title = "Параметры точки доступа"; Door = door; Delay = Door.Delay; Hold = Door.Hold; }
public DoorSkdZoneViewModel(GKDoor door, SKDZoneViewModel skdZoneViewModel) { RemoveOutputDoorCommand = new RelayCommand(OnRemoveOutputDoor); RemoveInputDoorCommand = new RelayCommand(OnRemoveInputDoor); Door = door; SkdZoneViewModel = skdZoneViewModel; }
public void TestTwoWayHasNoDevices() { var enterDevice = AddDevice(kauDevice11, GKDriverType.RSR2_CardReader); var exitDevice = AddDevice(kauDevice11, GKDriverType.RSR2_CodeReader); var lockDevice = AddDevice(kauDevice11, GKDriverType.RSR2_RM_1); var lockControlDevice = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); var zone1 = new GKSKDZone(); GKManager.SKDZones.Add(zone1); var zone2 = new GKSKDZone(); GKManager.SKDZones.Add(zone2); var door = new GKDoor { DoorType = GKDoorType.TwoWay, EnterDeviceUID = enterDevice.UID, ExitDeviceUID = exitDevice.UID, LockDeviceUID = lockDevice.UID, LockControlDeviceUID = lockControlDevice.UID, EnterZoneUID = zone1.UID, ExitZoneUID = zone2.UID }; GKManager.Doors.Clear(); GKManager.Doors.Add(door); var errors = Validate(); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на вход")); door.EnterDeviceUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на вход")); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на выход")); door.ExitDeviceUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключено устройство на выход")); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключен замок")); door.LockDeviceUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "К точке доступа не подключен замок")); door.AntipassbackOn = true; errors = Validate(); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "При включенном Antipassback, отсутствует датчик контроля двери")); door.LockControlDeviceUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "При включенном Antipassback, отсутствует датчик контроля двери")); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "При включенном Antipassback, отсутствует зона на вход")); door.EnterZoneUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "При включенном Antipassback, отсутствует зона на вход")); Assert.IsFalse(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "При включенном Antipassback, отсутствует зона на выход")); door.ExitZoneUID = Guid.Empty; errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "При включенном Antipassback, отсутствует зона на выход")); }
public GKDoorSelectionViewModel(GKDoor door) { Title = "Выбор точки доступа"; Doors = new ObservableCollection<DoorViewModel>(); GKManager.Doors.ForEach(x => Doors.Add(new DoorViewModel(x))); if (door != null) SelectedDoor = Doors.FirstOrDefault(x => x.Door.UID == door.UID); if (SelectedDoor == null) SelectedDoor = Doors.FirstOrDefault(); }
public DoorDescriptor(GKDoor door) : base(door) { DescriptorType = DescriptorType.Door; Door = door; if (Door.DoorType == GKDoorType.AirlockBooth) { DoorPimDescriptorEnter = new DoorPimDescriptorEnter(Door); DoorPimDescriptorExit = new DoorPimDescriptorExit(Door); } if (Door.DoorType == GKDoorType.Barrier) { DoorPimDescriptorCrossing = new DoorPimDescriptorCrossing(Door); } }
public DoorPimDescriptorCrossing(GKDoor pimDoor) : base(pimDoor.PimCrossing) { PimDoor = pimDoor; LockControlDevice = pimDoor.LockControlDevice; LockControlDeviceExit = pimDoor.LockControlDeviceExit; if (Pim != null) { if (LockControlDevice != null) Pim.LinkToDescriptor(LockControlDevice); if (LockControlDeviceExit != null) Pim.LinkToDescriptor(LockControlDeviceExit); Pim.LinkToDescriptor(PimDoor); Pim.LinkToDescriptor(Pim); } }
//RG-1109 (Валидация настройки контроллера Wiegand при одновременном участии в ТД и в ОЗ) public void TestCardReader() { var rK = AddDevice(kauDevice11, GKDriverType.RK_RM); var cardReader = AddDevice(kauDevice11, GKDriverType.RSR2_CardReader); var codeReader = AddDevice(kauDevice11, GKDriverType.RSR2_CodeReader); var lockDevice = new GKGuardZoneDevice { DeviceUID = codeReader.UID, Device = codeReader }; var enterDevice = new GKGuardZoneDevice { DeviceUID = cardReader.UID, Device = cardReader }; var zone = new GKGuardZone { No = 1, Name = "Охранная зона" }; var door = new GKDoor { No = 1, Name = "Точка доступа", DoorType = GKDoorType.TwoWay, EnterDevice = cardReader, EnterDeviceUID = cardReader.UID, ExitDevice = codeReader, ExitDeviceUID = codeReader.UID, LockDevice = rK, LockDeviceUID = codeReader.UID }; GKManager.AddGuardZone(zone); GKManager.AddDeviceToGuardZone(zone, lockDevice); GKManager.AddDeviceToGuardZone(zone, enterDevice); GKManager.AddDoor(door); enterDevice.CodeReaderSettings.SetGuardSettings = new GKCodeReaderSettingsPart { CodeReaderEnterType = GKCodeReaderEnterType.CodeOnly }; var errors = Validate(); Assert.IsTrue(errors.Any(x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "Котроллер Wiegand используется в точке доступа, не должно быть настроенных кодов с методом ввода *КОД# ")); }
public void TestDoor1() { var cardReader1 = AddDevice(kauDevice1, GKDriverType.RSR2_CardReader); var cardReader2 = AddDevice(kauDevice1, GKDriverType.RSR2_CardReader); var am1 = AddDevice(kauDevice1, GKDriverType.RSR2_AM_1); var rm1 = AddDevice(kauDevice1, GKDriverType.RSR2_RM_1); var door = new GKDoor() { DoorType = GKDoorType.TwoWay, EnterDeviceUID = cardReader1.UID, ExitDeviceUID = cardReader2.UID, LockDeviceUID = rm1.UID, LockControlDeviceUID = am1.UID, }; GKManager.Doors.Add(door); Compile(); }
/// <summary> /// Удаление ТД /// </summary> /// <param name="door"></param> public static void RemoveDoor(GKDoor door) { Doors.Remove(door); Devices.Where(x => x.UID == door.EnterDeviceUID || x.UID == door.ExitDeviceUID || x.UID == door.LockDeviceUID || x.UID == door.LockControlDeviceUID).ToList().ForEach(x => x.Door = null); door.InputDependentElements.ForEach(x => { x.OutputDependentElements.Remove(door); }); door.OutputDependentElements.ForEach(x => { x.InputDependentElements.Remove(door); x.UpdateLogic(DeviceConfiguration); x.OnChanged(); }); door.OnChanged(); }
public static void ChangeEnterButtonDevice(GKDoor door, GKDevice device) { RemoveDependenctElement(door, door.EnterButtonUID); door.EnterButtonUID = device != null ? device.UID : Guid.Empty; if (door.EnterButton != null) { door.EnterButton.Door = null; } door.EnterButton = device; if (door.EnterButton != null) { door.EnterButton.Door = door; door.AddDependentElement(door.EnterButton); } door.OnChanged(); }
public DoorDetailsViewModel(GKDoor door = null) { ReadPropertiesCommand = new RelayCommand(OnReadProperties); WritePropertiesCommand = new RelayCommand(OnWriteProperties); ResetPropertiesCommand = new RelayCommand(OnResetProperties); if (door == null) { Title = "Создание новой точки доступа"; IsEdit = false; Door = new GKDoor() { Name = "Новая точка доступа", No = 1, PlanElementUIDs = new List<Guid>(), }; if (GKManager.DeviceConfiguration.Doors.Count != 0) Door.No = (GKManager.DeviceConfiguration.Doors.Select(x => x.No).Max() + 1); } else { Title = string.Format("Свойства точки доступа: {0}", door.PresentationName); Door = door; IsEdit = true; } AvailableDoorTypes = new ObservableCollection<GKDoorType>(Enum.GetValues(typeof(GKDoorType)).Cast<GKDoorType>()); SelectedDoorType = Door.DoorType; AntipassbackOn = Door.AntipassbackOn; CopyProperties(); var availableNames = new HashSet<string>(); var availableDescription = new HashSet<string>(); foreach (var existingDoor in GKManager.DeviceConfiguration.Doors) { availableNames.Add(existingDoor.Name); availableDescription.Add(existingDoor.Description); } AvailableNames = new ObservableCollection<string>(availableNames); AvailableDescription = new ObservableCollection<string>(availableDescription); }
public ReadOnlyAccessDoorViewModel(GKDoor door, CardDoor cardDoor, List<GKSchedule> schedules) { PresentationName = door.PresentationName; CardDoor = cardDoor; if (schedules != null) { var enterSchedule = schedules.FirstOrDefault(x => x.No == cardDoor.EnterScheduleNo); if (enterSchedule != null) { EnerScheduleName = enterSchedule.Name; } var exitSchedule = schedules.FirstOrDefault(x => x.No == cardDoor.ExitScheduleNo); if (exitSchedule != null && door.DoorType != GKDoorType.OneWay) { ExitScheduleName = exitSchedule.Name; } } HasExit = door.DoorType == GKDoorType.TwoWay; }
public AccessDoorViewModel(GKDoor door, List<CardDoor> cardDoors, Action<AccessDoorViewModel> onChecked, IEnumerable<GKSchedule> schedules) { DoorUID = door.UID; PresentationName = door.PresentationName; HasExit = door.DoorType != GKDoorType.OneWay; EnterSchedules = new ObservableCollection<CardScheduleItem>(); ExitSchedules = new ObservableCollection<CardScheduleItem>(); if (schedules != null) { EnterSchedules = new ObservableCollection<CardScheduleItem>(from o in schedules orderby o.No ascending select new CardScheduleItem(o.No, o.Name)); ExitSchedules = new ObservableCollection<CardScheduleItem>(from o in schedules orderby o.No ascending select new CardScheduleItem(o.No, o.Name)); } Initialize(cardDoors, onChecked); }
public DoorDetailsViewModel(GKDoor door) { ShowCommand = new RelayCommand(OnShow); ShowJournalCommand = new RelayCommand(OnShowJournal); SetAutomaticStateCommand = new RelayCommand(OnSetAutomaticState, CanSetAutomaticState); SetManualStateCommand = new RelayCommand(OnSetManualState, CanSetManualState); SetIgnoreStateCommand = new RelayCommand(OnSetIgnoreState, CanSetIgnoreState); TurnOnCommand = new RelayCommand(OnTurnOn); TurnOffCommand = new RelayCommand(OnTurnOff); TurnOffNowCommand = new RelayCommand(OnTurnOffNow); ResetCommand = new RelayCommand(OnReset); SetRegimeNormCommand = new RelayCommand(OnSetRegimeNorm); SetRegimeOpenCommand = new RelayCommand(OnSetRegimeOpen); SetRegimeCloseCommand = new RelayCommand(OnSetRegimeClose); Door = door; State.StateChanged -= OnStateChanged; State.StateChanged += OnStateChanged; Planlink = new PlanLinksViewModel(Door); Title = Door.PresentationName; }
public DoorPimDescriptorEnter(GKDoor pimDoor) : base(pimDoor.PimEnter) { PimDoor = pimDoor; EnterDevice = pimDoor.EnterDevice; ExitDevice = pimDoor.ExitDevice; EnterButton = pimDoor.EnterButton; ExitButton = pimDoor.ExitButton; if (Pim != null) { if (EnterDevice != null) Pim.LinkToDescriptor(EnterDevice); if (ExitDevice != null) Pim.LinkToDescriptor(ExitDevice); if (EnterButton != null) Pim.LinkToDescriptor(EnterButton); if (ExitButton != null) Pim.LinkToDescriptor(ExitButton); Pim.LinkToDescriptor(PimDoor); Pim.LinkToDescriptor(Pim); } }
public AccessDoorModel(GKDoor door, List<CardDoor> cardDoors, List<GKSchedule> schedules) { DoorUID = door.UID; PresentationName = door.PresentationName; HasExit = door.DoorType != GKDoorType.OneWay; EnterSchedules = new List<CardScheduleItemModel>(); ExitSchedules = new List<CardScheduleItemModel>(); if (schedules != null) { EnterSchedules = new List<CardScheduleItemModel>(from o in schedules orderby o.No ascending select new CardScheduleItemModel(o.No, o.Name)); ExitSchedules = new List<CardScheduleItemModel>(from o in schedules orderby o.No ascending select new CardScheduleItemModel(o.No, o.Name)); } var cardDoor = cardDoors.FirstOrDefault(x => x.DoorUID == DoorUID); CardScheduleItemModel selectedEnterSchedule; CardScheduleItemModel selectedExitSchedule; if (cardDoor != null) { IsChecked = true; selectedEnterSchedule = EnterSchedules.FirstOrDefault(x => x.ScheduleNo == cardDoor.EnterScheduleNo); if (selectedEnterSchedule == null) selectedEnterSchedule = EnterSchedules.FirstOrDefault(); selectedExitSchedule = ExitSchedules.FirstOrDefault(x => x.ScheduleNo == cardDoor.ExitScheduleNo); if (selectedExitSchedule == null) selectedExitSchedule = ExitSchedules.FirstOrDefault(); } else { selectedEnterSchedule = EnterSchedules.FirstOrDefault(); selectedExitSchedule = ExitSchedules.FirstOrDefault(); } SelectedEnterSchedule = selectedEnterSchedule; SelectedExitSchedule = selectedExitSchedule; }
public DoorViewModel(GKDoor door) { Door = door; ChangeEnterDeviceCommand = new RelayCommand(OnChangeEnterDevice); ChangeExitDeviceCommand = new RelayCommand(OnChangeExitDevice); ChangeEnterButtonCommand = new RelayCommand(OnChangeEnterButton); ChangeExitButtonCommand = new RelayCommand(OnChangeExitButton); ChangeLockDeviceCommand = new RelayCommand(OnChangeLockDevice); ChangeLockDeviceExitCommand = new RelayCommand(OnChangeLockDeviceExit); ChangeLockControlDeviceCommand = new RelayCommand(OnChangeLockControlDevice); ChangeLockControlDeviceExitCommand = new RelayCommand(OnChangeLockControlDeviceExit); ChangeEnterZoneCommand = new RelayCommand(OnChangeEnterZone); ChangeExitZoneCommand = new RelayCommand(OnChangeExitZone); ChangeOpenRegimeLogicCommand = new RelayCommand(OnChangeOpenRegimeLogic); ChangeNormRegimeLogicCommand = new RelayCommand(OnChangeNormRegimeLogic); ChangeCloseRegimeLogicCommand = new RelayCommand(OnChangeCloseRegimeLogic); CreateDragObjectCommand = new RelayCommand<DataObject>(OnCreateDragObjectCommand, CanCreateDragObjectCommand); CreateDragVisual = OnCreateDragVisual; Update(); door.Changed += Update; door.PlanElementUIDsChanged += UpdateVisualizationState; }
public void TestDoorOnGK() { var device1 = AddDevice(kauDevice1, GKDriverType.RSR2_CardReader); var device2 = AddDevice(kauDevice1, GKDriverType.RSR2_CodeReader); var device3 = AddDevice(kauDevice1, GKDriverType.RSR2_RM_1); var device4 = AddDevice(kauDevice1, GKDriverType.RSR2_AM_1); var door = new GKDoor() { DoorType = GKDoorType.TwoWay, EnterDeviceUID = device1.UID, ExitDeviceUID = device2.UID, LockDeviceUID = device3.UID, LockControlDeviceUID = device4.UID }; GKManager.Doors.Add(door); Compile(); var device1GKDescriptor = GkDatabase.Descriptors.FirstOrDefault(x => x.GKBase == device1); var device1Kau1Descriptor = Kau1Database.Descriptors.FirstOrDefault(x => x.GKBase == device1); //Assert.IsTrue(device1GKDescriptor.Formula.FormulaOperations.Count > 1, "На ГК должна присутствовать логика ТД"); Assert.IsTrue(device1Kau1Descriptor.Formula.FormulaOperations.Count == 1, "На КАУ должна отсутствовать логика ТД"); var device2GKDescriptor = GkDatabase.Descriptors.FirstOrDefault(x => x.GKBase == device2); var device2Kau1Descriptor = Kau1Database.Descriptors.FirstOrDefault(x => x.GKBase == device2); //Assert.IsTrue(device2GKDescriptor.Formula.FormulaOperations.Count > 1, "На ГК должна присутствовать логика ТД"); Assert.IsTrue(device2Kau1Descriptor.Formula.FormulaOperations.Count == 1, "На КАУ должна отсутствовать логика ТД"); var device3GKDescriptor = GkDatabase.Descriptors.FirstOrDefault(x => x.GKBase == device3); var device3Kau1Descriptor = Kau1Database.Descriptors.FirstOrDefault(x => x.GKBase == device3); Assert.IsTrue(device3GKDescriptor.Formula.FormulaOperations.Count > 1, "На ГК должна присутствовать логика ТД"); Assert.IsTrue(device3Kau1Descriptor.Formula.FormulaOperations.Count == 1, "На КАУ должна отсутствовать логика ТД"); var device4GKDescriptor = GkDatabase.Descriptors.FirstOrDefault(x => x.GKBase == device4); var device4Kau1Descriptor = Kau1Database.Descriptors.FirstOrDefault(x => x.GKBase == device4); //Assert.IsTrue(device4GKDescriptor.Formula.FormulaOperations.Count > 1, "На ГК должна присутствовать логика ТД"); Assert.IsTrue(device4Kau1Descriptor.Formula.FormulaOperations.Count == 1, "На КАУ должна отсутствовать логика ТД"); }
public void TestDoor() { var cardReaderDevice = AddDevice(kauDevice11, GKDriverType.RSR2_CardReader); var amDevice = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); var am2Device = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); var rmDevice = AddDevice(kauDevice11, GKDriverType.RSR2_RM_1); var door = new GKDoor { Name = "Тестовая ТД", No = 1, DoorType = GKDoorType.OneWay}; door.EnterDeviceUID = cardReaderDevice.UID; door.ExitDeviceUID = amDevice.UID; door.LockControlDeviceUID = am2Device.UID; door.LockDeviceUID = rmDevice.UID; GKManager.AddDoor(door); SetConfigAndRestartImitator(); WaitWhileState(door, XStateClass.Off, 10000, "Ждем выключено в ТД"); Assert.IsTrue(door.State.StateClass == XStateClass.Off, "Проверка того, что ТД выключено"); var card = AddNewUser(10, door); var traceMessage = "Прикладывание карты с номером " + card.Number + " к считывателю"; EnterCard(cardReaderDevice, card, GKCodeReaderEnterType.CodeOnly, traceMessage); WaitWhileState(cardReaderDevice, XStateClass.Attention, 3000, "Ждем внимания в считывателе"); WaitWhileState(door, XStateClass.On, 5000, "Ждем включено в ТД"); Assert.IsTrue(door.State.StateClass == XStateClass.On, "Проверка того, что ТД перешла в сотояние включено"); CheckJournal(JournalItem(cardReaderDevice, JournalEventNameType.Внимание), JournalItem(door, JournalEventNameType.Проход_пользователя_разрешен), JournalItem(door, JournalEventNameType.Включено)); }
public ObjectViewModel(GKDoor door) { Door = door; Name = door.PresentationName; ImageSource = "/Controls;component/Images/Door.png"; Address = ""; PresentationZoneOrLogic = ""; ObjectType = ObjectType.Door; SortingName = "k " + door.No; }
void AddDevicesOnSchleif(GKDevice shleifDevice, ref int doorNo) { shleifDevice.Children = new List<GKDevice>(); for (int i = 0; i < 54; i++) { var cardReaderDriver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_CardReader); var rmDriver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_RM_1); var enterDevice = new GKDevice(); enterDevice.DriverUID = cardReaderDriver.UID; enterDevice.IntAddress = (byte)(3 * i + 1); enterDevice.Description = "ТД " + doorNo + " вход"; shleifDevice.Children.Add(enterDevice); var exitDevice = new GKDevice(); exitDevice.DriverUID = cardReaderDriver.UID; exitDevice.IntAddress = (byte)(3 * i + 2); exitDevice.Description = "ТД " + doorNo + " выход"; shleifDevice.Children.Add(exitDevice); var lockDevice = new GKDevice(); lockDevice.DriverUID = rmDriver.UID; lockDevice.IntAddress = (byte)(3 * i + 3); lockDevice.Description = "ТД " + doorNo + " замок"; shleifDevice.Children.Add(lockDevice); var door = new GKDoor(); door.No = doorNo; door.Name = "ТД " + doorNo; door.DoorType = GKDoorType.TwoWay; door.EnterDeviceUID = enterDevice.UID; door.ExitDeviceUID = exitDevice.UID; door.LockDeviceUID = lockDevice.UID; GKManager.Doors.Add(door); doorNo++; } }
public void RemoveDeviceTestLogicForMptNsDoor() { var device = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); var device2 = AddDevice(kauDevice11, GKDriverType.RSR2_AM_1); GKManager.UpdateConfiguration(); var clause = new GKClause { ClauseOperationType = ClauseOperationType.AllDevices, DeviceUIDs = { device.UID } }; var gkLogic = new GKLogic(); gkLogic.OnClausesGroup.Clauses.Add(clause); var mpt = new GKMPT(); var gkMptDevice = new GKMPTDevice { Device = device, DeviceUID = device.UID }; GKManager.AddMPT(mpt); GKManager.SetMPTLogic(mpt, gkLogic); mpt.MPTDevices.Add(gkMptDevice); Assert.IsTrue(mpt.MptLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID))); Assert.IsTrue(mpt.MPTDevices.Any(x => x.DeviceUID == device.UID)); Assert.IsTrue(mpt.InputDependentElements.Contains(device)); Assert.IsTrue(device.OutputDependentElements.Contains(mpt)); var pump = new GKPumpStation(); GKManager.AddPumpStation(pump); GKManager.SetPumpStationStartLogic(pump, gkLogic); GKManager.ChangePumpDevices(pump, new List<GKDevice>() {device}); Assert.IsTrue(pump.StartLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID))); Assert.IsTrue(pump.NSDevices.Contains(device)); Assert.IsTrue(pump.InputDependentElements.Contains(device)); Assert.IsTrue(device.OutputDependentElements.Contains(pump)); var door = new GKDoor(); GKManager.AddDoor(door); GKManager.SetDoorOpenRegimeLogic(door, gkLogic); GKManager.SetDoorCloseRegimeLogic(door, gkLogic); GKManager.ChangeEnterButtonDevice(door, device); Assert.IsTrue(door.EnterButton == device); Assert.IsTrue(door.EnterButtonUID == device.UID); Assert.IsTrue(device.Door == door); Assert.IsTrue(device.OutputDependentElements.Contains(door)); Assert.IsTrue(door.InputDependentElements.Contains(device)); door.EnterButton = null; door.EnterButtonUID = Guid.Empty; GKManager.ChangeExitButtonDevice(door, device); Assert.IsTrue(door.ExitButton == device); Assert.IsTrue(door.ExitButtonUID == device.UID); Assert.IsTrue(device.Door == door); door.ExitButton = null; door.ExitButtonUID = Guid.Empty; GKManager.ChangeLockControlDevice(door, device); Assert.IsTrue(door.LockControlDevice == device); Assert.IsTrue(door.LockControlDeviceUID == device.UID); Assert.IsTrue(device.Door == door); door.LockDevice = null; door.LockControlDeviceUID = Guid.Empty; GKManager.ChangeLockControlDeviceExit(door, device); Assert.IsTrue(door.LockControlDeviceExitUID == device.UID); Assert.IsTrue(door.LockControlDeviceExit == device); Assert.IsTrue(device.Door == door); door.LockDeviceExit = null; door.LockControlDeviceExitUID = Guid.Empty; GKManager.ChangeLockDevice(door, device); Assert.IsTrue(door.LockDevice == device); Assert.IsTrue(door.LockDeviceUID == device.UID); Assert.IsTrue(device.Door == door); door.LockDeviceUID = Guid.Empty; door.LockDevice = null; GKManager.ChangeLockDeviceExit(door, device); Assert.IsTrue(door.LockDeviceExit == device); Assert.IsTrue(door.LockDeviceExitUID == device.UID); Assert.IsTrue(device.Door == door); Assert.IsTrue(door.OpenRegimeLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains( device.UID))); Assert.IsTrue(door.CloseRegimeLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID))); GKManager.RemoveDevice(device); Assert.IsFalse(mpt.MptLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID))); Assert.IsFalse(mpt.InputDependentElements.Any(x => x.UID == device.UID)); Assert.IsFalse(pump.StartLogic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID))); Assert.IsFalse(pump.InputDependentElements.Any(x => x.UID == device.UID)); Assert.IsFalse(mpt.MPTDevices.Any(x => x.DeviceUID == device.UID)); Assert.IsFalse(pump.NSDevices.Contains(device)); Assert.IsFalse(door.InputDependentElements.Any(x => x.UID == device.UID)); }
public void DoorUpdate(GKDoor gkdoor) { Clients.All.doorUpdate(new Door(gkdoor)); }
public CommonDoor(GKDoor door) { Name = door.PresentationName; NoDoor = door.No; Type = door.DoorType; var enterZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.EnterZoneUID); if (enterZone != null) { EnterZoneName = enterZone.PresentationName; NoEnterZone = enterZone.No; } else NoEnterZone = Int32.MaxValue; var exitZone = GKManager.SKDZones.FirstOrDefault(x => x.UID == door.ExitZoneUID); if (exitZone != null) { ExitZoneName = exitZone.PresentationName; NoExitZone = exitZone.No; } else NoExitZone = Int32.MaxValue; }
public void Reset() { if (GkEntity.ObjectType == GKBaseObjectType.Zone) { var zone = new GKZone { UID = GkEntity.UID }; switch (AlarmType) { case GKAlarmType.Fire1: ClientManager.RubezhService.GKResetFire1(zone); break; case GKAlarmType.Fire2: ClientManager.RubezhService.GKResetFire2(zone); break; } } if (GkEntity.ObjectType == GKBaseObjectType.GuardZone) { var guardZone = new GKGuardZone { UID = GkEntity.UID }; switch (AlarmType) { case GKAlarmType.GuardAlarm: ClientManager.RubezhService.GKReset(guardZone); break; } } if (GkEntity.ObjectType == GKBaseObjectType.Device) { var device = new GKDevice { UID = GkEntity.UID }; ClientManager.RubezhService.GKReset(device); } if (GkEntity.ObjectType == GKBaseObjectType.Door) { var door = new GKDoor { UID = GkEntity.UID }; switch (AlarmType) { case GKAlarmType.GuardAlarm: ClientManager.RubezhService.GKReset(door); break; } } }