Example #1
0
        protected void forward_Click(object sender, EventArgs e)
        {
            bool        final  = workflow.IsFinalState();
            WFnode      actual = workflow.GetState();
            XmlDocument doc    = new XmlDocument();

            doc.LoadXml(actual.GetValue(/*nodePlaceHolder.Controls[0]*/ presenPanel.Controls[0], actual.GetRenderingDocument().DocumentElement.FirstChild));
            ActionResult ar = workflow.ComputeNewStatus(WFeventType.TRYGOON, doc, ValidationEventHandler);

            if (ar.OK && !final)
            {
                //nodePlaceHolder.ResetStates();
                //nodePlaceHolder.Controls.Clear();
                presenPanel.Controls.Clear();
                WFnode currentNode = workflow.GetState();
                renderNode(currentNode);

                /////////////////////////////////HISTORY//////////////////////////////////////////////////////////////////
                UpdateHistory(currentNode, ar);
                /////////////////////////////////HISTORY//////////////////////////////////////////////////////////////////
            }
            else if (ar.OK && final)
            {
                //nodePlaceHolder.ResetStates();
                //nodePlaceHolder.Controls.Clear();
                presenPanel.Controls.Clear();
                //nodePlaceHolder.Controls.Add(new Panel());//To not handle generic error dialog
                presenPanel.Controls.Add(new Panel());
                presenPanel2.Visible = true;
                forward.Visible      = false;
                save.Visible         = true;

                XmlDocument xd = workflow.GetCollectedDocument();
                xd.Schemas = workflow.GetCollectedDocumentSchemas();
                xd.Validate(null);//bug
                XmlNodeList          ln       = xd.ChildNodes[1].ChildNodes;
                IEnumerable <WFnode> nodeList = workflow.getNodeList();

                foreach (XmlNode xnd in ln)
                {
                    foreach (WFnode wfn in nodeList)
                    {
                        if (wfn.Name == XmlConvert.DecodeName(xnd.Name))
                        {
                            renderFinal(wfn, xnd);
                        }
                    }
                }
                presenPanel3.Controls.Clear();
            }
            else
            {
                /*It remains here...but someone should say him that there is no edge or his input doesn't validate*/
                WFnode currentNode = workflow.GetState();
                UpdateHistory(currentNode, ar);
            }
        }
Example #2
0
        /// <summary>
        /// Saves the filling contained into the ComputableWorkflow associated onto the DB
        /// This Method can be used only in the filling case
        /// </summary>
        /// <returns><value>true</value>on success, <value>false</value>otherwise</returns>
        public bool SaveFilling()
        {
            if (!complete)
            {
                fillReference();
            }

            if (!filling)
            {
                return(false);
            }

            if (compilationReqId == -1)
            {
                return(false);
            }

            if (cwf_cache == null)
            {
                // If we don't have a Computable Workflow, we can't save the filling
                return(false);
            }

            System.Xml.XmlDocument doc = cwf_cache.GetCollectedDocument();

            object res = sto.addResult(compilationReqId, StorageManager.xmlDocumentToXElement(doc));

            if (res == null)
            {
                return(false);
            }
            else
            {
                Publication pub = sto.getEntityByID <Publication>(publicationId);
                if (pub != null && !String.IsNullOrEmpty(pub.URIUpload))
                {
                    CommunicationService.Instance.Send((Result)res);
                }
                return(true);
            }
        }