예제 #1
0
파일: YZJsonHelper.cs 프로젝트: radtek/EMIP
    public static JObject SerializeSchema(FlowDataSet dataset, string tableProperties, string columnProperties)
    {
        JsonSerializer serial = new JsonSerializer();

        serial.Converters.Add(new FlowDataSetConverter(tableProperties, columnProperties));
        return(JObject.FromObject(dataset, serial));
    }
예제 #2
0
        public virtual JObject GetXClassSchema(HttpContext context)
        {
            YZRequest     request     = new YZRequest(context);
            String        xclass      = request.GetString("xclass", null);
            FlowDataSet   dataset     = new FlowDataSet();
            FlowDataTable table       = new FlowDataTable();
            FlowDataTable tableFilter = new FlowDataTable();

            dataset.Tables.Add(table);

            if (!String.IsNullOrEmpty(xclass))
            {
                string url     = YZUtility.GetUrlFromXClass(xclass);
                string phyPath = context.Server.MapPath(url);
                using (StreamReader rd = new StreamReader(phyPath))
                {
                    string jsText      = rd.ReadToEnd();
                    string dataColumns = this.GetProperty(jsText, "datasourceColumns", '[', ']');
                    if (!String.IsNullOrEmpty(dataColumns))
                    {
                        JArray jDataColumns = JArray.Parse(dataColumns);
                        foreach (JToken token in jDataColumns)
                        {
                            if (token.Type == JTokenType.String)
                            {
                                FlowDataColumn column = new FlowDataColumn((string)token, typeof(string));
                                table.Columns.Add(column);
                            }
                        }
                    }
                }
            }

            return(YZJsonHelper.SerializeSchema(dataset, "", "DataType"));
        }
예제 #3
0
파일: DataSource.cs 프로젝트: radtek/EMIP
        public virtual JObject GetESBObjectParams(HttpContext context)
        {
            YZRequest   request    = new YZRequest(context);
            String      objectName = request.GetString("ESB");
            FlowDataSet dataset    = new FlowDataSet();

            //获取参数
            string[]       strs       = objectName.Split(':');
            SourceTypeEnum sourceType = (SourceTypeEnum)Enum.Parse(typeof(SourceTypeEnum), strs[0]);
            SourceInfo     sourceInfo = SourceInfoManager.GetSourceInfo(sourceType, strs[1]);


            FlowDataTable table = new FlowDataTable();

            dataset.Tables.Add(table);
            SourceVisit       visit     = new SourceVisit(sourceInfo);
            List <ColumnInfo> paramList = visit.GetParameter();

            if (paramList != null && paramList.Count > 0)
            {
                foreach (var item in visit.GetParameter())
                {
                    table.Columns.Add(new FlowDataColumn(item.rename));
                }
            }
            JObject rv = YZJsonHelper.SerializeSchema(dataset, "", "DataType");

            rv["supportOp"] = false;
            return(rv);
        }
예제 #4
0
파일: DataSource.cs 프로젝트: radtek/EMIP
        public virtual JObject GetTableParams(HttpContext context)
        {
            YZRequest request        = new YZRequest(context);
            String    datasourceName = request.GetString("DataSource", null);
            String    tableName      = request.GetString("tableName");

            FlowDataTable tableSchema;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                tableSchema = DataSourceManager.LoadTableSchema(cn, datasourceName, tableName);
            }

            FlowDataTable tableParams = new FlowDataTable("Params");

            foreach (FlowDataColumn column in tableSchema.Columns)
            {
                if (column.AllowSearch)
                {
                    tableParams.Columns.Add(column);
                }
            }

            FlowDataSet dataset = new FlowDataSet();

            dataset.Tables.Add(tableParams);

            JObject rv = YZJsonHelper.SerializeSchema(dataset, "", "DataType");

            rv["supportOp"] = true;
            return(rv);
        }
예제 #5
0
        public virtual void XSDFromDataSetMap(HttpContext context)
        {
            YZRequest request  = new YZRequest(context);
            string    filename = request.GetString("fileName", "schema.xsd");

            JObject        jTables = JObject.Parse(Encoding.UTF8.GetString(Convert.FromBase64String(request.GetString("map", null))));
            JsonSerializer serial  = new JsonSerializer();

            serial.Converters.Add(new FlowDataSetConverter("TableName,MapTo", "ColumnName,DataType,MapTo"));

            FlowDataSet map = jTables.ToObject <FlowDataSet>(serial);

            foreach (FlowDataTable table in map.Tables)
            {
                if (!String.IsNullOrEmpty(table.MapTo))
                {
                    table.TableName = table.MapTo;
                }

                foreach (FlowDataColumn column in table.Columns)
                {
                    if (!String.IsNullOrEmpty(column.MapTo))
                    {
                        column.ColumnName = column.MapTo;
                    }
                }
            }

            this.ProcessResponseHeader(context, filename, true);
            map.ToDataSet().WriteXmlSchema(context.Response.OutputStream);
        }
