示例#1
0
        public virtual JArray GetFormReadData(BPMConnection cn, JObject request)
        {
            int tid = Int32.Parse((string)request["TID"]);

            FlowDataSet dataset = BPMProcess.GetFormDataForRead(cn, tid);

            return(this.ToResult(dataset, true));
        }
示例#2
0
文件: Form.cs 项目: radtek/EMIP
        public virtual JObject GetTaskReadInfo(HttpContext context)
        {
            YZRequest request    = new YZRequest(context);
            int       taskid     = request.GetInt32("tid");
            string    permisions = request.GetString("Permisions", null);
            string    uid        = YZAuthHelper.LoginUserAccount;

            BPMTask task;
            CommentItemCollection comments;
            FlowDataSet           formdataset;
            BPMStepCollection     steps;
            JObject perm = null;
            string  readForm;
            string  mobileReadForm;

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

                task     = BPMTask.Load(cn, taskid);
                comments = BPMTask.GetComments(cn, task.TaskID);
                readForm = BPMProcess.GetTaskReadForm(cn, taskid);

                formdataset    = BPMProcess.GetFormDataForRead(cn, taskid);
                steps          = BPMTask.GetAllSteps(cn, task.TaskID);
                mobileReadForm = BPMProcess.GetTaskReadFormMobile(cn, task.TaskID);

                perm = this.CheckPermision(cn, taskid, -1, permisions);
            }

            int total;
            int newMessageCount;

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    total           = YZSoft.Web.Social.SocialManager.GetMessageCount(provider, cn, YZResourceType.Task, task.TaskID.ToString());
                    newMessageCount = YZSoft.Web.Social.SocialManager.GetNewMessageCount(provider, cn, YZResourceType.Task, task.TaskID.ToString(), uid);
                }
            }

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

            JObject jForm = new JObject();

            if (String.IsNullOrEmpty(mobileReadForm))
            {
                //jForm["xclass"] = "YZSoft.form.Form5";
                //jForm["config"] = new JObject();

                jForm["xclass"] = "YZSoft.form.aspx.Form";

                if (String.IsNullOrEmpty(readForm))
                {
                    throw new Exception(Resources.YZStrings.Aspx_Read_MissForm);
                }

                jForm["config"] = JObject.FromObject(new
                {
                    aspxform = readForm
                });
            }
            else
            {
                string  xclass;
                JObject config;
                this.ParseMobileForm(mobileReadForm, out xclass, out config);
                jForm["xclass"] = xclass;
                jForm["config"] = config;
            }
            result["form"]         = jForm;
            result["subModel"]     = "Read";
            result["task"]         = this.Serialize(task);
            result["perm"]         = perm;
            result["socialInfo"]   = this.SerializeSocialInfo(total, newMessageCount);
            result["steps"]        = this.SerializeForTrace(steps);
            result["signcomments"] = JArray.FromObject(comments);
            result["formdataset"]  = this.ToResult(formdataset, true);

            return(result);
        }
示例#3
0
        public virtual JObject GetReadForm(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       taskid  = request.GetInt32("tid");
            string    uid     = YZAuthHelper.LoginUserAccount;

            BPMTask               task;
            MobileFormSetting     formSetting;
            FlowDataSet           formdataset;
            CommentItemCollection comments;

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

                task        = BPMTask.Load(cn, taskid);
                formSetting = BPMProcess.GetMobileFormSetting(cn, task.ProcessName, task.ProcessVersion);
                formdataset = BPMProcess.GetFormDataForRead(cn, taskid);
                comments    = BPMTask.GetComments(cn, task.TaskID);
            }

            this.ParseMobileFormSetting(formSetting);

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

            //填充form域(表单信息)
            JObject fieldset;
            JArray  items;
            JObject field;

            JObject form = new JObject();

            result["form"] = form;

            JArray formitems = new JArray();

            form["items"] = formitems;

            //基本信息的fieldset填充
            fieldset = new JObject();
            formitems.Add(fieldset);
            fieldset["xtype"]     = "fieldset";
            fieldset["innerName"] = "Header";

            //fieldset["title", "基本信息");
            items             = new JArray();
            fieldset["items"] = items;

            field = new JObject();
            items.Add(field);
            field["xclass"]  = "YZSoft.form.FormHeader";
            field["padding"] = "16 10 10 16";
            field["task"]    = this.Serialize(task);

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Field";
            field["label"]  = Resources.YZMobile.Aspx_FormData_Date;
            field["html"]   = YZStringHelper.DateToStringM(task.CreateAt);

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Field";
            field["label"]  = Resources.YZMobile.Aspx_FormData_Desc;
            field["html"]   = task.Description;

            //应用移动表单设定字段 - 非可重复表
            this.ApplyMasterFields(Model.Read, form, formitems, task, null, formSetting, formdataset);

            //应用移动表单设定字段 - 可重复表
            this.ApplyDetailFields(Model.Read, form, formitems, task, null, formSetting, formdataset);

            //自定义信息
            this.ApplyCustomFields(Model.Read, form, formitems, task, null, formdataset, comments);

            //控件测试
            //this.AddTestingFields(Model.Read,form, formitems, task, null, formdataset, comments);

            return(result);
        }