public void RegisterEvents() { Init(); foreach (var criteria in TheWorkflowInstantiationCriteriaService.List()) { var hydratedCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(criteria.Id); if (hydratedCriteria.Events == null) { continue; } foreach (var eve in hydratedCriteria.Events) { var eventInfo = TheEventInfoService.GetByFullName(eve); if (_registeredEvents.Contains(eventInfo.FullName)) { return; } if (!_tracers.ContainsKey(eventInfo.TypeAssemblyQualifiedName)) { var t = Type.GetType(eventInfo.TypeAssemblyQualifiedName); _tracers.Add(eventInfo.TypeAssemblyQualifiedName, new TracerEx(t, OnEvent)); } var tracer = _tracers[eventInfo.TypeAssemblyQualifiedName]; tracer.HookEvent(eventInfo.EventName); _registeredEvents.Add(eventInfo.FullName); } } }
public ActionResult Edit(int id) { ViewBag.Id = id; var instantiationCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(id); var entityUi = TheWorkflowEntityUiResolver.Resolve(instantiationCriteria); return(View(entityUi.Render(instantiationCriteria))); }
protected override void OnInit(EventArgs e) { base.OnInit(e); SaveCriteriaButton.Text = TheGlobalisationService.GetString("save_criteria"); var criteriaId = Convert.ToInt32(Request["id"]); _instantiationCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(criteriaId); _entityUi = TheWorkflowEntityUiResolver.Resolve(_instantiationCriteria); foreach (var control in _entityUi.Render(_instantiationCriteria)) { CiteriaControlsPanel.Controls.Add(control); } }
public ActionResult Save(int id, FormCollection formCollection) { var instantiationCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(id); var ui = TheWorkflowEntityUiResolver.Resolve(instantiationCriteria); var values = new Dictionary <string, object>(); foreach (var prop in ui.UiProperties) { values[prop.PropertyName] = ControlExtensions.ControlValue(prop.RenderControl, formCollection[prop.PropertyName]); } TheWorkflowInstantiationCriteriaService.SetConfigurationProperties(id, values); TheEventService.RegisterEvents(); return(RedirectToAction("Index")); }
protected void Page_Load(object sender, EventArgs e) { var u = umbraco.BusinessLogic.User.GetCurrent(); var workflows = new List <IWorkflowConfiguration>(); foreach (var criteria in TheWorkflowInstantiationCriteriaService.List()) { var hydratedCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(criteria.Id); if (!hydratedCriteria.Active) { continue; } if (!((UmbracoWorkflowInstantiationCriteria)hydratedCriteria).AllowManualInstantiation) { continue; } if (!TheCriteriaValidationService.IsCriteriaValid((UmbracoWorkflowInstantiationCriteria)hydratedCriteria, u)) { continue; } workflows.Add(TheWorkflowConfigurationService.GetConfiguration(hydratedCriteria.WorkflowConfiguration)); } if (workflows.Count == 0) { NoCriteriasLiteral.Text = TheGlobalisationService.GetString("no_valid_workflow_instantiation_criteria"); NoCriteriasLiteral.Visible = true; } else { AvailableCriteriaDropDownList.DataSource = workflows; AvailableCriteriaDropDownList.DataTextField = "Name"; AvailableCriteriaDropDownList.DataValueField = "Id"; AvailableCriteriaDropDownList.DataBind(); SendToWorkflowPanel.Visible = true; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); SaveCriteriaButton.Text = TheGlobalisationService.GetString("save_criteria"); var criteriaId = Convert.ToInt32(Request["id"]); _instantiationCriteria = TheWorkflowInstantiationCriteriaService.GetCriteria(criteriaId); Log.Debug(string.Format("Got criteria of type {0}", _instantiationCriteria.GetType())); _entityUi = TheWorkflowEntityUiResolver.Resolve(_instantiationCriteria); // if (IsPostBack) return; foreach (var control in _entityUi.Render(_instantiationCriteria)) { CiteriaControlsPanel.Controls.Add(control); } }