예제 #6
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));
        }
예제 #7
0
        public virtual JArray GetDraftData(BPMConnection cn, JObject request)
        {
            Guid draftGuid = new Guid((string)request["DraftID"]);

            FlowDataSet dataset = cn.GetDraftData(draftGuid);

            return(this.ToResult(dataset, true));
        }
예제 #8
0
        public virtual JArray GetFormApplicationData(BPMConnection cn, JObject request)
        {
            string appName   = (string)request["ApplicationName"];
            string formState = (string)request["FormState"];
            string keyValue  = (string)request["PrimaryKey"];

            FlowDataSet dataset = FormService.GetFormApplicationData(cn, appName, formState, keyValue);

            return(this.ToResult(dataset, true));
        }
예제 #9
0
        protected virtual JArray ToResult(FlowDataSet dataset, bool formTable)
        {
            JArray rv = new JArray();

            foreach (FlowDataTable table in dataset.Tables)
            {
                rv.Add(this.ToResult(table, formTable));
            }
            return(rv);
        }
예제 #10
0
파일: Form.cs 프로젝트: radtek/EMIP
        protected virtual JObject ToResult(FlowDataSet dataset, bool formTable)
        {
            JObject rv = new JObject();

            foreach (FlowDataTable table in dataset.Tables)
            {
                rv[table.TableName] = this.ToResult(table, formTable);
            }
            return(rv);
        }
예제 #11
0
        public virtual JArray GetFormPostData(BPMConnection cn, JObject request)
        {
            string  processName    = (string)request["ProcessName"];
            Version processVersion = new Version((string)request["ProcessVersion"]);
            string  owner          = (string)request["Owner"];
            int     restartTaskID  = request.Property("restartTaskID") != null  ? (int)request["restartTaskID"]:-1;

            FlowDataSet dataset = BPMProcess.GetFormData(cn, processName, processVersion, owner, restartTaskID);

            return(this.ToResult(dataset, true));
        }
예제 #12
0
파일: DataSource.cs 프로젝트: radtek/EMIP
        public virtual JObject GetTableSchema(HttpContext context)
        {
            YZRequest   request        = new YZRequest(context);
            String      datasourceName = request.GetString("DataSource", null);
            String      tableName      = request.GetString("tableName");
            FlowDataSet dataset        = new FlowDataSet();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                dataset.Tables.Add(DataSourceManager.LoadTableSchema(cn, datasourceName, tableName));
            }

            return(YZJsonHelper.SerializeSchema(dataset, "", "DataType"));
        }
예제 #13
0
파일: DataSource.cs 프로젝트: radtek/EMIP
        public virtual JObject GetQuerySchema(HttpContext context)
        {
            YZRequest request                    = new YZRequest(context);
            String    datasourceName             = request.GetString("DataSource", null);
            String    query                      = request.GetString("Query");
            QueryParameterCollection queryParams = JArray.Parse(request.GetString("QueryParams")).ToObject <QueryParameterCollection>();
            FlowDataSet dataset                  = new FlowDataSet();

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                dataset.Tables.Add(DataSourceManager.LoadSchemaByQuery(cn, datasourceName, query, queryParams.CreateNullDBParameters()));
            }

            return(YZJsonHelper.SerializeSchema(dataset, "", "DataType"));
        }
예제 #14
0
        public virtual JArray GetSnapshotData(BPMConnection cn, JObject request)
        {
            string strPid = (string)request["PID"];

            if (String.IsNullOrEmpty(strPid))
            {
                strPid = "-1";
            }

            int tid = Int32.Parse((string)request["TID"]);
            int pid = Int32.Parse(strPid);
            int ver = Int32.Parse((string)request["Version"]);

            FlowDataSet dataset = cn.GetSnapshotData(tid, ver, pid);

            return(this.ToResult(dataset, true));
        }
