예제 #1
0
        /// <summary>
        /// 画图页面
        /// </summary>
        /// <returns></returns>
        public ActionResult DesignerPage()
        {
            List <OT_WorkflowTemplateDraft> modelList = _workflowTemplateDraftService.SelectData <OT_WorkflowTemplateDraft>(@"SELECT [ObjectID]
      ,[Content]
      ,[Creator]
      ,[ModifiedBy]
      ,[CreatedTime]
      ,[ModifiedTime]
      ,[WorkflowCode]
      ,[BizObjectSchemaCode]
      ,[ParentObjectID]
      ,[ParentPropertyName]
      ,[ParentIndex]
  FROM [DataMip].[dbo].[OT_WorkflowTemplateDraft]");
            OT_WorkflowTemplateDraft        model     = modelList[0];
            var WorkflowPackage = XMLHelper.GetRootNode(model.Content);
            WorkflowTemplate workflowTemplate = new WorkflowTemplate();

            workflowTemplate.WorkflowCode        = XMLHelper.GetNodeValue(WorkflowPackage, "WorkflowCode");
            workflowTemplate.InstanceName        = XMLHelper.GetNodeValue(WorkflowPackage, "InstanceName");
            workflowTemplate.Creator             = modelList[0].Creator;
            workflowTemplate.ModifiedBy          = modelList[0].ModifiedBy;
            workflowTemplate.CreatedTime         = Convert.ToString(modelList[0].CreatedTime);
            workflowTemplate.ModifiedTime        = Convert.ToString(modelList[0].ModifiedTime);
            workflowTemplate.Description         = XMLHelper.GetNodeValue(WorkflowPackage, "Description");
            workflowTemplate.Height              = 0;
            workflowTemplate.Width               = 0;
            workflowTemplate.BizObjectSchemaCode = XMLHelper.GetNodeValue(WorkflowPackage, "BizObjectSchemaCode");
            List <ActivityModel> activites = new List <ActivityModel>();


            #region 获取开始节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/StartActivity"));


            #endregion
            #region 获取结束节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/EndActivity"));

            #endregion
            #region 获取手工节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/FillSheetActivity"));

            #endregion
            #region 获取传阅节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/CirculateActivity"));

            #endregion
            #region 获取连接点节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/ConnectionActivity"));

            #endregion
            #region 获取业务动作节点
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/BizActionActivity"));

            #endregion
            #region 获取审批节点集合
            activites.AddRange(WorkflowHelper.GetActivities(WorkflowPackage, "Activities/ApproveActivity"));

            #endregion

            workflowTemplate.Activities = activites;



            List <LineRuleModel> rules    = new List <LineRuleModel>();
            XmlNodeList          ruleList = XMLHelper.GetNodeList(WorkflowPackage, "Rules/Rule");
            foreach (XmlNode rule in ruleList)
            {
                LineRuleModel ruleModel = new LineRuleModel();
                ruleModel.DisplayName      = XMLHelper.GetNodeValue(rule, "Text");
                ruleModel.IsRule           = true;
                ruleModel.PreActivityCode  = XMLHelper.GetNodeValue(rule, "PreActivityCode");
                ruleModel.PostActivityCode = XMLHelper.GetNodeValue(rule, "PostActivityCode");
                ruleModel.UtilizeElse      = Convert.ToBoolean(XMLHelper.GetNodeValue(rule, "UtilizeElse"));
                ruleModel.FixedPoint       = Convert.ToBoolean(XMLHelper.GetNodeValue(rule, "FixedPoint"));
                ruleModel.Formula          = XMLHelper.GetNodeValue(rule, "Formula");
                ruleModel.TextX            = XMLHelper.GetNodeValue(rule, "TextX");
                ruleModel.TextY            = XMLHelper.GetNodeValue(rule, "TextX");
                XmlNodeList   pointList = XMLHelper.GetNodeList(rule, "Points/Point");
                List <string> points    = new List <string>();
                foreach (XmlNode item in pointList)
                {
                    points.Add(item.InnerText);
                }
                ruleModel.Points    = points;
                ruleModel.FontSize  = Convert.ToInt32(XMLHelper.GetNodeValue(rule, "FontSize"));
                ruleModel.FontColor = XMLHelper.GetNodeValue(rule, "FontColor");
                ruleModel.ID        = XMLHelper.GetNodeValue(rule, "ID");
                rules.Add(ruleModel);
            }
            workflowTemplate.Rules       = rules;
            ViewData["WorkflowTemplate"] = new JavaScriptSerializer().Serialize(workflowTemplate);
            return(View());
        }