Beispiel #1
0
        public ActionXmlSet Read()
        {
            ScriptObject script = ServerApiInvoker.Get_Script(scriptId);

            ActionXmlSet xmlset = new ActionXmlSet()
            {
                XmlAction = script.Script,
                SchemaSet = new ActionSchemaSet()
            };

            Schema schema = null;

            if (Convert.ToInt32(schemaId) > 0)
            {
                schema = ServerApiInvoker.GetSchema(schemaId);
            }

            SchemaObject sco = null;

            if (Convert.ToInt32(schemaObjectId) > 0)
            {
                sco = ServerApiInvoker.GetSchemaObject(schemaObjectId);
            }
            if (schema != null)
            {
                xmlset.SchemaSet = new ActionSchemaSet(schema.DisplayName, schema.JsonObject, sco.JsonValue);
            }
            return(xmlset);
        }
Beispiel #2
0
        public override void Report(Core.Actions.ActionBase action, Exception ex)
        {
            ActionException aex = CreateActionException(action, ex);

            ServerApiInvoker.ExceptionReport(aex.ScriptId, aex.ActionId
                                             , aex.Message, aex.ActionIndex.ToString(), aex.ActionType, action.Title);
        }
Beispiel #3
0
 public List <WebApi.Entities.WebSite> GetTopWebsite()
 {
     return(CacheExtensions.Data("topwebsite", () =>
     {
         return ServerApiInvoker.Get_TopWebsite();
     }));
 }
Beispiel #4
0
 public List <WebApi.Entities.MockUser> GetMockUsers(string userid)
 {
     return(CacheExtensions.Data(userid, () =>
     {
         return ServerApiInvoker.Get_MockUsers(userid);
     }));
 }
Beispiel #5
0
 private List <WebApi.Entities.ScriptObject> GetScripts(string url)
 {
     url = StringHelper.GetDomain(url);
     return(CacheExtensions.Data(url, () =>
     {
         return ServerApiInvoker.GetScriptObjectByUrl(url);
     }));
 }
Beispiel #6
0
 public ActionXmlSet Read()
 {
     if (scripts == null)
     {
         scripts = ServerApiInvoker.GetScriptObjectByUrl(url);
     }
     currentScriptObject = scripts.FirstOrDefault(c => c.ScriptType == ((int)ReadScriptType).ToString());
     xmlset = CreateActionXmlSet(currentScriptObject);
     return(xmlset);
 }
        public IResult Process(FakeHttpContext context, System.Runtime.InteropServices.Expando.IExpando expando)
        {
            bool            isRegister = expando.GetString("IsRegister") == "checked";
            ICustomIdentity identity   = ServiceLocator.Instance.GetService <ICustomIdentity>();

            identity.MockUser.IsActiveMail = isRegister;
            ServerApiInvoker.PostEmailRegisterStatue(identity.MockUser.Id, isRegister);
            return(new MatchHandler().HandleRequest(new UrlRequest()
            {
                Url = context.PageUrl, HttpContext = context
            }));
        }
Beispiel #8
0
        public ActionXmlSet Read()
        {
            RecorderProtocol protocol = identity as RecorderProtocol;

            if (protocol == null)
            {
                throw new ArgumentException();
            }
            ScriptObject scriptObject = ServerApiInvoker.Get_Script(protocol.ScriptId);

            xmlset = CreateActionXmlSet(scriptObject);
            return(xmlset);
        }
Beispiel #9
0
        /// <summary>
        /// 执行用户手动调整的脚本
        /// </summary>
        /// <param name="result"></param>
        private void WaitComplete(AsyncResult result)
        {
            browser.WBLButtonDown -= new csExWB.HTMLMouseEventHandler(webBrowser_WBLButtonDown);
            string customScript = ServerApiInvoker.Get_record_mark(Identity.UserId, scriptId);

            if (!string.IsNullOrEmpty(customScript) && customScript.Length > 10)
            {
                LocalScriptRepository rep = new LocalScriptRepository(customScript);
                var model = new ModelSet(rep);

                var currentWorker = new ActionRunnable(model);
                currentWorker.Run(null, true);
            }
        }
Beispiel #10
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());
        }
Beispiel #11
0
        private ActionXmlSet CreateActionXmlSet(ScriptObject scriptObject)
        {
            var actionXmlSet = new Core.Models.ActionXmlSet()
            {
                Key       = scriptObject.WebSiteId,
                Name      = scriptObject.Title,
                XmlAction = scriptObject.Script,
                StartUrl  = scriptObject.BeginUrl
            };

            if (!string.IsNullOrEmpty(scriptObject.ModelId) && scriptObject.ModelId != "0")
            {
                Schema schema = ServerApiInvoker.GetSchema(scriptObject.ModelId);
                if (schema == null)
                {
                    throw new ApplicationException("对应数据表单不存在,请重新配置表单模型");
                }
                actionXmlSet.SchemaSet = new ActionSchemaSet(schema.DisplayName, schema.JsonObject);
            }
            return(actionXmlSet);
        }
Beispiel #12
0
        void accountitem_Click(object sender, EventArgs e)
        {
            if (accLastSelect != null)
            {
                accLastSelect.Image = null;
            }
            ToolStripMenuItem item = sender as ToolStripMenuItem;

            accLastSelect = item;
            item.Select();
            item.Image = Resources.selection;
            MockUser        mockUser = item.Tag as MockUser;
            ICustomIdentity identity = ServiceLocator.Instance.GetService <ICustomIdentity>();

            identity.MockUser = mockUser;

            ServerApiInvoker.Shift_MockUserAccount(mockUser.Id);

            ToolStripDropDownButton dd = Items["shiftAccount"] as ToolStripDropDownButton;

            dd.Text = item.Text;
            Home();
        }
Beispiel #13
0
 public void Write(string actionxml)
 {
     ServerApiInvoker.Post_Script(identity.ScriptId, actionxml);
 }
Beispiel #14
0
 public ActionXmlSet GetModulerModel(string modulerId)
 {
     return(CreateActionXmlSet(ServerApiInvoker.Get_Script(identity.WebsiteId, modulerId)));
 }
Beispiel #15
0
 public string[] GetActionModulers()
 {
     return(ServerApiInvoker.Get_SubModules(identity.WebsiteId)
            .Where(c => c.Title != xmlset.Name).Select(c => c.Title).ToArray());
 }
 public void Write(string actionxml)
 {
     ServerApiInvoker.PostRecordMark(userid, scriptId, actionxml);
 }