コード例 #1
0
ファイル: MatchHandler.cs プロジェクト: cnboker/autorobo
        /// <summary>
        /// 处理ajax事件
        /// </summary>
        /// <param name="context"></param>
        /// <param name="expando"></param>
        /// <returns></returns>
        public IResult Process(FakeHttpContext context, System.Runtime.InteropServices.Expando.IExpando expando)
        {
            this.context = context;
            string evt = expando.GetString("event");

            logger.Info("evt:" + evt);
            logger.Info("keywords:" + expando.GetString("keywords"));
            if (evt == "ajaxComplete" || evt == "iframeLoaded")
            {
                return(Match(context.PageUrl));
            }
            return(new EmptyResult());
        }
コード例 #2
0
 public IResult Process(FakeHttpContext context, System.Runtime.InteropServices.Expando.IExpando expando)
 {
     if (expando.Contain("IsAuthenticated"))
     Identity.IsAuthenticated = expando.GetBoolean("IsAuthenticated");
     
     if (expando.Contain("UserId"))
     Identity.UserId = expando.GetString("UserId");
     if(expando.Contain("Ticket")){       
         Identity.Ticket = expando.GetString("Ticket");
     }
     UpdateMockuser();
     
     return new EmptyResult();
 }
コード例 #3
0
        public IResult Process(FakeHttpContext context, System.Runtime.InteropServices.Expando.IExpando expando)
        {
            string       modelString         = expando.GetString("Model");
            string       isRegister          = expando.GetString("isRegister");
            ScriptObject so                  = JsonConvert.DeserializeObject <ScriptObject>(modelString);
            string       url                 = ServerApiInvoker.Domain + "tasks/RegiserResult";
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("websiteId", so.WebSiteId);
            dict.Add("mockUserId", Identity.MockUser.Id);
            dict.Add("scriptId", so.Id);
            dict.Add("isOk", isRegister);
            HttpRequestWapper.Post_Data(url, dict, Identity.Ticket);
            context.EnableTracing = true;
            return(new MatchHandler().HandleRequest(new UrlRequest()
            {
                Url = context.PageUrl, HttpContext = context
            }));
        }
コード例 #4
0
        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
            }));
        }
コード例 #5
0
ファイル: LogRequestHandler.cs プロジェクト: cnboker/autorobo
        public IResult Process(FakeHttpContext context, System.Runtime.InteropServices.Expando.IExpando expando)
        {
            string level = expando.GetString("level");
            string log   = expando.GetString("log");

            switch (level)
            {
            case "Info":
                logger.Info(log);
                break;

            case "fatal":
                logger.Fatal(log);
                break;

            default:
                break;
            }
            System.Diagnostics.Debug.WriteLine(log);
            return(new EmptyResult());
        }
コード例 #6
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());
        }