// PUT api/Project/5 public IHttpActionResult PutScriptProject(int id, ScriptProject scriptproject) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != scriptproject.ScriptProjectID) { return(BadRequest()); } db.Entry(scriptproject).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ScriptProjectExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetScriptProject(int id) { ScriptProject scriptproject = db.ScriptProjects.Find(id); if (scriptproject == null) { return(NotFound()); } return(Ok(scriptproject)); }
public IHttpActionResult GetScriptProject(string id) { ScriptProject scriptproject = db.ScriptProjects.Where(b => b.ProjectName.Equals(id)).FirstOrDefault(); if (scriptproject == null) { return(NotFound()); } return(Ok(scriptproject)); }
public IHttpActionResult PostScriptProject(ScriptProject scriptproject) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ScriptProjects.Add(scriptproject); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = scriptproject.ScriptProjectID }, scriptproject)); }
/// <summary> /// Constructs a "global" script task. /// </summary> public ScriptTask(ScriptProject scriptProject, ProjectWrapper projectWrapper, PackageWrapper packageWrapper, ContainerWrapper containerWrapper) { ScriptTaskWrapper = new ScriptTaskWrapper(containerWrapper, scriptProject.Name, false, ScriptTaskScope.Project) { Name = scriptProject.Name }; ScriptTaskWrapper.ReadOnlyVariables = GetVariableNames(scriptProject.ReadOnlyVariables, ScriptTaskScope.Project, projectWrapper, packageWrapper, containerWrapper); ScriptTaskWrapper.ReadWriteVariables = GetVariableNames(scriptProject.ReadWriteVariables, ScriptTaskScope.Project, projectWrapper, packageWrapper, containerWrapper); AddAssemblyReferences(scriptProject.AssemblyReferences, projectWrapper.Version); AddSourceFiles(scriptProject.Files); }
public IHttpActionResult DeleteScriptProject(int id) { ScriptProject scriptproject = db.ScriptProjects.Find(id); if (scriptproject == null) { return(NotFound()); } db.ScriptProjects.Remove(scriptproject); db.SaveChanges(); return(Ok(scriptproject)); }
private void SaveToFile(bool saveAs) { if (_selectedTabScriptActions.Items.Count == 0) { Notify("You must have at least 1 automation command to save.", Color.Yellow); return; } int beginLoopValidationCount = 0; int beginIfValidationCount = 0; int tryCatchValidationCount = 0; int retryValidationCount = 0; int beginSwitchValidationCount = 0; foreach (ListViewItem item in _selectedTabScriptActions.Items) { if (item.Tag is BrokenCodeCommentCommand) { Notify("Please verify that all broken code has been removed or replaced.", Color.Yellow); return; } else if ((item.Tag is LoopCollectionCommand) || (item.Tag is LoopContinuouslyCommand) || (item.Tag is LoopNumberOfTimesCommand) || (item.Tag is BeginLoopCommand) || (item.Tag is BeginMultiLoopCommand)) { beginLoopValidationCount++; } else if (item.Tag is EndLoopCommand) { beginLoopValidationCount--; } else if ((item.Tag is BeginIfCommand) || (item.Tag is BeginMultiIfCommand)) { beginIfValidationCount++; } else if (item.Tag is EndIfCommand) { beginIfValidationCount--; } else if (item.Tag is BeginTryCommand) { tryCatchValidationCount++; } else if (item.Tag is EndTryCommand) { tryCatchValidationCount--; } else if (item.Tag is BeginRetryCommand) { retryValidationCount++; } else if (item.Tag is EndRetryCommand) { retryValidationCount--; } else if (item.Tag is BeginSwitchCommand) { beginSwitchValidationCount++; } else if (item.Tag is EndSwitchCommand) { beginSwitchValidationCount--; } //end loop was found first if (beginLoopValidationCount < 0) { Notify("Please verify the ordering of your loops.", Color.Yellow); return; } //end if was found first if (beginIfValidationCount < 0) { Notify("Please verify the ordering of your ifs.", Color.Yellow); return; } if (tryCatchValidationCount < 0) { Notify("Please verify the ordering of your try/catch blocks.", Color.Yellow); return; } if (retryValidationCount < 0) { Notify("Please verify the ordering of your retry blocks.", Color.Yellow); return; } if (beginSwitchValidationCount < 0) { Notify("Please verify the ordering of your switch/case blocks.", Color.Yellow); return; } } //extras were found if (beginLoopValidationCount != 0) { Notify("Please verify the ordering of your loops.", Color.Yellow); return; } //extras were found if (beginIfValidationCount != 0) { Notify("Please verify the ordering of your ifs.", Color.Yellow); return; } if (tryCatchValidationCount != 0) { Notify("Please verify the ordering of your try/catch blocks.", Color.Yellow); return; } if (retryValidationCount != 0) { Notify("Please verify the ordering of your retry blocks.", Color.Yellow); return; } if (beginSwitchValidationCount != 0) { Notify("Please verify the ordering of your switch/case blocks.", Color.Yellow); return; } //define default output path if (string.IsNullOrEmpty(ScriptFilePath) || (saveAs)) { SaveFileDialog saveFileDialog = new SaveFileDialog { InitialDirectory = ScriptProjectPath, RestoreDirectory = true, Filter = "Json (*.json)|*.json" }; if (saveFileDialog.ShowDialog() != DialogResult.OK) { return; } if (!saveFileDialog.FileName.ToString().Contains(ScriptProjectPath)) { Notify("An Error Occured: Attempted to save script outside of project directory", Color.Red); return; } ScriptFilePath = saveFileDialog.FileName; string scriptFileName = Path.GetFileNameWithoutExtension(ScriptFilePath); if (uiScriptTabControl.SelectedTab.Text != scriptFileName) { UpdateTabPage(uiScriptTabControl.SelectedTab, ScriptFilePath); } } //serialize script try { var exportedScript = Script.SerializeScript(_selectedTabScriptActions.Items, _scriptVariables, _scriptElements, ScriptFilePath); uiScriptTabControl.SelectedTab.Text = uiScriptTabControl.SelectedTab.Text.Replace(" *", ""); //show success dialog Notify("File has been saved successfully!", Color.White); try { ScriptProject.SaveProject(ScriptFilePath); } catch (Exception ex) { Notify(ex.Message, Color.Red); } } catch (Exception ex) { Notify("An Error Occured: " + ex.Message, Color.Red); } }
private void tsmiRenameFile_Click(object sender, EventArgs e) { try { string selectedNodePath = tvProject.SelectedNode.Tag.ToString(); string selectedNodeName = tvProject.SelectedNode.Text.ToString(); string selectedNodeNameWithoutExtension = Path.GetFileNameWithoutExtension(selectedNodeName); if (selectedNodeName != "project.obconfig") { FileInfo selectedNodeDirectoryInfo = new FileInfo(selectedNodePath); string newName = ""; var newNameForm = new frmInputBox("Enter the new name of the file WITH extension", "Rename File"); newNameForm.txtInput.Text = selectedNodeDirectoryInfo.Name; newNameForm.ShowDialog(); if (newNameForm.DialogResult == DialogResult.OK) { newName = newNameForm.txtInput.Text; newNameForm.Dispose(); } else if (newNameForm.DialogResult == DialogResult.Cancel) { newNameForm.Dispose(); return; } if (!Path.HasExtension(newName)) { throw new FileFormatException($"No extension provided for '{newName}'"); } string newPath = Path.Combine(selectedNodeDirectoryInfo.DirectoryName, newName); bool isInvalidProjectName = new[] { @"/", @"\" }.Any(c => newName.Contains(c)); if (isInvalidProjectName) { throw new Exception("Illegal characters in path"); } if (File.Exists(newPath)) { throw new Exception("A file with this name already exists"); } var foundTab = uiScriptTabControl.TabPages.Cast <TabPage>().Where(t => t.ToolTipText == selectedNodePath) .FirstOrDefault(); if (foundTab != null) { DialogResult result = CheckForUnsavedScript(foundTab); if (result == DialogResult.Cancel) { return; } uiScriptTabControl.TabPages.Remove(foundTab); } FileSystem.Rename(selectedNodePath, newPath); if (selectedNodeName == _mainFileName) { string newMainName = Path.GetFileName(newPath); _mainFileName = newMainName; ScriptProject.Main = newMainName; ScriptProject.SaveProject(newPath); } tvProject.SelectedNode.Name = newName; tvProject.SelectedNode.Text = newName; tvProject.SelectedNode.Tag = newPath; } } catch (Exception ex) { Notify("An Error Occured: " + ex.Message, Color.Red); } }
public ActionResult Display(int id) { try { ScreenViewer.API.ProjectController PC = new API.ProjectController(); var actionResult = PC.GetScriptProject(id); var response = actionResult as OkNegotiatedContentResult <ScriptProject>; ScriptProject scriptProject = response.Content; if (TempData["addparams"] == null || !(bool)TempData["addparams"]) { SessionManager.ClearSessionData(HttpContext.Session); if (!ScreenViewer.SignInHelper.ValidateSignIn()) { return(RedirectToAction("Login", "Account", new { ReturnUrl = System.Web.HttpContext.Current.Request.Url.ToString() })); } AddProgramParameter(); } SessionControl.SessionManager.StoreProjectId(HttpContext.Session, id); SessionControl.SessionManager.StoreProjectName(HttpContext.Session, scriptProject.ProjectName); SessionControl.SessionManager.StoreProjectDescription(HttpContext.Session, scriptProject.ProjectDesc); SessionControl.SessionManager.StoreScreenLayout(HttpContext.Session, scriptProject.ScreenLayout); SessionControl.SessionManager.StoreNotificationText(HttpContext.Session, scriptProject.NotificationText); if (!string.IsNullOrEmpty(scriptProject.ScreenLayout)) { ScreenViewer.API.WorkflowLayoutsController WLC = new ScreenViewer.API.WorkflowLayoutsController(); var actionResult2 = WLC.GetWorkflowLayoutString(SessionManager.GetScreenLayout(HttpContext.Session), SessionManager.GetClientId(HttpContext.Session)); if (actionResult2 != null && actionResult2 != actionResult2 as System.Web.Http.Results.NotFoundResult) { var layoutResponse = actionResult2 as OkNegotiatedContentResult <string>; SessionControl.SessionManager.StoreLayoutHTML(HttpContext.Session, layoutResponse.Content); } } if (scriptProject.ScriptProjectWorkflows.Count > 0) { if (scriptProject.RequireKey.Value) { string key = SessionControl.SessionManager.GetScriptParameterByKey("key", HttpContext.Session); if (!string.IsNullOrEmpty(key)) { if (!key.Equals(scriptProject.KeyText.ToString())) { throw new Exception(string.Format("Unable to verify the project key {0}.", key)); } } else { throw new Exception(string.Format("Project key is missing.")); } } // Create the contact record CreateContactRecord(scriptProject.ProjectName); if (scriptProject.LogoImageID != null && scriptProject.LogoImageID != 0) { var imageResult = PC.GetScriptProjectImage(scriptProject.LogoImageID.Value); var imageResponse = imageResult as OkNegotiatedContentResult <ScriptImage>; SessionControl.SessionManager.StoreLogoImage(HttpContext.Session, ((ScriptImage)imageResponse.Content).Image); } if (scriptProject.ScriptMenuID != null && scriptProject.ScriptMenuID != 0) { var scriptMenu = PC.GetScriptProjectMenu(scriptProject.ScriptMenuID.Value); var menuResponse = scriptMenu as OkNegotiatedContentResult <ScriptMenu>; ScriptUL ul; using (StringReader sr = new StringReader(menuResponse.Content.MenuXML)) { XmlSerializer xs = new XmlSerializer(typeof(ScriptUL)); ul = (ScriptUL)xs.Deserialize(sr); } StringWriter stringWriter = new StringWriter(); string menuType = "Navbar"; string addClass = ""; using (HtmlTextWriter writer = new HtmlTextWriter(stringWriter)) { switch (menuType) { case "Tabbed": addClass = "nav nav-tabs"; break; case "Pills": addClass = "nav nav-pills"; break; case "Navbar": writer.AddAttribute(HtmlTextWriterAttribute.Class, "navbar navbar-default"); writer.RenderBeginTag("nav"); writer.AddAttribute(HtmlTextWriterAttribute.Class, "container"); writer.RenderBeginTag(HtmlTextWriterTag.Div); addClass = "nav navbar-nav"; break; } writer.AddAttribute(HtmlTextWriterAttribute.Class, addClass); writer.RenderBeginTag(HtmlTextWriterTag.Ul); // Begin #1 foreach (ScriptLI li in ul.LIArray) { writer.Write(PopulateLItem(li)); } writer.RenderEndTag(); if (menuType == "Navbar") { writer.RenderEndTag(); } } SessionControl.SessionManager.StoreMenu(HttpContext.Session, stringWriter.ToString()); } if (scriptProject.ShowWorkflowSection.Value) { SessionControl.SessionManager.StoreProgramParameter("Section", "Yes", HttpContext.Session); } if (scriptProject.ShowWorkflowSection.Value) { SessionControl.SessionManager.StoreProgramParameter("Workflow", "Yes", HttpContext.Session); } if (scriptProject.ShowNotification.Value) { SessionControl.SessionManager.StoreProgramParameter("Notification", "Yes", HttpContext.Session); } if (scriptProject.ShowNotes.Value) { SessionControl.SessionManager.StoreProgramParameter("CallNotes", "Yes", HttpContext.Session); } if (scriptProject.ShowLead.Value) { SessionControl.SessionManager.StoreProgramParameter("LeadInformation", "Yes", HttpContext.Session); } if (scriptProject.ShowCallback.Value) { SessionControl.SessionManager.StoreProgramParameter("ScheduleCallback", "Yes", HttpContext.Session); } if (scriptProject.ShowLanguage != null && scriptProject.ShowLanguage.Value) { SessionControl.SessionManager.StoreProgramParameter("ShowLanguage", "Yes", HttpContext.Session); } ScriptProjectWorkflow workFlow = scriptProject.ScriptProjectWorkflows.Where(c => c.ScriptWorkflowActiveDate <= DateTime.Now).OrderByDescending(t => t.ScriptWorkflowActiveDate).FirstOrDefault(); return(RedirectToAction("Display", "Workflow", new { id = workFlow.ScriptWorkflowID })); } else { return(View("Display")); } } catch (Exception ex) { Data.Log log = ex.Save(HttpContext.Session, WorkflowHelper.BuildCallData(HttpContext.Session), ImpactLevel.High); ViewBag.URL = SessionManager.GetScriptURL(Session); return(View("Error", new HandleErrorInfo(ex, "ProjectController", "DisplayByName"))); } }
// GET: /Workflow/ public ActionResult Display(int id) { //DataObjectLoader DOL = new API.ExternalData.DataObjectLoader(); WorkflowDisplay wfDisplay = new WorkflowDisplay(); WFNodeInfo nextNode = null; ScreenViewer.API.WorkflowController WFC = new API.WorkflowController(); var actionResult = WFC.GetScriptWorkflow(id); DataObjectManager DOM = new DataObjectManager(); if (actionResult != null) { var response = actionResult as OkNegotiatedContentResult <ScriptWorkflow>; ViewBag.WorkflowName = response.Content.WorkflowName; wfDisplay.workflowName = response.Content.WorkflowName; nextNode = DetermineNextNode((ScriptWorkflow)response.Content, currentNode, direction); if (nextNode != null) { if (!direction.Equals(MoveDirection.Current) && nextNode.nodeName != null && nextNode.nodeType.Equals(NodeType.Section)) { SessionManager.StoreNavigation(HttpContext.Session, nextNode.nodeName, wfDisplay.workflowName.ToString()); } if (nextNode.nodeActions != "") //&& fireactions { FireActions(nextNode.nodeActions); } switch (nextNode.nodeType) { case NodeType.Section: AddtoWFHistory(response.Content.ScriptWorkflowID, nextNode.NodeUniqueID, response.Content.WorkflowName, nextNode.nodeName); break; case NodeType.Workflow: return(RedirectToAction("Display", "Workflow", new { id = WFC.GetScriptWorkflowId(nextNode.nodeName) })); case NodeType.PreviousWorkflow: return(RedirectToAction("DisplayByDirection", "Workflow", new { id = WFC.GetScriptWorkflowId(nextNode.nodeName), currentNode = nextNode.DocUID, moveDirection = MoveDirection.Current })); case NodeType.SignPost: MoveDirection direction2 = direction == MoveDirection.Start ? MoveDirection.Forward : direction; WFNodeInfo holdNode = nextNode; nextNode = DetermineNextNode((ScriptWorkflow)response.Content, nextNode.NodeUniqueID, direction2); if (nextNode == null) { direction = MoveDirection.Current; return(Display(Convert.ToInt32(Request.Form["hdnWorkflowId"]))); //nextNode = holdNode; } else { if (!direction.Equals(MoveDirection.Current) && nextNode.nodeName != null) { SessionManager.StoreNavigation(HttpContext.Session, nextNode.nodeName, wfDisplay.workflowName.ToString()); AddtoWFHistory(response.Content.ScriptWorkflowID, nextNode.NodeUniqueID, response.Content.WorkflowName, nextNode.nodeName); } if (nextNode.nodeType.Equals(NodeType.Workflow)) { return(RedirectToAction("Display", "Workflow", new { id = WFC.GetScriptWorkflowId(nextNode.nodeName) })); } } FireActions(nextNode.nodeActions); if (nextNode.nodeType.Equals(NodeType.SignPost)) { nextNode = DetermineNextNode((ScriptWorkflow)response.Content, nextNode.NodeUniqueID, direction2); if (nextNode == null) { direction = MoveDirection.Current; return(Display(Convert.ToInt32(Request.Form["hdnWorkflowId"]))); //nextNode = holdNode; } else { if (!direction.Equals(MoveDirection.Current) && nextNode.nodeName != null) { SessionManager.StoreNavigation(HttpContext.Session, nextNode.nodeName, wfDisplay.workflowName.ToString()); AddtoWFHistory(response.Content.ScriptWorkflowID, nextNode.NodeUniqueID, response.Content.WorkflowName, nextNode.nodeName); } if (nextNode.nodeType.Equals(NodeType.Workflow)) { return(RedirectToAction("Display", "Workflow", new { id = WFC.GetScriptWorkflowId(nextNode.nodeName) })); } } FireActions(nextNode.nodeActions); } break; } if (IsNextNode((ScriptWorkflow)response.Content, nextNode.NodeUniqueID)) { wfDisplay.showNext = true; } else { wfDisplay.showNext = false; } } else { direction = MoveDirection.Current; return(Display(Convert.ToInt32(Request.Form["hdnWorkflowId"]))); } } if (AddHistory) { if (SessionManager.GetWorkflowHistory(HttpContext.Session).Length >= 2) { wfDisplay.showPrevious = true; } else { wfDisplay.showPrevious = false; } } Session["layout"] = null; wfDisplay.nextNode = nextNode; wfDisplay.workflowID = id.ToString(); nextNode.DocUID = id; SessionManager.StoreNextNode(HttpContext.Session, nextNode); wfDisplay.callNotes = SessionManager.GetContactNotes(HttpContext.Session); string layoutname = "_default"; if (!string.IsNullOrEmpty(SessionManager.GetScreenLayout(HttpContext.Session))) { layoutname = SessionManager.GetScreenLayout(HttpContext.Session); } WorkflowLayoutsController WLC = new WorkflowLayoutsController(); //var actionResult2 = WLC.GetWorkflowLayoutString(layoutname, ScreenViewer.ClientHelper.GetClientIdByUserID(System.Web.HttpContext.Current.User.Identity.GetUserId())); var actionResult2 = WLC.GetWorkflowLayoutString(layoutname, SessionManager.GetScriptParameterByKey("ClientId", HttpContext.Session)); if (actionResult2 != null) { var response = actionResult2 as OkNegotiatedContentResult <string>; wfDisplay.Layout = response.Content; } ScriptProject scriptproject = null; API.ProjectController PC = new API.ProjectController(); var actionResult3 = PC.GetScriptProject(SessionManager.GetProjectId(HttpContext.Session)); if (actionResult3 != null) { var response = actionResult3 as OkNegotiatedContentResult <ScriptProject>; scriptproject = response.Content; } string notif = scriptproject.NotificationText; wfDisplay.menuHTML = SessionManager.GetMenuHTML(HttpContext.Session); wfDisplay.Notifications = scriptproject.NotificationText; //notif.Replace(System.Environment.NewLine,""); return(View("_WorkFlowViewLayout1", wfDisplay)); }
/// <summary> /// Constructs a local (task-specific) script task. /// </summary> public ScriptTask(Script script, ProjectWrapper projectWrapper, PackageWrapper packageWrapper, ContainerWrapper containerWrapper, ScriptProject referencedGlobalScriptProject) { bool hasReference = script.ScriptProjectReference != null; ScriptTaskWrapper = new ScriptTaskWrapper(containerWrapper, hasReference ? script.ScriptProjectReference.ScriptProjectName : script.ScriptProject.Name, hasReference, ScriptTaskScope.Package) { Name = script.Name, DelayValidation = script.DelayValidation, ForceExecutionResult = script.ForceExecutionResult.ToString() }; AddExpressions(ScriptTaskWrapper, script.PropertyExpressions); if (hasReference) { ScriptTaskWrapper.ReadOnlyVariables = GetVariableNames(referencedGlobalScriptProject.ReadOnlyVariables, ScriptTaskScope.Package, projectWrapper, packageWrapper, containerWrapper); ScriptTaskWrapper.ReadWriteVariables = GetVariableNames(referencedGlobalScriptProject.ReadWriteVariables, ScriptTaskScope.Package, projectWrapper, packageWrapper, containerWrapper); } else { ScriptTaskWrapper.ReadOnlyVariables = GetVariableNames(script.ScriptProject.ReadOnlyVariables, ScriptTaskScope.Package, projectWrapper, packageWrapper, containerWrapper); ScriptTaskWrapper.ReadWriteVariables = GetVariableNames(script.ScriptProject.ReadWriteVariables, ScriptTaskScope.Package, projectWrapper, packageWrapper, containerWrapper); AddAssemblyReferences(script.ScriptProject.AssemblyReferences, projectWrapper.Version); AddSourceFiles(script.ScriptProject.Files); } CheckForBuildErrors(projectWrapper.StopBuildOnScriptErrors); ScriptTaskWrapper.PropagateErrors(script.PropagateErrors); }
public static void CreateTask(ProjectWrapper projectWrapper, PackageWrapper packageWrapper, ContainerWrapper containerWrapper, IonStructure.Task task, List <ScriptProject> globalScriptProjects, ScriptProject referencedGlobalScriptProject = null) { try { ExecutableWrapper executableWrapper = null; switch (task) { case DataFlow dataFlow: DataFlowTask dataFlowTask = new DataFlowTask(dataFlow, projectWrapper, packageWrapper, containerWrapper); executableWrapper = dataFlowTask.DataFlowTaskWrapper; break; case ExecuteSql executeSql: ExecuteSqlTask executeSqlTask = new ExecuteSqlTask(executeSql, containerWrapper); executableWrapper = executeSqlTask.ExecuteSqlTaskWrapper; break; case ExecuteProcess executeProcess: executableWrapper = ExecuteProcessTask.CreateTask(executeProcess, containerWrapper); break; case Expression expression: executableWrapper = ExpressionTask.CreateTask(expression, containerWrapper); break; case Script script: ScriptTask scriptTask = new ScriptTask(script, projectWrapper, packageWrapper, containerWrapper, referencedGlobalScriptProject); executableWrapper = scriptTask.ScriptTaskWrapper; break; case ForLoopContainer forLoopContainer: executableWrapper = ContainerExecutable.CreateForLoopContainer(forLoopContainer, projectWrapper, packageWrapper, containerWrapper, globalScriptProjects); break; case ForEachFromVariableLoopContainer forEachFromVarLoopContainer: executableWrapper = ContainerExecutable.CreateForEachFromVariableLoopContainer(forEachFromVarLoopContainer, projectWrapper, packageWrapper, containerWrapper, globalScriptProjects); break; case SequenceContainer sequenceContainer: executableWrapper = ContainerExecutable.CreateSequenceContainer(sequenceContainer, projectWrapper, packageWrapper, containerWrapper, globalScriptProjects); break; } AddPrecedenceConstraints(containerWrapper, executableWrapper, task.PrecedenceConstraints); } catch (Exception e) { if (e.Data[Constants.ExceptionTaskKey] == null) { e.Data[Constants.ExceptionTaskKey] = task.Name; } else { e.Data[Constants.ExceptionTaskKey] = task.Name + "/" + e.Data[Constants.ExceptionTaskKey]; // If task is not null then the task being created is a container, and an exception has been thrown in one of its underlying tasks. } throw; } }
public static void ConstructTask(ProjectWrapper project, PackageWrapper package, ContainerWrapper taskContainer, Task task, ScriptProject innerTask = null) { try { ExecutableWrapper executableTask = null; switch (task) { case DataFlow dataflowTask: executableTask = DataFlowTask.ConstructTask(dataflowTask, project, package, taskContainer); break; case ExecuteSql executeSqlTask: executableTask = ConstructExecuteSqlTask(executeSqlTask, taskContainer); break; case ExecuteProcess executeProcessTask: executableTask = ConstructExecuteProcessTask(executeProcessTask, taskContainer); break; case Expression expressionTask: executableTask = ConstructExpressionTask(expressionTask, taskContainer); break; case Script scriptTask: executableTask = ConstructScriptTask(scriptTask, project, package, taskContainer, innerTask); break; case ForLoopContainer forLoopContainer: executableTask = ContainerExecutable.ConstructForLoopContainer(forLoopContainer, project, package, taskContainer); break; case ForEachFromVariableLoopContainer forEachFromVarLoopContainer: executableTask = ContainerExecutable.ConstructForEachFromVariableLoopContainer(forEachFromVarLoopContainer, project, package, taskContainer); break; case SequenceContainer sequenceContainer: executableTask = ContainerExecutable.ConstructSequenceContainer(sequenceContainer, project, package, taskContainer); break; } AddPrecedenceConstraints(taskContainer, executableTask, task.PrecedenceConstraints); } catch (Exception e) { if (e.Data[Constants.ExceptionTaskKey] == null) { e.Data[Constants.ExceptionTaskKey] = task.Name; } else { e.Data[Constants.ExceptionTaskKey] = task.Name + "/" + e.Data[Constants.ExceptionTaskKey]; // If task is not null then the task being constructed is a container and an exception has been thrown in one of the underlying tasks. } throw; } }