protected override void OnInit(EventArgs e) { base.OnInit(e); SaveTaskPropertiesButton.Text = TheGlobalisationService.GetString("save_task_properties"); var taskType = Request["AssemblyQualifiedTypeName"]; var task = TheTaskFactory.CreateTask(taskType); var queryItems = Request.QueryString.Keys.Cast <string>().ToDictionary <string, string, object>(queryStringKey => queryStringKey, queryStringKey => Request.QueryString[queryStringKey]); if (queryItems.ContainsKey("Id")) { queryItems["Id"] = new Guid((string)queryItems["Id"]); } TheHelper.SetProperties(task, queryItems); _ui = TheWorkflowEntityUiResolver.Resolve(task); foreach (var c in _ui.Render(task)) { TaskPropertiesUiPanel.Controls.Add(c); } }
public ActionResult Index(string id) { var formCollection = new FormCollection(Request.QueryString); ViewBag.Id = id; var taskType = formCollection["AssemblyQualifiedTypeName"]; ViewBag.TaskType = taskType; var task = TheTaskFactory.CreateTask(taskType); var ui = TheWorkflowEntityUiResolver.Resolve(task); var values = new Dictionary <string, object>(); foreach (var prop in ui.UiProperties) { values[prop.PropertyName] = ControlExtensions.ControlValue(prop.RenderControl, formCollection[prop.PropertyName]); } if (values.ContainsKey("Id")) { values["Id"] = new Guid((string)values["Id"]); } TheHelper.SetProperties(task, values); ViewBag.PropertiesJson = TheHelper.JsSerializer.Serialize(values); return(View(ui.Render(task))); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var taskType = Request["AssemblyQualifiedTypeName"]; var task = TheTaskFactory.CreateTask(taskType); var queryItems = new Dictionary <string, object>(); foreach (string key in Request.QueryString.Keys) { if (key.Contains("[]")) { var dictKey = key.Replace("[]", ""); var items = Request.QueryString[key].Split(','); try { queryItems.Add(dictKey, items.ToList().ConvertAll(Convert.ToInt32)); } catch { queryItems.Add(dictKey, items.ToList().ConvertAll(Convert.ToString)); } } else { queryItems.Add(key, Request.QueryString[key]); } } if (queryItems.ContainsKey("Id")) { queryItems["Id"] = new Guid((string)queryItems["Id"]); } TheHelper.SetProperties(task, queryItems); _ui = TheWorkflowEntityUiResolver.Resolve(task); foreach (var c in _ui.Render(task)) { TaskPropertiesUiPanel.Controls.Add(c); } }