Esempio n. 1
0
        public IResult Process(FakeHttpContext context, System.Runtime.InteropServices.Expando.IExpando expando)
        {
            browser = context.CoreBrowser;
            ScriptObject so = JsonConvert.DeserializeObject <ScriptObject>(expando.GetString("Model"));

            scriptId = so.Id;
            string modelId = so.ModelId;

            //纯脚本执行,没有关联数据模型
            if (string.IsNullOrEmpty(so.ModelId) || modelId == "0")
            {
                Publish(modelId, scriptId, "0");
            }
            else
            {
                List <SchemaObject> source = ServerApiInvoker.Get_shcema_objects(Identity.UserId, scriptId);
                if (source.Count == 0)
                {
                    context.GoTo(StringHelper.Domain + "/portal/thread/create/" + modelId, "_blank");
                }
                else
                {
                    SchemaObjectSelect selectDialog = new SchemaObjectSelect(modelId, source);
                    selectDialog.Context = context;
                    string schemaObjectId = "0";
                    bool   appendLink     = false;
                    if (selectDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        schemaObjectId = selectDialog.SchemaObjectId;
                        appendLink     = selectDialog.AppendOutLink;
                    }
                    if (schemaObjectId == "0")
                    {
                        return(new EmptyResult());
                    }

                    if (Identity.MockUser == null)
                    {
                        System.Windows.Forms.MessageBox.Show("请先登录");
                    }
                    else
                    {
                        Publish(modelId, scriptId, schemaObjectId);
                    }
                }
            }
            return(new EmptyResult());
        }