Пример #1
0
		public static void RunOnJournal(JournalItem journalItem, User user, Guid? clientUID)
		{
			if (ProcedureExecutionContext.SystemConfiguration == null)
				return;

			foreach (var procedure in ProcedureExecutionContext.SystemConfiguration.AutomationConfiguration.Procedures.Where(x => x.ContextType == ProcedureExecutionContext.ContextType))
			{
				foreach (var filtersUID in procedure.FiltersUids)
				{
					var filter = ProcedureExecutionContext.SystemConfiguration.JournalFilters.FirstOrDefault(x => x.UID == filtersUID);
					if (filter != null)
					{
						if (filter.JournalSubsystemTypes.Count +
							filter.JournalEventNameTypes.Count +
							filter.JournalEventDescriptionTypes.Count +
							filter.JournalObjectTypes.Count +
							filter.ObjectUIDs.Count == 0)
							continue;

						if (filter.JournalSubsystemTypes.Count > 0 && !filter.JournalSubsystemTypes.Contains(journalItem.JournalSubsystemType))
							continue;

						if ((filter.JournalEventNameTypes.Count != 0) || (filter.JournalEventDescriptionTypes.Count != 0))
						{
							if (!filter.JournalEventNameTypes.Contains(journalItem.JournalEventNameType))
							{
								if (!filter.JournalEventDescriptionTypes.Contains(journalItem.JournalEventDescriptionType))
								{
									continue;
								}
							}
						}

						if (filter.JournalObjectTypes.Count > 0 && !filter.JournalObjectTypes.Contains(journalItem.JournalObjectType))
							continue;
						if (filter.ObjectUIDs.Count > 0 && !filter.ObjectUIDs.Contains(journalItem.ObjectUID))
							continue;
						RunProcedure(procedure, new List<Argument>(), null, user, journalItem, clientUID);
					}
				}
			}
		}
Пример #2
0
		public static void Run(Procedure procedure, List<Argument> args = null, User user = null)
		{
			if (args == null)
				args = new List<Argument>();
			using (new WaitWrapper())
			{
				var thread = new Thread(() =>
					{
						if (procedure.ContextType == ContextType.Client)
							AutomationProcessor.RunProcedure(procedure, args, null, user, null, RubezhServiceFactory.UID);
						else
							ClientManager.RubezhService.RunProcedure(procedure.Uid, args);
					}
					)
				{
					Name = "Run Procedure",
				};
				thread.Start();
				while (!thread.Join(50))
					ApplicationService.DoEvents();
			}
		}
Пример #3
0
		public LayoutUserViewModel(User user)
		{
			User = user;
			Update();
		}
Пример #4
0
		public static void RunOnApplicationRun(User user = null, Guid? clientUID = null)
		{
			ProcedureExecutionContext.SystemConfiguration.AutomationConfiguration.Procedures.ForEach(x =>
			{
				if (x.StartWithApplication && x.ContextType == ProcedureExecutionContext.ContextType)
					RunProcedure(x, new List<Argument>(), null, user, null, clientUID);
			});
		}
Пример #5
0
		public static void RunProcedure(Procedure procedure, List<Argument> arguments, List<Variable> callingProcedureVariables, User user = null, JournalItem journalItem = null, Guid? clientUID = null)
		{
			if (procedure.IsActive && _procedureThreads != null)
			{
				var procedureThread = new ProcedureThread(procedure, arguments, callingProcedureVariables, journalItem, user, clientUID);
				_procedureThreads.TryAdd(procedureThread.UID, procedureThread);
				procedureThread.Start();
			}
		}
Пример #6
0
 public OrganisationUserViewModel(Organisation organisation, User user)
 {
     User = user;
     IsChecked = organisation != null && organisation.UserUIDs != null && organisation.UserUIDs.Contains(user.UID);
 }
Пример #7
0
		public UserViewModel(User user)
		{
			User = user;
		}