Пример #1
0
		public static JournalItem AddMessage(EventName name, string userName)
		{
			var journalItem = new JournalItem()
			{
				SystemDateTime = DateTime.Now,
				DeviceDateTime = DateTime.Now,
				JournalItemType = JournalItemType.System,
				StateClass = XStateClass.Norm,
				Name = name.ToDescription(),
				ObjectStateClass = XStateClass.Norm,
				UserName = userName,
				SubsystemType = XSubsystemType.System
			};
			Add(journalItem);
			return journalItem;
		}
Пример #2
0
        public static void AddGKMessage(EventName message, string description, XBase xBase, string userName, bool isAdministrator = false)
        {
            Guid uid = Guid.Empty;
            var journalItemType = JournalItemType.System;
            if (xBase != null)
            {
                if (xBase is XDevice)
                {
                    uid = (xBase as XDevice).UID;
                    journalItemType = JournalItemType.Device;
                }
                if (xBase is XZone)
                {
                    uid = (xBase as XZone).UID;
                    journalItemType = JournalItemType.Zone;
                }
                if (xBase is XDirection)
                {
                    uid = (xBase as XDirection).UID;
                    journalItemType = JournalItemType.Direction;
                }
                if (xBase is XDelay)
                {
                    uid = (xBase as XDelay).UID;
                    journalItemType = JournalItemType.Delay;
                }
                if (xBase is XPim)
                {
                    uid = (xBase as XPim).UID;
                    journalItemType = JournalItemType.Pim;
                }
            }

            var journalItem = new JournalItem()
            {
                SystemDateTime = DateTime.Now,
                DeviceDateTime = DateTime.Now,
                JournalItemType = journalItemType,
                StateClass = EventNamesHelper.GetStateClass(message),
                Name = message.ToDescription(),
                Description = description,
                ObjectUID = uid,
                ObjectStateClass = XStateClass.Norm,
                UserName = userName,
                SubsystemType = XSubsystemType.System
            };
            if (xBase != null)
            {
                journalItem.ObjectName = xBase.PresentationName;
                journalItem.GKObjectNo = (ushort)xBase.GKDescriptorNo;
            }

            GKDBHelper.Add(journalItem);
            OnNewJournalItem(journalItem, isAdministrator);
            var gkCallbackResult = new GKCallbackResult();
            gkCallbackResult.JournalItems.Add(journalItem);
            OnGKCallbackResult(gkCallbackResult);
        }
Пример #3
0
        void AddFailureJournalItem(EventName name, EventDescription description)
		{
			var journalItem = new JournalItem()
			{
				Name = name.ToDescription(),
				Description = description.ToDescription(),
				StateClass = XStateClass.Unknown,
				ObjectStateClass = XStateClass.Norm,
				GKIpAddress = GkDatabase.RootDevice.GetGKIpAddress()
			};
			GKDBHelper.Add(journalItem);
			GKCallbackResult.JournalItems.Add(journalItem);
		}