Example #1
0
File: Form.cs Project: radtek/EMIP
        public virtual JObject GetProcessInfo(HttpContext context)
        {
            YZRequest request    = new YZRequest(context);
            int       stepid     = request.GetInt32("pid");
            string    permisions = request.GetString("Permisions", null);
            string    uid        = YZAuthHelper.LoginUserAccount;

            BPMProcStep step;
            BPMTask     task;

            global::BPM.Client.ProcessInfo processInfo;
            CommentItemCollection          comments;
            FlowDataSet       formdataset;
            BPMStepCollection steps;
            ProcessSubModel   subModel;
            JObject           perm           = null;
            JObject           directSendInfo = null;

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

                step        = BPMProcStep.Load(cn, stepid);
                task        = BPMTask.Load(cn, step.TaskID);
                processInfo = BPMProcess.GetProcessInfo(cn, stepid);

                comments    = BPMTask.GetComments(cn, task.TaskID);
                formdataset = BPMProcess.GetFormData(cn, stepid);
                steps       = BPMTask.GetAllSteps(cn, task.TaskID);

                //获得ProcessSubModel
                if (step.Share && String.IsNullOrEmpty(step.OwnerAccount))
                {
                    subModel = ProcessSubModel.Share;
                }
                else
                {
                    if (processInfo.StepProcessPermision == StepProcessPermision.Inform)
                    {
                        subModel = ProcessSubModel.Inform;
                    }
                    else if (processInfo.StepProcessPermision == StepProcessPermision.Indicate)
                    {
                        subModel = ProcessSubModel.Indicate;
                    }
                    else
                    {
                        subModel = ProcessSubModel.Process;
                    }
                }

                //ProcessSubModel.Process - 则获得任务操作权限
                if (subModel == ProcessSubModel.Process ||
                    subModel == ProcessSubModel.Inform ||
                    subModel == ProcessSubModel.Indicate)
                {
                    perm = this.CheckPermision(cn, step.TaskID, stepid, permisions);
                }
                else
                {
                    perm = new JObject();
                }

                directSendInfo = this.GetDirectSendInfo(cn, step, processInfo.SystemLinks);
            }

            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(processInfo.MobileForm))
            {
                //jForm["xclass"] = "YZSoft.form.Form5";
                //jForm["config"] = new JObject();

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

                if (String.IsNullOrEmpty(processInfo.FormFile))
                {
                    throw new Exception(String.Format(Resources.YZStrings.Aspx_Process_MissForm, step.NodeName));
                }

                jForm["config"] = JObject.FromObject(new
                {
                    aspxform = processInfo.FormFile
                });
            }
            else
            {
                string  xclass;
                JObject config;
                this.ParseMobileForm(processInfo.MobileForm, out xclass, out config);
                jForm["xclass"] = xclass;
                jForm["config"] = config;
            }
            result["form"] = jForm;

            result["subModel"]       = subModel.ToString();
            result["task"]           = this.Serialize(task);
            result["step"]           = this.Serialize(step);
            result["NodePermisions"] = this.Serialize(processInfo.NodePermision);
            result["Comments"]       = step.Comments;
            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);

            if (subModel == ProcessSubModel.Process)
            {
                result["shareTask"] = step.Share;
                result["IsConsign"] = step.IsConsignStep;

                JArray links = new JArray();
                result["links"] = links;
                foreach (Link link in processInfo.Links)
                {
                    links.Add(this.Serialize(link, "normal"));
                }

                result["directsend"] = directSendInfo;

                //自由流
                if (!step.IsConsignStep) //加签不显示自由流
                {
                    result["ParticipantDeclares"] = JArray.FromObject(processInfo.ParticipantDeclares);
                    result["Routing"]             = processInfo.Routing;
                }
            }

            return(result);
        }
Example #2
0
File: Form.cs Project: 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);
        }
Example #3
0
        public virtual JObject GetProcessForm(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       stepid  = request.GetInt32("pid");
            string    uid     = YZAuthHelper.LoginUserAccount;

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

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

                step        = BPMProcStep.Load(cn, stepid);
                task        = BPMTask.Load(cn, step.TaskID);
                formSetting = BPMProcess.GetMobileFormSetting(cn, task.ProcessName, task.ProcessVersion);
                formdataset = BPMProcess.GetFormData(cn, stepid);
                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_StepName;
            field["html"]   = step.StepDisplayName;

            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.Process, form, formitems, task, step, formSetting, formdataset);

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

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

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

            return(result);
        }