Esempio n. 1
0
        public virtual TableIdentityCollection GetProcessGlobalTableIdentitys(HttpContext context)
        {
            YZRequest request     = new YZRequest(context);
            string    serverName  = request.GetString("ServerName", null);
            string    processName = request.GetString("ProcessName");

            using (BPMConnection cn = new BPMConnection())
            {
                this.OpenConnection(cn, serverName);
                return(BPMProcess.GetProcessGlobalTableIdentitys(cn, processName));
            }
        }
Esempio n. 2
0
File: Form.cs Progetto: radtek/EMIP
        public virtual object GetMobileFormSetting(HttpContext context)
        {
            YZRequest request     = new YZRequest(context);
            string    processName = request.GetString("processName");
            Version   version     = request.GetVersion("version");

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

                return(new
                {
                    tables = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version),
                    mobileFormSetting = BPMProcess.GetMobileFormSetting(cn, processName, version)
                });
            }
        }
Esempio n. 3
0
        public virtual object GetProcessProperty(HttpContext context)
        {
            YZRequest request     = new YZRequest(context);
            string    processName = request.GetString("processName");
            Version   version     = request.GetVersion("version");

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

                return(new {
                    GlobalTableIdentitys = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version),
                    Property = BPMProcess.GetProcessProperty(cn, processName, version),
                    MessageGroups = BPMProcess.GetMessageGroups(cn, processName, version),
                    Events = BPMProcess.GetEvents(cn, processName, version)
                });
            }
        }
Esempio n. 4
0
File: Form.cs Progetto: radtek/EMIP
        public virtual JObject GetSimulateInfo(HttpContext context)
        {
            YZRequest request     = new YZRequest(context);
            string    processName = request.GetString("processName");
            Version   version     = request.GetVersion("version");
            string    permisions  = request.GetString("Permisions", null);
            string    uid         = request.GetString("uid");

            BPMProcStep           step;
            BPMTask               task;
            CommentItemCollection comments;
            FlowDataSet           formdataset;
            BPMStepCollection     steps;
            ProcessSubModel       subModel;
            JObject               perm           = null;
            JObject               directSendInfo = null;

            User user;

            YZAuthHelper.SetAuthCookie(uid);
            try
            {
                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();
                    TableIdentityCollection tableIdentities = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version);
                    formdataset = DataSourceManager.LoadDataSetSchema(cn, tableIdentities);
                    user        = User.TryGetUser(cn, uid);
                    if (user == null)
                    {
                        user             = new User();
                        user.Account     = uid;
                        user.DisplayName = "张三";
                    }
                }
            }
            catch (Exception e)
            {
                YZAuthHelper.ClearAuthCookie();
                throw e;
            }

            task = this.GetSimulateTask(user, processName, version);
            step = this.GetSimulateStep(task, user);

            comments = new CommentItemCollection();
            steps    = this.GetSimulateSteps(task, step, user);

            subModel       = ProcessSubModel.Process;
            perm           = new JObject();
            directSendInfo = null;

            int total           = 3;
            int newMessageCount = 1;

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

            JObject jForm = new JObject();

            jForm["xclass"] = "YZSoft.form.Form5";
            jForm["config"] = new JObject();
            result["form"]  = jForm;

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

                result["directsend"] = directSendInfo;
            }

            return(result);
        }
Esempio n. 5
0
        public virtual JObject GetSimulateForm(HttpContext context)
        {
            YZRequest request     = new YZRequest(context);
            string    processName = request.GetString("processName");
            Version   version     = request.GetVersion("version");
            string    uid         = request.GetString("uid");

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

            User user;

            YZAuthHelper.SetAuthCookie(uid);
            try
            {
                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();
                    TableIdentityCollection tableIdentities = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version);
                    formdataset = DataSourceManager.LoadDataSetSchema(cn, tableIdentities);
                    user        = User.TryGetUser(cn, uid);
                    if (user == null)
                    {
                        user             = new User();
                        user.Account     = uid;
                        user.DisplayName = "张三";
                    }
                }
            }
            catch (Exception e)
            {
                YZAuthHelper.ClearAuthCookie();
                throw e;
            }

            task = this.GetSimulateTask(user, processName, version);
            step = this.GetSimulateStep(task, user);

            JObject post = request.GetPostData <JObject>();

            if (post != null)
            {
                formSetting = post.ToObject <MobileFormSetting>();
            }
            else
            {
                formSetting = new MobileFormSetting();
            }

            comments = new CommentItemCollection();

            for (int i = 0; i < formdataset.Tables.Count; i++)
            {
                FlowDataTable table = formdataset.Tables[i];
                if (!table.IsRepeatableTable)
                {
                    table.Rows.Add(this.CreateNewRow(table, i, 0));
                }
                else
                {
                    table.Rows.Add(this.CreateNewRow(table, i, 0));
                    table.Rows.Add(this.CreateNewRow(table, i, 1));
                }
            }

            //附件的演示数据会导致错误(附件ID没有),必须处理(将附件数据置空)
            foreach (FlowDataTable table in formSetting.ControlDataSet.Tables)
            {
                FlowDataTable dataTable = formdataset.Tables.TryGetTable(table.TableName);
                if (dataTable != null)
                {
                    foreach (FlowDataColumn column in table.Columns)
                    {
                        if (column.MapTo == "YZSoft$ux.field.Attachment")
                        {
                            foreach (FlowDataRow row in dataTable.Rows)
                            {
                                row[column.ColumnName] = ""; //不能设置null,设置null附件控件表现形式不同
                            }
                        }
                    }
                }
            }

            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.DateToStringL(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);
        }