예제 #15
0
        public virtual JObject XSD2DataSetSchema(HttpContext context, HttpPostedFile file, string fileName, long fileSize, string fileExt)
        {
            DataSet dataSet = new DataSet();

            if (String.Compare(fileExt, ".xml", true) == 0)
            {
                dataSet.ReadXml(file.InputStream, XmlReadMode.Auto);
            }
            else
            {
                dataSet.ReadXmlSchema(file.InputStream);
            }

            FlowDataSet flowDataSet = new FlowDataSet();

            flowDataSet.LoadDefine(dataSet);

            return(YZJsonHelper.SerializeSchema(flowDataSet));
        }
예제 #16
0
파일: DataSource.cs 프로젝트: radtek/EMIP
        public virtual JObject GetProcedureParams(HttpContext context)
        {
            YZRequest     request        = new YZRequest(context);
            String        datasourceName = request.GetString("DataSource", null);
            String        procedureName  = request.GetString("ProcedureName");
            FlowDataSet   dataset        = new FlowDataSet();
            FlowDataTable tableParams;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                DataSourceManager.LoadProdecureSchema(cn, datasourceName, procedureName, out tableParams);
                dataset.Tables.Add(tableParams);
            }

            JObject rv = YZJsonHelper.SerializeSchema(dataset, "", "DataType");

            rv["supportOp"] = false;
            return(rv);
        }
예제 #17
0
파일: DataSource.cs 프로젝트: radtek/EMIP
        public virtual JObject GetESBObjectSchema(HttpContext context)
        {
            YZRequest   request    = new YZRequest(context);
            String      objectName = request.GetString("ESB");
            FlowDataSet dataset    = new FlowDataSet();

            //获取参数
            string[]       strs       = objectName.Split(':');
            SourceTypeEnum sourceType = (SourceTypeEnum)Enum.Parse(typeof(SourceTypeEnum), strs[0]);
            SourceInfo     sourceInfo = SourceInfoManager.GetSourceInfo(sourceType, strs[1]);

            FlowDataTable table = new FlowDataTable();

            dataset.Tables.Add(table);
            SourceVisit visit = new SourceVisit(sourceInfo);

            foreach (var item in visit.GetSchema())
            {
                table.Columns.Add(new FlowDataColumn(item.rename, typeof(string)));
            }

            return(YZJsonHelper.SerializeSchema(dataset, "", "DataType"));
        }
예제 #18
0
파일: Form.Custom.cs 프로젝트: radtek/EMIP
 protected virtual void Default(Model model, JObject form, JArray formitems, BPMTask task, BPMProcStep step, FlowDataSet formdataset, CommentItemCollection comments)
 {
 }
예제 #19
0
        private void Form_我的流程2(Model model, JObject form, JArray formitems, BPMTask task, BPMProcStep step, FlowDataSet formdataset, CommentItemCollection comments)
        {
            JObject fieldset;
            JArray  items;
            JObject field;
            int     index;

            //在头部加入一行
            fieldset = this.TryGetFieldSet(form, "Header");
            items    = fieldset["items"] as JArray;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Field";
            field["label"]  = "AAA";
            field["html"]   = "AAAValue";

            //在表Purchase中加入一行
            fieldset = this.TryGetFieldSet(form, "Purchase");
            items    = fieldset["items"] as JArray;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Field";
            field["label"]  = "BBB";
            field["html"]   = "BBBValue";

            //在表Purchase前加入一个fieldset
            fieldset = this.TryGetFieldSet(form, "Purchase");
            index    = formitems.IndexOf(fieldset);

            fieldset = new JObject();
            formitems.Insert(index, fieldset);
            fieldset["xtype"] = "fieldset";

            items             = new JArray();
            fieldset["items"] = items;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Field";
            field["label"]  = "CCC";
            field["html"]   = "CCCValue";

            //在末尾加入一行
            fieldset = new JObject();
            formitems.Add(fieldset);
            fieldset["xtype"] = "fieldset";

            items             = new JArray();
            fieldset["items"] = items;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Field";
            field["label"]  = "DDD";
            field["html"]   = "DDDValue";

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Field";
            field["label"]  = "EEE";
            field["html"]   = "EEEValue";
        }
예제 #20
0
파일: YZJsonHelper.cs 프로젝트: radtek/EMIP
 public static JObject SerializeSchema(FlowDataSet dataset)
 {
     return(SerializeSchema(dataset, "IsRepeatableTable", "DataType"));
 }
