using System.Collections.Generic; using System.Web.Mvc; using Pilotfish.Afx.Services.Integration; using Pilotfish.Afx.Services.Workflows; using Pilotfish.Afx.ViewModels; using Neo.Legitimate.Web.Models; namespace Neo.Legitimate.Web.Controllers { [Authorize] public class HomeController : Neo.Legitimate.Common.ControllerBase { public ActionResult Default() { var wd = new WorkflowsDatabase(); var viewModel = new HomeModel() { UserID = Profile.UserID, WorkflowTemplates = wd.GetActiveWorkflowTemplates(), OutstandingTasks = wd.GetTasks(Profile.UserID, 1), //In progress WorkflowInstancesInProgress = wd.GetWorkflowInstances(Profile.UserID, "1,5,6", false, -1, ""), //In progress, not started and error Lookups = GetLookups() }; return View("Default", viewModel); } public ActionResult Example() { var wd = new WorkflowsDatabase(); var viewModel = new HomeModel() { UserID = Profile.UserID, WorkflowTemplates = wd.GetActiveWorkflowTemplates(), OutstandingTasks = wd.GetTasks(Profile.UserID, 1), //In progress WorkflowInstancesInProgress = wd.GetWorkflowInstances(Profile.UserID, "1,5,6", false, -1, ""), //In progress, not started and error Lookups = GetLookups() }; return View("Example", viewModel); } public ActionResult Example2() { var wd = new WorkflowsDatabase(); var viewModel = new HomeModel() { UserID = Profile.UserID, WorkflowTemplates = wd.GetActiveWorkflowTemplates(), OutstandingTasks = wd.GetTasks(Profile.UserID, 1), //In progress WorkflowInstancesInProgress = wd.GetWorkflowInstances(Profile.UserID, "1,5,6", false, -1, ""), //In progress, not started and error Lookups = GetLookups() }; return View("Example2", viewModel); } public ActionResult Example3() { var wd = new WorkflowsDatabase(); var viewModel = new HomeModel() { UserID = Profile.UserID, WorkflowTemplates = wd.GetActiveWorkflowTemplates(), OutstandingTasks = wd.GetTasks(Profile.UserID, 1), //In progress WorkflowInstancesInProgress = wd.GetWorkflowInstances(Profile.UserID, "1,5,6", false, -1, ""), //In progress, not started and error Lookups = GetLookups() }; return View("Example3", viewModel); } public List GetLookups() { var lookups = new List(); var integrationStore = new SqlIntegrationStore(); try { integrationStore.Open(); lookups.Add(new LookupList("ApplicationActiveWorkflows", integrationStore.GetDataEntities("ActiveWorkflows", string.Empty))); lookups.Add(new LookupList("ApplicationWorkflowInstanceStatus", integrationStore.GetDataEntities("WorkflowInstanceStatus", string.Empty))); lookups.Add(new LookupList("ApplicationWorkflowTemplateSteps", integrationStore.GetDataEntities("WorkflowTemplateSteps", string.Empty))); } finally { integrationStore.Close(); } return lookups; } } }