Beispiel #1
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);
        }
Beispiel #2
0
        protected virtual void PostProcessNotifyTopic(IYZDbProvider provider, IDbConnection cn, BPMConnection bpmcn, string loginUserAccount, DataRow row, bool countUsers)
        {
            JObject jExt = new JObject();

            row["ext"] = jExt;
            YZResourceType resType = (YZResourceType)Enum.Parse(typeof(YZResourceType), Convert.ToString(row["resType"]), true);

            row["resType"] = resType.ToString();

            if (row.Table.Columns.Contains("uid"))
            {
                string uid  = Convert.ToString(row["uid"]);
                User   user = User.TryGetUser(bpmcn, uid);
                jExt["UserShortName"] = user == null ? uid : user.ShortName;
            }

            switch (resType)
            {
            case YZResourceType.Task:
                BPMTask         task     = BPMTask.Load(bpmcn, Int32.Parse(Convert.ToString(row["resId"])));
                ProcessProperty property = BPMProcess.GetProcessProperty(bpmcn, task.ProcessName, task.ProcessVersion);

                string owner = YZStringHelper.GetUserShortName(task.OwnerAccount, task.OwnerDisplayName);
                row["resName"] = String.Format(Resources.YZStrings.All_BPM_Task_Title_FMT, owner, task.ProcessName);

                jExt["ProcessName"] = task.ProcessName;
                jExt["Owner"]       = owner;
                jExt["Color"]       = property.Color;
                jExt["ShortName"]   = property.ShortName;
                if (String.IsNullOrEmpty(property.ShortName))
                {
                    jExt["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName);
                }
                break;

            case YZResourceType.Group:
                Group.Group group = GroupManager.GetGroup(provider, cn, Int32.Parse(Convert.ToString(row["resId"])));

                row["resName"]      = group.Name;
                jExt["GroupType"]   = group.GroupType;
                jExt["ImageFileID"] = group.ImageFileID;

                if (countUsers)
                {
                    jExt["MemberCount"] = GroupManager.GetGroupMemberCount(provider, cn, group.GroupID);
                }

                break;

            case YZResourceType.SingleChat:
                P2PGroup.P2PGroup p2pGroup = P2PGroupManager.GetGroup(provider, cn, Int32.Parse(Convert.ToString(row["resId"])));

                row["resName"]         = p2pGroup.GetGroupName(bpmcn, loginUserAccount);
                jExt["P2PPeerAccount"] = p2pGroup.GetPeerAccount(loginUserAccount);
                jExt["FolderID"]       = p2pGroup.FolderID;

                break;

            case YZResourceType.TaskApproved:
                row["resName"] = Resources.YZStrings.Aspx_Message_Title_Approved;
                break;

            case YZResourceType.TaskRejected:
                row["resName"] = Resources.YZStrings.Aspx_Message_Title_Rejected;
                break;

            default:
                break;
            }
        }