/// <summary> /// Action thats serves the view that lists all Available and current Fields for a Department /// </summary> public async Task <ActionResult> Edit(int id) { Department oDepartment = null; List <Field> fieldList = null; WorkFlowViewModel vm = new WorkFlowViewModel(); using (var client = new HttpClient()) { var uri = new Uri("http://localhost:51506/ConfigurelyService.svc/GetDepartment/" + id); var json = await client.GetStringAsync(uri); oDepartment = JsonConvert.DeserializeObject <Department>(json); uri = new Uri("http://localhost:51506/ConfigurelyService.svc/GetFields"); json = await client.GetStringAsync(uri); fieldList = JsonConvert.DeserializeObject <List <Field> >(json); vm.DepartmentId = oDepartment.ID; vm.DepartmentName = oDepartment.Name; vm.CurrentFields = oDepartment.Fields; vm.AvailableFields = fieldList.Where(p => vm.CurrentFields.All(p2 => p2.ID != p.ID)).ToList(); } return(View(vm)); }
public async Task <bool> AddWorkFlowAsync(WorkFlowViewModel model) { try { var userName = _httpContextAccessor.HttpContext?.User?.GetUserName(); var workflow = _mapper.Map <WorkFlow>(model); workflow.CreatedTime = DateTime.Now; workflow.UpdatedTime = DateTime.Now; workflow.CreatedUser = userName; workflow.UpdatedUser = userName; await _workFlowRepository.AddAsync(workflow); await _unitOfWork.SaveAsync(); return(true); } catch (Exception e) { _logger.LogError(e.Message); _logger.LogError(e.StackTrace); return(false); } }
public IActionResult Add() { WorkFlowViewModel AllApplication = _workFlowService.GetAllApp(); ViewBag.ListOfApplication = AllApplication.applications.ToList(); return(PartialView("_add")); }
public ActionResult AddWorkFlow() { WorkFlowViewModel viewModel = new WorkFlowViewModel(); viewModel.WorkflowName = ""; viewModel.WorkflowID = 0; viewModel.StatusID = 402; viewModel.AllowParallelWorkflows = 1; viewModel.IsWorkflowAllowedMoreThanOnce = false; List <WorkflowTriggerViewModel> triggers = new List <WorkflowTriggerViewModel>(); WorkflowTriggerViewModel startTrigger = new WorkflowTriggerViewModel() { TriggerTypeID = 0, WorkflowID = 0, WorkflowTriggerID = 0, IsStartTrigger = true }; WorkflowTriggerViewModel stopTrigger = new WorkflowTriggerViewModel() { TriggerTypeID = 0, WorkflowID = 0, WorkflowTriggerID = 0, IsStartTrigger = false }; triggers.Add(startTrigger); triggers.Add(stopTrigger); viewModel.Triggers = triggers; ViewBag.DateFormat = this.Identity.ToDateFormat(); ViewBag.ParentID = 0; ViewBag.SenderName = this.Identity.ToFirstName() + " " + this.Identity.ToLastName(); return(View("AddEditWorkflow", viewModel)); }
public WorkFlow(Patient patient, User user) { InitializeComponent(); vm = new WorkFlowViewModel(user, patient); BindingContext = vm; myUser = user; myPatient = patient; }
public IActionResult Put(int id, [FromBody] WorkFlowViewModel workflow) { if (workflow != null) { projectService.UpdateWorkFlow(mapper.Map <WorkFlowViewModel, WorkFlow>(workflow, projectService.GetWorkFlowById(id))); return(Ok()); } return(BadRequest()); }
public async Task <IActionResult> Publish(WorkFlowViewModel workflowViewModel) { var result = await _workflowService.PublishWorkFlow(workflowViewModel.Id, workflowViewModel.IsPublish); if (!result.Item1) { return(this.BadRequestResult(result.Item2)); } return(Ok()); }
public IActionResult Add(workFlow workFlow) { if (ModelState.IsValid) { _workFlowService.AddWorkFlow(workFlow); WorkFlowViewModel model = _workFlowService.getLastFiveElement(); return(PartialView("/Views/Home/_ListWorkFlow.cshtml", model)); } return(RedirectToAction("Index", "Home")); }
public async Task <IActionResult> Update(WorkFlowViewModel workflowViewModel) { var isSuccess = await _workflowService.UpdateWorkFlowAsync(workflowViewModel); if (!isSuccess) { return(this.BadRequestResult("更新失败!")); } return(Ok()); }
public void SetUp() { _safeProvider = Substitute.For <ISafeProvider>(); _safeProvider.WorkingDirectory.Returns(InitialWorkingDirectory); _safeProvider.GetUserNames().Returns(_validUserNames); _workFlowViewModel = new WorkFlowViewModel(_safeProvider); _currentStepProperyObserver = _workFlowViewModel .GetPropertyObserver <WorkFlowStepViewModel>(nameof(_workFlowViewModel.CurrentStep)); }
public IActionResult Post([FromBody] WorkFlowViewModel workflow) { if (workflow != null) { var newWorkflow = mapper.Map <WorkFlow>(workflow); projectService.CreateWorkFlow(newWorkflow); return(Created("", newWorkflow)); } return(BadRequest()); }
public IActionResult Index() { StepViewModel allSteps = _stepService.getLastFiveElement(); WorkFlowViewModel allWorkFlows = _WorkFlowService.getLastFiveElement(); ApplicationViewModel allApplication = _applicationService.getLastFiveElement(); Home model = new Home() { ApplicationViewModel = allApplication, WorkFlowViewModel = allWorkFlows, StepViewModel = allSteps }; return(View(model)); }
public HttpResponseMessage PutWorkflow(WorkFlowViewModel viewModel) { UpdateWorkflowRequest request = new UpdateWorkflowRequest() { WorkflowViewModel = viewModel, AccountId = this.AccountId, RequestedBy = this.UserId, RoleId = this.RoleId }; UpdateWorkflowResponse response = workflowService.UpdateWorkflow(request); return(Request.BuildResponse(response)); }
public PartialViewResult _WorkFlow(string StepId) { WorkFlowViewModel model = new WorkFlowViewModel { FilmTitle = null }; FilmSubmission currentFilm = new Session().Film; if (currentFilm != null) { model.FilmSubmitionId = currentFilm.FilmSubmissionId; model.FilmTitle = currentFilm.FilmTitle; model.StepId = StepId; } return(PartialView("_WorkFlow", model)); }
public JsonResult SaveSettings(string workflowViewModel) { WorkFlowViewModel viewModel = JsonConvert.DeserializeObject <WorkFlowViewModel>(workflowViewModel); UpdateWorkflowRequest request = new UpdateWorkflowRequest() { WorkflowViewModel = viewModel, AccountId = this.Identity.ToAccountID(), RequestedBy = this.Identity.ToUserID(), RoleId = this.Identity.ToRoleID() }; workflowService.UpdateWorkflow(request); return(Json(new { success = true, response = "" }, JsonRequestBehavior.AllowGet)); }
private static WorkFlowViewModel ProcessWorkflowFromServer(WorkFlowViewModel source, WorkFlowViewModel destination) { source.Triggers.GroupBy(t => new { t.IsStartTrigger, t.TriggerTypeID }).Each(t => { var trigger = new WorkflowTriggerViewModel(); trigger.IsStartTrigger = t.Key.IsStartTrigger; trigger.WorkflowID = destination.WorkflowID; trigger.FormIDs = t.Where(f => f.FormID != null).Select(f => f.FormID); trigger.FormNames = t.Where(f => f.FormID != null).Select(f => f.FormName); trigger.TagIDs = t.Where(tag => tag.TagID != null).Select(tag => tag.TagID); trigger.TagNames = t.Where(tag => tag.TagID != null).Select(tag => tag.TagName); trigger.LeadAdapterIDs = t.Where(leadadapter => leadadapter.LeadAdapterID != null).Select(leadadapter => leadadapter.LeadAdapterID); trigger.LeadAdapterNames = t.Where(leadadapter => leadadapter.LeadAdapterID != null).Select(leadadapter => leadadapter.LeadAdapterName); trigger.SearchDefinitionIDs = t.Where(s => s.SearchDefinitionID != null).Select(s => s.SearchDefinitionID); trigger.SearchDefinitionNames = t.Where(s => s.SearchDefinitionID != null).Select(s => s.SearchDefinitionName); trigger.TriggerTypeID = t.Select(ty => ty.TriggerTypeID).FirstOrDefault(); trigger.LifecycleDropdownValueID = t.Where(l => l.LifecycleDropdownValueID != null).Select(l => l.LifecycleDropdownValueID).SingleOrDefault(); trigger.LifecycleName = t.Where(l => l.LifecycleDropdownValueID != null).Select(x => x.LifecycleName).FirstOrDefault(); trigger.OpportunityStageID = t.Where(l => l.OpportunityStageID != null).Select(l => l.OpportunityStageID).SingleOrDefault(); trigger.OpportunityStageName = t.Where(l => l.OpportunityStageID != null).Select(l => l.OpportunityStageName).FirstOrDefault(); trigger.CampaignID = t.Where(l => l.CampaignID != null).Select(l => l.CampaignID).SingleOrDefault(); trigger.CampaignName = t.Where(l => l.CampaignID != null).Select(l => l.CampaignName).FirstOrDefault(); trigger.SelectedLinks = t.Select(l => l.SelectedLinks).FirstOrDefault(); trigger.SelectedURLs = t.Select(l => l.SelectedURLs).FirstOrDefault(); trigger.LeadScore = t.Select(s => s.LeadScore).FirstOrDefault(); trigger.IsAnyWebPage = t.Select(s => s.IsAnyWebPage).FirstOrDefault(); trigger.WebPage = t.Select(s => s.WebPage).FirstOrDefault(); trigger.Duration = t.Select(s => s.Duration).FirstOrDefault(); trigger.Operator = t.Select(s => s.Operator).FirstOrDefault(); trigger.ActionType = t.Select(s => s.ActionType).FirstOrDefault(); trigger.ActionTypeName = t.Select(s => s.ActionTypeName).FirstOrDefault(); trigger.TourType = t.Select(s => s.TourType).FirstOrDefault(); trigger.TourTypeName = t.Select(s => s.TourTypeName).FirstOrDefault(); destination.Triggers = destination.Triggers.Where(dt => dt.IsStartTrigger != t.Key.IsStartTrigger).Concat(new[] { trigger }); }); destination.Triggers = destination.Triggers.OrderBy(t => t.IsStartTrigger).Reverse(); return(destination); }
public async Task <bool> UpdateWorkFlowAsync(WorkFlowViewModel model) { try { var userName = _httpContextAccessor.HttpContext?.User?.GetUserName(); var wf = _workFlowRepository.Get(wf => wf.Id == model.Id).FirstOrDefault(); _mapper.Map(model, wf); wf.UpdatedTime = DateTime.Now; wf.UpdatedUser = userName; _workFlowRepository.Update(wf); await _unitOfWork.SaveAsync(); return(true); } catch (Exception e) { _logger.LogError(e.Message); _logger.LogError(e.StackTrace); return(false); } }
public ActionResult WorkFlow(int taskId = 0) { var taskList = _workFlowService.GetTaskList(); var actkiveTask = taskList.SingleOrDefault(x => x.Id == taskId); var mainProcess = _workFlowService.GetMainProcessList(taskId); var nextProcessList = _workFlowService.GetProcessList(taskId).Select(x => new NextProcess { MainProcessList = (mainProcess != null ? new SelectList(mainProcess, "Id", "Name") : null), Process = x }); WorkFlowViewModel workFlowViewModel = null; if (nextProcessList.Count() > 0) { workFlowViewModel = new WorkFlowViewModel { ActiveTaskId = taskId, FirstProcessId = (actkiveTask.StartingProcessId != null ? (int)actkiveTask.StartingProcessId : 0), NextProcessList = nextProcessList }; } else { workFlowViewModel = new WorkFlowViewModel { ActiveTaskId = taskId, NextProcessList = null }; } return(PartialView("_WorkFlowWorkbench", workFlowViewModel)); }
private static WorkFlowViewModel ProcessWorkflowFromClient(WorkFlowViewModel source, WorkFlowViewModel destination) { IEnumerable <int?> _new = null; source.Triggers.Each(t => { if (t.FormIDs.IsAny()) { _new = t.FormIDs; /*to be removed triggers*/ var deleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID == WorkflowTriggerType.FormSubmitted).Except(t.FormIDs, et => et.FormID, f => f).ToList(); var otherdeleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID != WorkflowTriggerType.FormSubmitted); destination.Triggers = destination.Triggers.Except(deleted).Except(otherdeleted); _new = t.FormIDs.Except(destination.Triggers, f => f, dt => dt.FormID); _new.Each(f => { destination.Triggers = destination.Triggers.Concat(new[] { new WorkflowTriggerViewModel() { WorkflowID = destination.WorkflowID, FormID = f, TriggerTypeID = WorkflowTriggerType.FormSubmitted, IsStartTrigger = t.IsStartTrigger } }); ; }); } else if (t.TagIDs.IsAny()) { _new = t.TagIDs; /*to be removed triggers*/ var deleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID == WorkflowTriggerType.TagApplied).Except(t.TagIDs, et => et.TagID, f => f).ToList(); var otherdeleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID != WorkflowTriggerType.TagApplied); destination.Triggers = destination.Triggers.Except(deleted).Except(otherdeleted); _new = t.TagIDs.Except(destination.Triggers, f => f, dt => dt.TagID); _new.Each(ta => { destination.Triggers = destination.Triggers.Concat(new[] { new WorkflowTriggerViewModel() { WorkflowID = destination.WorkflowID, TagID = ta, TriggerTypeID = WorkflowTriggerType.TagApplied, IsStartTrigger = t.IsStartTrigger } }); ; }); } else if (t.SearchDefinitionIDs.IsAny()) { _new = t.SearchDefinitionIDs; /*to be removed triggers*/ var deleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID == WorkflowTriggerType.SmartSearch).Except(t.SearchDefinitionIDs, et => et.SearchDefinitionID, f => f).ToList(); var otherdeleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID != WorkflowTriggerType.SmartSearch); destination.Triggers = destination.Triggers.Except(deleted).Except(otherdeleted); _new = t.SearchDefinitionIDs.Except(destination.Triggers, f => f, dt => dt.SearchDefinitionID); _new.Each(s => { destination.Triggers = destination.Triggers.Concat(new[] { new WorkflowTriggerViewModel() { WorkflowID = destination.WorkflowID, SearchDefinitionID = s, TriggerTypeID = WorkflowTriggerType.SmartSearch, IsStartTrigger = t.IsStartTrigger } }); ; }); } else if (t.LeadAdapterIDs.IsAny()) { _new = t.LeadAdapterIDs; /*to be removed triggers*/ var deleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID == WorkflowTriggerType.LeadAdapterSubmitted).Except(t.LeadAdapterIDs, et => et.LeadAdapterID, f => f).ToList(); var otherdeleted = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger && dt.TriggerTypeID != WorkflowTriggerType.LeadAdapterSubmitted); destination.Triggers = destination.Triggers.Except(deleted).Except(otherdeleted); _new = t.LeadAdapterIDs.Except(destination.Triggers, f => f, dt => dt.LeadAdapterID); _new.Each(s => { destination.Triggers = destination.Triggers.Concat(new[] { new WorkflowTriggerViewModel() { WorkflowID = destination.WorkflowID, LeadAdapterID = s, TriggerTypeID = WorkflowTriggerType.LeadAdapterSubmitted, IsStartTrigger = t.IsStartTrigger } }); ; }); } else { var trigger = destination.Triggers.Where(dt => dt.IsStartTrigger == t.IsStartTrigger).FirstOrDefault(); destination.Triggers = destination.Triggers.Except(new[] { t }, dt => dt.IsStartTrigger, st => st.IsStartTrigger); trigger.TriggerTypeID = t.TriggerTypeID; trigger.LifecycleDropdownValueID = t.LifecycleDropdownValueID; trigger.CampaignID = t.CampaignID; trigger.OpportunityStageID = t.OpportunityStageID; trigger.SelectedLinks = t.SelectedLinks; trigger.LeadScore = t.LeadScore; trigger.WebPage = t.WebPage; trigger.Duration = t.Duration; trigger.Operator = t.Operator; trigger.TagID = null; trigger.FormID = null; trigger.LeadAdapterID = null; trigger.SearchDefinitionID = null; trigger.IsAnyWebPage = t.IsAnyWebPage; trigger.ActionType = t.ActionType; trigger.TourType = t.TourType; destination.Triggers = destination.Triggers.Concat(new[] { trigger }); } }); source.Triggers = destination.Triggers.OrderBy(t => t.IsStartTrigger).Reverse(); return(source); }