コード例 #1
0
        /// <summary>
        /// 添加标签
        /// </summary>
        /// <returns></returns>
        public string CreatLabNote()
        {
            try
            {
                LabNote lb = new LabNote();

                //获取当前流程已经存在的数量
                LabNotes labNotes = new LabNotes();
                int      num      = labNotes.Retrieve(LabNoteAttr.FK_Flow, this.FK_Flow);

                string Name = this.GetValFromFrmByKey("LabName");
                int    x    = int.Parse(this.GetValFromFrmByKey("X"));
                int    y    = int.Parse(this.GetValFromFrmByKey("Y"));

                lb.MyPK    = this.FK_Flow + "_" + x + "_" + y + "_" + (num + 1);
                lb.Name    = Name;
                lb.FK_Flow = this.FK_Flow;
                lb.X       = x;
                lb.Y       = y;

                lb.DirectInsert();

                Hashtable ht = new Hashtable();
                ht.Add("MyPK", this.FK_Flow + "_" + x + "_" + y + "_" + (num + 1));
                ht.Add("FK_Flow", this.FK_Flow);

                return(BP.Tools.Json.ToJsonEntityModel(ht));
            }
            catch (Exception ex)
            {
                return("@err:" + ex.Message);
            }
        }
コード例 #2
0
ファイル: WSDesigner.cs プロジェクト: zhaoyingju/ccflow
        public string DoNewLabel(string fk_flow, int x, int y, string name, string lableId)
        {
            LabNote lab = new LabNote();

            lab.FK_Flow = fk_flow;
            lab.X       = x;
            lab.Y       = y;
            if (string.IsNullOrEmpty(lableId))
            {
                lab.MyPK = BP.DA.DBAccess.GenerOID().ToString();
            }
            else
            {
                lab.MyPK = lableId;
            }
            lab.Name = name;
            try
            {
                lab.Save();
            }
            catch
            {
            }
            return(lab.MyPK);
        }
コード例 #3
0
ファイル: WSDesigner.cs プロジェクト: zhaoyingju/ccflow
        public string DoSaveFlow(string fk_flow, string nodes, string dirs, string labes)
        {
            LetAdminLogin("CH", true);
            try
            {
                //处理方向。
                string sql = "Delete FROM WF_Direction WHERE FK_Flow='" + fk_flow + "'";
                DBAccess.RunSQL(sql);

                string[] mydirs = dirs.Split('~');
                foreach (string dir in mydirs)
                {
                    if (string.IsNullOrEmpty(dir))
                    {
                        continue;
                    }

                    AtPara ap = new AtPara(dir);

                    string dots = ap.GetValStrByKey("Dots").Replace('#', '@');
                    sql = "INSERT INTO WF_Direction (Node,ToNode,FK_Flow,DirType,IsCanBack,Dots,MyPK) VALUES ("
                          + ap.GetValIntByKey("Node") + "," + ap.GetValIntByKey("ToNode") + ",'" + fk_flow
                          + "'," + ap.GetValIntByKey("DirType") + "," + ap.GetValIntByKey("IsCanBack")
                          + "," + (dots == string.Empty ? "null" : "'" + dots + "'") + ",'" + ap.GetValStrByKey("MyPK") + "')";
                    DBAccess.RunSQL(sql);
                }

                //处理节点。
                Flow f1 = new Flow(fk_flow);

                string[] nds = nodes.Split('~');
                foreach (string nd in nds)
                {
                    if (string.IsNullOrEmpty(nd))
                    {
                        continue;
                    }

                    AtPara ap     = new AtPara(nd);
                    Node   mynode = new Node(ap.GetValIntByKey("NodeID"));
                    if (mynode.NodeID == 0)
                    {
                        f1.Paras = string.Format("@StartNodeX={0}@StartNodeY={1}", ap.GetValStrByKey("X"), ap.GetValStrByKey("Y"));
                    }
                    else if (mynode.NodeID == 1)
                    {
                        f1.Paras += string.Format("@EndNodeX={0}@EndNodeY={1}", ap.GetValStrByKey("X"), ap.GetValStrByKey("Y"));
                    }
                    else
                    {
                        SetNodeProperties(mynode, ap.GetValStrByKey("Name"),
                                          ap.GetValIntByKey("X"),
                                          ap.GetValIntByKey("Y"),
                                          ap.GetValIntByKey("HisRunModel"));//NodeType

                        mynode.DirectUpdate();
                        //   mynode.Save();
                    }
                }

                f1.Save();

                //处理标签。
                string[] mylabs = labes.Split('~');
                foreach (string lab in mylabs)
                {
                    if (string.IsNullOrEmpty(lab))
                    {
                        continue;
                    }

                    AtPara  ap = new AtPara(lab);
                    LabNote ln = new LabNote();
                    ln.MyPK    = ap.GetValStrByKey("MyPK");
                    ln.FK_Flow = fk_flow;
                    ln.Name    = ap.GetValStrByKey("Label");
                    ln.X       = ap.GetValIntByKey("X");
                    ln.Y       = ap.GetValIntByKey("Y");
                    ln.Save();
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
            return(null);
        }