コード例 #1
0
        public WbpsResponse invoke(WbpsResquest request, string sessionId)
        {
            WbpsResponse ret = new WbpsResponse();

            //    if (string.IsNullOrEmpty(request.FlowId))
            //        this.page = null;

            Page page = getPage(request, sessionId);

            if (!security.CheckObjectPermission("ListData", request.PageId, PermissionTypes.Read))
            {
                ret.Err = JsonExceptionUtils.ThrowErr(SecErrs.NotLogin, security.LoginPageUrl).Err;
                return(ret);
            }

            ret = page.InvokeRequest(request);

            return(ret);
        }
コード例 #2
0
        /// <summary>
        /// 执行一个Wbps请求
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public WbpsResponse InvokeRequest(WbpsResquest request)
        {
            WbpsResponse ret = new WbpsResponse();

            if (pageSchema == null)
            {
                return(ret);
            }
            string flowId = request.FlowId;

            ActionFlowSchema fs = null;

            if (!string.IsNullOrEmpty(flowId))
            {
                fs = pageSchema.ActionFlows.FindItem(flowId);
                if (fs == null)
                {
                    throw new XException("不能发现流程配置" + flowId);
                }
            }

            if (request.Step > 0)
            {
                this.nextStep  = request.Step;
                request.Sender = this.request.Sender;
            }

            this.request = request;

            bool isEnd = true;

            if (!security.CheckObjectPermission("ListData", request.PageId, PermissionTypes.Read))
            {
                ret.Err = JsonExceptionUtils.ThrowErr(SecErrs.NotPemission, security.LoginPageUrl).Err;
                return(ret);
            }

            if (request.ElementDatas != null)
            {
                if (fs != null && FlowNeedValid(fs))
                {
                    ValidateRequestData(request.ElementDatas);
                }
                ReceiveRequestData(request.ElementDatas);
            }


            if (fs != null)
            {
                isEnd = InvokeFlow(fs, request.FlowVars);
            }

            ret.ElementDatas = GetChangedElements();

            if (!isEnd)
            {
                ret.BackRequest           = new WbpsResquest();
                ret.BackRequest.PageId    = request.PageId;
                ret.BackRequest.FlowId    = request.FlowId;
                ret.BackRequest.Step      = this.nextStep;
                ret.BackRequest.SessionId = this.sessionId;

                for (int i = 0; i < NeedDatas.Count; i++)
                {
                    ret.BackRequest.ElementDatas.Add(NeedDatas[i], null);
                }

                this.executingFlow = request.FlowId;
            }
            else
            {
                this.executingFlow = null;
            }

            if (!string.IsNullOrEmpty(this.clientScript))
            {
                ret.ClientScript = CheckValueVar(this.clientScript).ToString();
            }

            this.clientScript = "";


            if (fs == null)
            {
                ret.Events = getWbapEvents();
            }

            return(ret);
        }