示例#1
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);

            BPMTask task;
            string  formFile;
            JObject perm;

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

                task     = BPMTask.Load(cn, taskid);
                formFile = BPMProcess.GetTaskReadForm(cn, taskid);
                perm     = this.CheckPermision(cn, taskid, -1, permisions);
            }

            JObject rv = new JObject();

            rv[YZJsonProperty.success] = true;
            rv["sn"]        = task.SerialNum;
            rv["url"]       = YZUtility.GetFormRedirectUrl(formFile).ToString();
            rv["urlParams"] = task.UrlParams;
            rv["perm"]      = perm;

            return(rv);
        }
示例#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);
        }