Пример #1
0
        public virtual JObject GetFormStateInfo(HttpContext context)
        {
            YZRequest request   = new YZRequest(context);
            string    app       = request.GetString("app");
            string    key       = request.GetString("key", null);
            string    formstate = request.GetString("formstate", null);

            FormApplication formApplication;
            FormState       formState;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                formApplication = FormApplication.Open(cn, app);
                formState       = FormService.GetFormStateBasicInfo(cn, app, formstate);
            }

            JObject rv = new JObject();

            rv[YZJsonProperty.success] = true;
            rv["appShortName"]         = formApplication.Name;
            rv["formstate"]            = formState.Name;
            rv["token"]           = YZSecurityHelper.GenFormApplicationToken(app, key, formState.Name);
            rv["showSaveButton"]  = formState.ShowSaveButton;
            rv["validationGroup"] = formState.ValidationGroup;
            rv["url"]             = YZUtility.GetFormRedirectUrl(formApplication.Form).ToString();
            return(rv);
        }
Пример #2
0
        public virtual JObject GetAppsInFolder(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    path    = request.GetString("path", null);
            FormApplicationCollection formApplications;

            //获得数据
            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                formApplications = cn.GetFormApplicationList(path, BPMPermision.Read);

                //将数据转化为Json集合
                JObject rv = new JObject();
                rv[YZJsonProperty.total] = formApplications.Count;

                JArray children = new JArray();
                rv[YZJsonProperty.children] = children;

                foreach (FormApplication tmpformapp in formApplications)
                {
                    string fullName;
                    if (String.IsNullOrEmpty(path))
                    {
                        fullName = tmpformapp.Name;
                    }
                    else
                    {
                        fullName = path + "/" + tmpformapp.Name;
                    }

                    FormApplication formapp = FormApplication.Open(cn, fullName);

                    JObject item = new JObject();
                    children.Add(item);

                    item["Name"]     = formapp.Name;
                    item["FullName"] = fullName;
                    item["rsid"]     = StoreZoneType.FormService.ToString() + "://" + fullName;

                    JArray jStates = new JArray();
                    item["States"] = jStates;
                    foreach (FormState state in formapp.FormStates)
                    {
                        JObject jState = new JObject();
                        jStates.Add(jState);

                        jState["Name"] = state.Name;
                    }

                    item["FormFile"] = formapp.Form;
                }

                return(rv);
            }
        }
Пример #3
0
        public virtual FormApplication GetFormServiceDefine(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    path    = request.GetString("path");

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                return(FormApplication.Open(cn, path));
            }
        }
Пример #4
0
        public virtual JObject GetFormStateInfo(HttpContext context)
        {
            YZRequest request   = new YZRequest(context);
            string    app       = request.GetString("app");
            string    key       = request.GetString("key", null);
            string    formstate = request.GetString("formstate", null);

            FormApplication formApplication;
            FormState       formState;
            FlowDataSet     formdataset;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                formApplication = FormApplication.Open(cn, app);
                formState       = FormService.GetFormStateBasicInfo(cn, app, formstate);
                formdataset     = FormService.GetFormApplicationData(cn, app, formstate, key);
            }

            //准备返回值
            JObject result = new JObject();

            JObject jForm = new JObject();

            jForm["xclass"] = "YZSoft.form.aspx.Form";
            jForm["config"] = JObject.FromObject(new
            {
                aspxform = formApplication.Form
            });
            result["form"] = jForm;

            result[YZJsonProperty.success] = true;
            result["app"]             = app;
            result["key"]             = key;
            result["formstate"]       = formstate;
            result["appShortName"]    = formApplication.Name;
            result["showSaveButton"]  = formState.ShowSaveButton;
            result["validationGroup"] = formState.ValidationGroup;
            result["formdataset"]     = this.ToResult(formdataset, true);

            return(result);
        }