public override kCura.EventHandler.Console GetConsole(kCura.EventHandler.ConsoleEventHandler.PageEvent pageEvent) { //Construct a console object to build the console appearing in the UI. kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console { Items = new List <kCura.EventHandler.IConsoleItem>(), Title = CONSOLE_TITLE }; //Construct the submit job button. kCura.EventHandler.ConsoleButton submitJobButton = new kCura.EventHandler.ConsoleButton { Name = INSERT_JOB_BUTTON_NAME, DisplayText = INSERT_JOB_DISPLAY_TEXT, ToolTip = INSERT_JOB_TOOL_TIP, RaisesPostBack = true }; //If a job is already in the queue, change the text and disable the button. if (pageEvent == PageEvent.PreRender) { System.Data.SqlClient.SqlParameter workspaceArtifactIDParam = new System.Data.SqlClient.SqlParameter("@WorkspaceArtifactID", System.Data.SqlDbType.Int) { Value = this.Helper.GetActiveCaseID() }; System.Data.SqlClient.SqlParameter jobArtifactIDParam = new System.Data.SqlClient.SqlParameter("@JobArtifactID", System.Data.SqlDbType.Int) { Value = this.ActiveArtifact.ArtifactID }; int jobCount = this.Helper.GetDBContext(-1).ExecuteSqlStatementAsScalar <Int32>(JOB_EXISTS_QUERY, new System.Data.SqlClient.SqlParameter[] { workspaceArtifactIDParam, jobArtifactIDParam }); //Use the helper function to check if a job currently exists. Set Enabled to the opposite value. if (jobCount > 0) { submitJobButton.Enabled = false; } else { submitJobButton.Enabled = true; } } //Add the buttons to the console. returnConsole.Items.Add(submitJobButton); return(returnConsole); }
public override kCura.EventHandler.Console GetConsole(kCura.EventHandler.ConsoleEventHandler.PageEvent pageEvent) { kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console(); return(returnConsole); }