예제 #21
0
        //应用移动表单设定字段 - 可重复表
        protected virtual void ApplyDetailFields(Model model, JObject form, JArray formitems, BPMTask task, BPMProcStep step, MobileFormSetting formSetting, FlowDataSet formdataset)
        {
            foreach (FlowDataTable table in formSetting.ControlDataSet.Tables)
            {
                FlowDataTable srcTable = formdataset.Tables.TryGetTable(table.TableName);
                if (srcTable == null)
                {
                    continue;
                }

                if (!srcTable.IsRepeatableTable)
                {
                    continue;
                }

                JArray citems = this.GenFieldItems(model, srcTable, table);
                foreach (JObject citem in citems)
                {
                    formitems.Add(citem);
                }
            }
        }
예제 #22
0
        public virtual void AddTestingFields(JObject form, JArray formitems, JObject fieldset, JArray items, BPMTask task, BPMProcStep step, FlowDataSet formdataset, CommentItemCollection comments)
        {
            JObject field;

            fieldset = new JObject();
            formitems.Add(fieldset);
            items             = new JArray();
            fieldset["items"] = items;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Text";
            field["label"]  = "Text";
            field["value"]  = task.ProcessName;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Number";
            field["label"]  = "Number";
            field["value"]  = 123;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.TextArea";
            field["label"]  = "TextArea";
            field["value"]  = task.ProcessName;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.DatePicker";
            field["label"]  = "DatePicker";
            field["value"]  = DateTime.Today;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Email";
            field["label"]  = "Email";
            field["value"]  = task.ProcessName;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Password";
            field["label"]  = "Password";
            field["value"]  = "123";

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Checkbox";
            field["label"]  = "Checkbox";
            field["value"]  = true;

            field = new JObject();
            items.Add(field);
            field["xclass"] = "Ext.field.Radio";
            field["label"]  = "Radio";
            field["value"]  = true;

            //field = new JObject();
            //items.Add(field);
            //field["xclass"] = "Ext.field.Select";
            //field["label"] = "Select";
            //field["value"] = "SH";

            //field = new JObject();
            //items.Add(field);
            //field["xclass"] = "YZSoft$ux.field.Attachment";
            //field["label"] = "Attachment";
            //field["value"] = task.ProcessName;
        }
