Example #1
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, WfTBActivityEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #2
0
        public ActionResult SaveWorkFlowData(string queryJson)
        {
            var queryParam = queryJson.ToJObject();

            var flow = Newtonsoft.Json.JsonConvert.DeserializeObject <Flow>(queryParam["Flow"].ToString());                    //flow

            var process = Newtonsoft.Json.JsonConvert.DeserializeObject <WfTBProcessEntity>(queryParam["Process"].ToString()); //ProcessEntity

            processbll.SaveForm(process.Id, process);                                                                          //创建或保存流程实例

            string keyValue = process.Id;                                                                                      //流程实例Id

            var sourceNodes = activitybll.GetList(keyValue);                                                                   //流程节点对象

            var sourceLines = conditionbll.GetList(keyValue);                                                                  //流程导向对象

            List <string> nodeids = new List <string>();

            List <string> lineids = new List <string>();

            IList <nodes> nodeList = flow.nodes;

            IList <lines> lineList = flow.lines;

            foreach (nodes node in nodeList)
            {
                WfTBActivityEntity entity = new WfTBActivityEntity();
                string             nodeid = node.id;
                if (nodeid.Contains("FlowPanel_node"))
                {
                    nodeid = "";
                }
                if (!string.IsNullOrEmpty(nodeid))
                {
                    nodeids.Add(nodeid);
                }
                entity.Id         = nodeid;
                entity.ProcessId  = keyValue;  //流程Id
                entity.FormName   = node.type; //
                entity.Name       = node.name;
                entity.FormWidth  = node.width;
                entity.FormHeight = node.height;
                entity.GraphLeft  = node.left;
                entity.Graphtop   = node.top;
                string kind = string.Empty;
                switch (node.type)
                {
                case "startround":
                    kind = "开始节点";
                    break;

                case "stepnode":
                    kind = "标准节点";
                    break;

                case "endround":
                    kind = "结束节点";
                    break;
                }
                entity.Kind = kind;
                activitybll.SaveForm(entity.Id, entity);  //保存节点

                if (node.id.Contains("FlowPanel_node"))
                {
                    for (int i = 0; i < lineList.Count(); i++)
                    {
                        if (lineList[i].from == node.id)
                        {
                            lineList[i].from = entity.Id;
                        }
                        if (lineList[i].to == node.id)
                        {
                            lineList[i].to = entity.Id;
                        }
                    }
                }
            }


            foreach (lines line in lineList)
            {
                WfTBConditionEntity entity = new WfTBConditionEntity();
                string lineid = line.id;
                if (lineid.Contains("FlowPanel_line"))
                {
                    lineid = "";
                }
                if (!string.IsNullOrEmpty(lineid))
                {
                    lineids.Add(lineid);
                }
                entity.Id           = lineid;
                entity.ActivityId   = line.from;
                entity.ToActivityId = line.to;
                entity.ProcessId    = keyValue;
                conditionbll.SaveForm(entity.Id, entity);;
            }

            //删除多余的节点
            var dyNodes = sourceNodes.Where(p => !nodeids.Contains(p.Id));

            foreach (WfTBActivityEntity delEntity in dyNodes)
            {
                activitybll.RemoveForm(delEntity.Id);
            }

            //删除多余的流程转向
            var dyLines = sourceLines.Where(p => !lineids.Contains(p.Id));

            foreach (WfTBConditionEntity delEntity in dyLines)
            {
                conditionbll.RemoveForm(delEntity.Id);
            }
            return(Success("保存成功!"));
        }
Example #3
0
 public ActionResult SaveActivityForm(string keyValue, WfTBActivityEntity entity)
 {
     activitybll.SaveForm(keyValue, entity);
     return(Success("操作成功!"));
 }