Esempio n. 1
0
 private void procNewOne(Object state)
 {
     try
     {
         if (t != null && t.Authenticated)
         {
             User currentUser = t.GetCurrentUser();
             wf.WorkflowName = "TESTDBFLOADING";
             WorkflowReference wfRef = currentUser.AddNewWorkFlow(wf, "--");
             if (wfRef == null)
             {
             }
             ComputableWorkflowReference computebleWfRef = null;
             computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, "--", "");
         }
     }
     catch
     {
     }
 }
Esempio n. 2
0
        public void RaiseCallbackEvent(string eventArgument)
        {
            if (eventArgument == null || eventArgument == "")
            {
                result = "Error on publishing, contact an administrator";
            }
            else
            {
                string[] args             = eventArgument.Split('|');
                string   type             = args[0];
                string   description      = args[1];
                string   expiration_date  = args[2];
                string   checkOption      = args[3];
                string   serviceList      = args[4];
                string   usingStaticField = args[5];

                try
                {
                    //Publishing WF
                    Security.Token tok = (Security.Token)Page.Session["Token"];
                    if (tok != null && tok.Authenticated)
                    {
                        if (tok.GetCurrentUser().Registered)
                        {
                            string uri = (string)Page.Session["uriFromComm"];


                            WorkflowReference wfRef = (WorkflowReference)Page.Session["WFE_CurrentWorkflowReference"];

                            ComputableWorkflowReference computebleWfRef = null;
                            if (type.Equals("public"))
                            {
                                if (checkOption.Equals("false"))
                                {
                                    computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, 1, description, expiration_date, uri);
                                }
                                else
                                {
                                    if (serviceList.Equals("allservices"))
                                    {
                                        computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITHOUT_REPLICATION, 1, description, expiration_date, uri);
                                    }
                                    else
                                    {
                                        computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_BY_SERVICE, int.Parse(serviceList), description, expiration_date, uri);
                                    }
                                }
                            }
                            else
                            {
                                if (checkOption.Equals("false"))
                                {
                                    computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_NOT_ANONYM, 1, description, expiration_date, uri);
                                }
                                else
                                {
                                    computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_ANONYM, 1, description, expiration_date, uri);
                                }
                            }

                            if (computebleWfRef == null)
                            {
                                result = "Database Error: An error occurred while publishing!";
                            }
                            else
                            {
                                //For Theme-Editor
                                Page.Session["WFE_CurrentWorkflow"] = computebleWfRef;
                                if (usingStaticField.Equals("true"))
                                {
                                    Page.Session["UsingStaticFields"] = true;
                                }
                                else
                                {
                                    Page.Session["UsingStaticFields"] = false;
                                }

                                result = "Workflow published";
                                Page.Session["uriFromComm"] = "";
                            }
                        }
                    }
                    else
                    {
                        result = "You are not logged in!";
                    }
                }
                catch (Exception e)
                {
                    result = e.Message;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Receives client's call and saves the Workflow
        /// </summary>
        /// <param name="eventArgument">WorkflowId from client</param>
        public void RaiseCallbackEvent(string eventArgument)
        {
            //Publishing WF
            try
            {
                string[] args             = eventArgument.Split('|');
                string   wfID             = args[0];
                string   type             = args[1];
                string   description      = args[2];
                string   expiration_date  = args[3];
                string   checkOption      = args[4];
                string   serviceList      = args[5];
                string   usingStaticField = args[6];

                //Publishing WF
                Token t = (Token)Page.Session["Token"];
                if (t != null && t.Authenticated && t.GetCurrentUser().Registered)
                {
                    string uri = (string)Page.Session["uriFromComm"];
                    Page.Session["uriFromComm"] = "";

                    WorkflowReference wfRef = (WorkflowReference)Page.Session["WFE_CurrentWorkflowReference"];

                    ComputableWorkflowReference computebleWfRef = null;
                    if (type.Equals("public"))
                    {
                        if (checkOption.Equals("false"))
                        {
                            //computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, description, expiration_date);
                            computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITH_REPLICATION, 1, description, expiration_date, uri);
                        }
                        else
                        {
                            if (serviceList.Equals("allservices"))
                            {
                                computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_WITHOUT_REPLICATION, 1, description, expiration_date, uri);
                            }
                            else
                            {
                                computebleWfRef = wfRef.MakeComputable(FormType.PUBLIC_BY_SERVICE, int.Parse(serviceList), description, expiration_date, uri);
                            }
                        }
                    }
                    else
                    {
                        if (checkOption.Equals("false"))
                        {
                            computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_NOT_ANONYM, 1, description, expiration_date, uri);
                        }
                        else
                        {
                            computebleWfRef = wfRef.MakeComputable(FormType.PRIVATE_ANONYM, 1, description, expiration_date, uri);
                        }
                    }



                    if (computebleWfRef == null)
                    {
                        callbackResult = "Database Error: An error occurred while publishing!";
                    }
                    else
                    {
                        //For Theme-Editor
                        Page.Session["WFE_CurrentWorkflow"] = computebleWfRef;
                        Page.Session["themeReturn"]         = "http://" + Security.EnvironmentManagement.getEnvValue("webServerAddress") + "/WorkflowEditor/WorkflowEditor.aspx";
                        if (usingStaticField.Equals("true"))
                        {
                            Page.Session["UsingStaticFields"] = true;
                        }
                        else
                        {
                            Page.Session["UsingStaticFields"] = false;
                        }

                        callbackResult = "OK|" + type + "|Publish OK!|" + wfID;
                        Page.Session["uriFromComm"] = "";
                    }
                }
                else
                {
                    callbackResult = "You are not logged in!";
                }
            }
            catch (Exception e)
            {
                callbackResult = e.Message;
            }
        }