예제 #23
0
        private JObject GetFormInfo(BPMConnection cn, string UserAccount, int TaskID, int StepID)
        {
            FlowDataSet formData = null;
            BPMTask     task     = null;
            string      FormXml  = "";  //获取表单名称

            JObject rv = new JObject(); //最终组合的

            JArray TaskCommList = new JArray();

            rv["TaskCommList"] = TaskCommList;

            JArray FormInfo = new JArray();

            rv["FormInfo"] = FormInfo;
            JArray ButtonList = new JArray();

            rv["ButtonList"] = ButtonList;


            if (StepID < 0)
            {
                BPMStepCollection Steps = BPM.Client.BPMTask.GetAllSteps(cn, TaskID);
                foreach (BPM.Client.BPMProcStep item in Steps)
                {
                    if (item.NodeName.Equals("开始"))
                    {
                        StepID = item.StepID;
                        break;
                    }
                }
            }

            //按钮开始
            BPM.Client.ProcessInfo processInfo = BPM.Client.BPMProcess.GetProcessInfo(cn, StepID);
            BPMTask bt = BPMTask.Load(cn, TaskID);

            JObject TaskComm = new JObject();

            TaskCommList.Add(TaskComm);

            TaskComm["TaskID"]           = bt.TaskID;
            TaskComm["ParentStepID"]     = bt.ParentStepID;
            TaskComm["SerialNum"]        = bt.SerialNum;
            TaskComm["ProcessName"]      = bt.ProcessName;
            TaskComm["ApplicantAccount"] = bt.ApplicantAccount;

            TaskComm["AgentAccount"]     = bt.AgentAccount;
            TaskComm["AgentDisplayName"] = bt.AgentDisplayName;
            TaskComm["AgentDisplayName"] = bt.AgentDisplayName;

            TaskComm["OwnerAccount"]     = bt.OwnerAccount;
            TaskComm["OwnerDisplayName"] = bt.OwnerDisplayName;
            TaskComm["OwnerFullName"]    = bt.OwnerFullName;

            TaskComm["CreateAt"] = bt.CreateAt;
            TaskComm["FinishAt"] = bt.FinishAt;
            TaskComm["OptAt"]    = bt.OptAt;
            TaskComm["OptUser"]  = bt.OptUser;
            TaskComm["OptMemo"]  = bt.OptMemo;
            //TaskComm["Description"] = bt.Description;
            // TaskComm["ReturnToParent"] = bt.ReturnToParent;

            TaskComm["TaskState"] = bt.TaskState.ToString();
            TaskComm["State"]     = bt.State.ToString();


            if (IsCurrentStep(cn, UserAccount, StepID, TaskID) && bt.TaskState.ToString().Equals("Running", StringComparison.OrdinalIgnoreCase))
            {
                BPM.Client.LinkCollection links = processInfo.Links;//提交按钮
                foreach (Link link in links)
                {
                    JObject button = new JObject();
                    ButtonList.Add(button);
                    string s = link.DisplayString;
                    button["Text"]   = s;
                    button["Action"] = s;
                    button["Type"]   = "Post";
                }
                bool canReject = (processInfo.NodePermision & NodePermision.Reject) == NodePermision.Reject;//拒绝按钮
                if (canReject)
                {
                    JObject button = new JObject();
                    ButtonList.Add(button);
                    button["Text"]   = "拒绝";
                    button["Action"] = "Reject";
                    button["Type"]   = "Reject";
                }
                bool canTransfer = (processInfo.NodePermision & NodePermision.Transfer) == NodePermision.Transfer;//委托按钮
                if (canTransfer)
                {
                    JObject button = new JObject();
                    ButtonList.Add(button);
                    button["Text"]   = "委托";
                    button["Action"] = "Transfer";
                    button["Type"]   = "Transfer";
                }
                bool canConsign = (processInfo.NodePermision & NodePermision.Consign) == NodePermision.Consign;//加签按钮
                if (canConsign)
                {
                    string  s      = links[0].DisplayString;
                    JObject button = new JObject();
                    ButtonList.Add(button);
                    button["Text"]   = "加签";
                    button["Action"] = s;
                    button["Type"]   = "Consign";
                }
                bool canRecedeBack = (processInfo.NodePermision & NodePermision.RecedeBack) == NodePermision.RecedeBack;//退回重填按钮
                if (canRecedeBack)
                {
                    JObject button = new JObject();
                    ButtonList.Add(button);
                    button["Text"]   = "退回某步";
                    button["Action"] = "RecedeBack";
                    button["Type"]   = "RecedeBack";
                }
                bool recedeRestart = (processInfo.NodePermision & NodePermision.RecedeRestart) == NodePermision.RecedeRestart;//退回重填


                BPMProcStep stepLoad = BPMProcStep.Load(cn, StepID);
                int         idx      = processInfo.SystemLinks.Find(SystemLinkType.DirectSend);
                if (stepLoad.RecedeFromStep != -1 && idx != -1 && processInfo.SystemLinks[idx].Enabled)
                {
                    BPMStepCollection       directSendToSteps = BPMProcStep.LoadPrevSteps(cn, StepID);
                    BPMObjectNameCollection stepNames         = new BPMObjectNameCollection();
                    foreach (BPMProcStep step in directSendToSteps)
                    {
                        if (step.IsHumanStep)
                        {
                            stepNames.Add(step.NodeName + ":" + YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName));

                            string  buttonText = "直送->" + stepNames.ToStringList(';');
                            JObject button     = new JObject();
                            ButtonList.Add(button);
                            button["Text"]   = buttonText;
                            button["Action"] = "DirectSend";
                            button["Type"]   = "DirectSend";
                        }
                    }
                }
            }

            //按钮结束
            FormXml = processInfo.FormFile;

            //获取表单数据
            formData = BPMProcess.GetFormData(cn, StepID);

            if (formData.Tables.Count == 0)
            {
                throw new Exception("获取表单数据失败");
            }

            //初始化布局文件
            task = BPMTask.Load(cn, TaskID);


            if (task == null)
            {
                throw new Exception("通过TaskID获取任务失败");
            }

            //int startIndex=FormXml.LastIndexOf(@"\");
            //int endIndex=FormXml.LastIndexOf(".aspx");
            // FormXml = FormXml.Substring(startIndex+1, endIndex - startIndex-1);
            FormXml = FormXml.Replace(".aspx", "");
            FormXml = FormXml.Replace("\\", "(");
            //throw new Exception(FormXml);
            XmlDocument layoutDoc      = new XmlDocument();
            string      layoutFilePath = HttpContext.Current.Server.MapPath(String.Format("~/FormLayout/{0}.xml", FormXml));

            string debugger = "";

            if (System.IO.File.Exists(layoutFilePath))
            {
                layoutDoc.Load(layoutFilePath);

                XmlNodeList layoutTables = layoutDoc.SelectNodes("Layout/Table");
                foreach (XmlNode layoutTable in layoutTables)
                {
                    string TableID = TryGetNodeAttribute(layoutTable, "ID");
                    //测试报文中Table是否与流程中的Table匹配
                    debugger += "[TableID]" + TableID;
                    foreach (FlowDataTable item in formData.Tables)
                    {
                        debugger += "[TableName]" + item.TableName;
                    }
                    //

                    FlowDataTable formDataTable = formData.Tables[TableID];

                    try
                    {
                        if (formDataTable != null)
                        {
                            JObject bwTable = new JObject();
                            FormInfo.Add(bwTable);
                            bwTable["TableName"]    = TableID;
                            bwTable["DisplayName"]  = TryGetNodeAttribute(layoutTable, "Name");
                            bwTable["IsRepeatable"] = formDataTable.IsRepeatableTable;

                            JArray bwRows = new JArray();
                            bwTable["Rows"] = bwRows;
                            foreach (FlowDataRow formDataRow in formDataTable.Rows)
                            {
                                JObject bwRow = new JObject();
                                bwRows.Add(bwRow);

                                XmlNodeList layoutColumns = layoutTable.ChildNodes;
                                int         i             = 0;
                                foreach (XmlNode layoutColumn in layoutColumns)
                                {
                                    //debugger += "**" + TryGetNodeAttribute(layoutColumn, "Type") + "**";
                                    if (!string.IsNullOrEmpty(TryGetNodeAttribute(layoutColumn, "Type")) && TryGetNodeAttribute(layoutColumn, "Type").Equals("Attachment", StringComparison.OrdinalIgnoreCase))
                                    {
                                        JObject bwColumn = new JObject();

                                        bwRow["Attachments_" + layoutColumn.Name] = bwColumn;
                                        bwColumn["Name"] = TryGetNodeAttribute(layoutColumn, "Name");

                                        string FileID = Convert.ToString(formDataRow[layoutColumn.Name]);

                                        //调用方法获取附件名称,附件路径
                                        JObject Attachments = GetAttachments(FileID);

                                        JArray bwAttachments = new JArray();
                                        bwColumn["Items"] = bwAttachments;
                                        foreach (JObject item in JTokenToJArray(Attachments["files"]))
                                        {
                                            JObject attachment1 = new JObject();
                                            bwAttachments.Add(attachment1);
                                            attachment1["FileName"]    = item["name"];
                                            attachment1["DownloadUrl"] = item["DownloadUrl"];
                                        }
                                        i++;
                                    }
                                    else
                                    {
                                        JObject bwColumn = new JObject();
                                        bwRow[layoutColumn.Name] = bwColumn;
                                        bwColumn["DataType"]     = TryGetNodeAttribute(layoutColumn, "DataType");
                                        bwColumn["DataFormat"]   = TryGetNodeAttribute(layoutColumn, "DataFormat");
                                        bwColumn["Order"]        = TryGetNodeAttribute(layoutColumn, "Order");

                                        bwColumn["Name"]  = TryGetNodeAttribute(layoutColumn, "Name");
                                        bwColumn["Value"] = Convert.ToString(formDataRow[layoutColumn.Name]);
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        throw new Exception(debugger + "---------" + e.Message);
                    }
                }
            }
            else
            {
                //throw new Exception(String.Format("流程[{0}]没有布局文件[{1}]", task.ProcessName, layoutFilePath));
            }


            return(rv);
        }
예제 #24
0
파일: Form.Custom.cs 프로젝트: radtek/EMIP
        //根据流程名调用相应的函数,一个流程一个文件,参考“我的流程1、我的流程2”
        protected virtual void ApplyCustomFields(Model model, JObject form, JArray formitems, BPMTask task, BPMProcStep step, FlowDataSet formdataset, CommentItemCollection comments)
        {
            string processName = "";
            //string processName = "我的流程1";  //表单定制演示
            string functionName = "Form_" + processName;

            MethodInfo method = this.GetType().GetMethod(functionName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

            if (method != null)
            {
                method.Invoke(this, new object[] { model, form, formitems, task, step, formdataset, comments });
            }

            this.Default(model, form, formitems, task, step, formdataset, comments);
        }