Example #1
0
        protected void CreateWorkflowBtn_Click(object sender, EventArgs e)
        {
            //create new
            if (WorkflowName.Text.Length > 0 && Request.QueryString["wid"] == null)
            {
                WorkflowModel w    = WorkflowUtil.CreateWorkflow(WorkflowName.Text);
                User          user = (User)Session["User"];
                Log.Info(user.Identity + " created a new workflow template " + w.WorkflowName);
                SaveComponents(w.WorkflowId);
            }
            //update existing
            else if (WorkflowName.Text.Length > 0 && Request.QueryString["wid"] != null)
            {
                int workflowId = int.Parse(Request.QueryString["wid"]);
                WorkflowUtil.UpdateWorkflow(workflowId, WorkflowName.Text);

                SaveComponents(workflowId);
            }
        }
Example #2
0
        protected void AddWorkflowComponentBtn_Click(object sender, EventArgs e)
        {
            if (WorkflowName.Text.Length > 0)
            {
                int         workflowId = 0;
                List <Guid> ids        = this.ControlIDs;
                Guid        guid       = Guid.NewGuid();
                ids.Add(guid);

                WorkflowComponent wc = null;
                if (Request.QueryString["wid"] != null)
                {
                    if (WorkflowName.Text.Length > 0)
                    {
                        workflowId = int.Parse(Request.QueryString["wid"]);
                        WorkflowUtil.UpdateWorkflow(workflowId, WorkflowName.Text);
                        SaveComponents(workflowId);
                        wc = WorkflowComponentUtil.CreateWorkflowComponent(workflowId);
                    }
                }
                else
                {
                    if (WorkflowName.Text.Length > 0)
                    {
                        WorkflowModel w    = WorkflowUtil.CreateWorkflow(WorkflowName.Text);
                        User          user = (User)Session["User"];
                        Log.Info(user.Identity + " created workflow template " + w.WorkflowName);
                        workflowId = w.WorkflowId;
                        SaveComponents(workflowId);
                        wc = WorkflowComponentUtil.CreateWorkflowComponent(workflowId);
                    }
                }
                Panel componentPanel = CreateWorkflowStep(guid, wc);
                this.ControlIDs = ids;
                Response.Redirect("Workflows.aspx?edit=1&wid=" + workflowId);
            }
            else
            {
                WorkflowError.Visible = true;
                WorkflowError.Text    = "Please name the Workflow before adding steps";
            }
        }