Ejemplo n.º 1
0
        public void BindCond()
        {
            string msg  = "";
            string note = "";

            Cond cond = new Cond();

            cond.MyPK = this.MyPK;
            if (cond.RetrieveFromDBSources() == 0)
            {
                if (this.FK_Attr != null)
                {
                    cond.FK_Attr = this.FK_Attr;
                }
                if (this.FK_MainNode != 0)
                {
                    cond.NodeID = this.FK_MainNode;
                }
                if (this.FK_Node != 0)
                {
                    cond.FK_Node = this.FK_Node;
                }
                if (this.FK_Flow != null)
                {
                    cond.FK_Flow = this.FK_Flow;
                }
            }
            //this.AddTable("border=0 widht='500px'");
            this.AddTable("class='Table' cellpadding='2' cellspacing='2' style='width:100%;'");
            this.AddTR();
            this.AddTD("class='GroupTitle' style='width:80px'", "项目");
            this.AddTD("class='GroupTitle' style='width:200px'", "采集");
            this.AddTD("class='GroupTitle'", "描述");
            this.AddTREnd();

            this.AddTR();
            this.AddTD("节点");
            Nodes nds  = new Nodes(cond.FK_Flow);
            Nodes ndsN = new Nodes();

            foreach (BP.WF.Node mynd in nds)
            {
                ndsN.AddEntity(mynd);
            }
            DDL ddl = new DDL();

            ddl.ID = "DDL_Node";
            ddl.BindEntities(ndsN, "NodeID", "Name");
            ddl.SetSelectItem(cond.FK_Node);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            this.AddTD(ddl);
            this.AddTD("节点");
            this.AddTREnd();

            // 属性/字段
            MapAttrs attrs = new MapAttrs();

            attrs.Retrieve(MapAttrAttr.FK_MapData, "ND" + ddl.SelectedItemStringVal);

            MapAttrs attrNs = new MapAttrs();

            foreach (MapAttr attr in attrs)
            {
                if (attr.IsBigDoc)
                {
                    continue;
                }

                switch (attr.KeyOfEn)
                {
                case "Title":
                //case "RDT":
                //case "CDT":
                case "FK_Emp":
                case "MyNum":
                case "FK_NY":
                case WorkAttr.Emps:
                case WorkAttr.OID:
                case StartWorkAttr.Rec:
                case StartWorkAttr.FID:
                    continue;

                default:
                    break;
                }
                attrNs.AddEntity(attr);
            }
            ddl    = new DDL();
            ddl.ID = "DDL_Attr";
            if (attrNs.Count == 0)
            {
                BP.WF.Node nd = new BP.WF.Node(cond.FK_Node);
                nd.RepareMap();
                this.AddTR();
                this.AddTD("");
                this.AddTD("colspan=2", "节点没有找到合适的条件");
                this.AddTREnd();
                this.AddTableEnd();
                return;
            }
            else
            {
                ddl.BindEntities(attrNs, MapAttrAttr.MyPK, MapAttrAttr.Name);
                ddl.AutoPostBack          = true;
                ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
                ddl.SetSelectItem(cond.FK_Attr);
            }

            this.AddTR();
            this.AddTD("属性/字段");
            this.AddTD(ddl);
            this.AddTD("");
            this.AddTREnd();

            MapAttr attrS = new MapAttr(this.DDL_Attr.SelectedItemStringVal);

            this.AddTR();
            this.AddTD("操作符");
            ddl    = new DDL();
            ddl.ID = "DDL_Oper";
            switch (attrS.LGType)
            {
            case BP.En.FieldTypeS.Enum:
            case BP.En.FieldTypeS.FK:
                ddl.Items.Add(new ListItem("=", "="));
                ddl.Items.Add(new ListItem("<>", "<>"));
                break;

            case BP.En.FieldTypeS.Normal:
                switch (attrS.MyDataType)
                {
                case BP.DA.DataType.AppString:
                case BP.DA.DataType.AppDate:
                case BP.DA.DataType.AppDateTime:
                    ddl.Items.Add(new ListItem("=", "="));
                    ddl.Items.Add(new ListItem("LIKE", "LIKE"));
                    ddl.Items.Add(new ListItem("<>", "<>"));
                    break;

                case BP.DA.DataType.AppBoolean:
                    ddl.Items.Add(new ListItem("=", "="));
                    break;

                default:
                    ddl.Items.Add(new ListItem("=", "="));
                    ddl.Items.Add(new ListItem(">", ">"));
                    ddl.Items.Add(new ListItem(">=", ">="));
                    ddl.Items.Add(new ListItem("<", "<"));
                    ddl.Items.Add(new ListItem("<=", "<="));
                    ddl.Items.Add(new ListItem("<>", "<>"));
                    break;
                }
                break;

            default:
                break;
            }

            if (cond != null)
            {
                try
                {
                    ddl.SetSelectItem(cond.OperatorValueInt);
                }
                catch
                {
                }
            }
            this.AddTD(ddl);
            this.AddTD("");
            this.AddTREnd();
            switch (attrS.LGType)
            {
            case BP.En.FieldTypeS.Enum:
                this.AddTR();
                this.AddTD("值");
                ddl    = new DDL();
                ddl.ID = "DDL_Val";
                ddl.BindSysEnum(attrS.UIBindKey);
                if (cond != null)
                {
                    try
                    {
                        ddl.SetSelectItem(cond.OperatorValueInt);
                    }
                    catch
                    {
                    }
                }
                this.AddTD(ddl);
                this.AddTD("");
                this.AddTREnd();
                break;

            case BP.En.FieldTypeS.FK:
                this.AddTR();
                this.AddTD("值");

                ddl    = new DDL();
                ddl.ID = "DDL_Val";
                ddl.BindEntities(attrS.HisEntitiesNoName);
                if (cond != null)
                {
                    try
                    {
                        ddl.SetSelectItem(cond.OperatorValueStr);
                    }
                    catch
                    {
                    }
                }
                this.AddTD(ddl);
                this.AddTD("");
                this.AddTREnd();
                break;

            default:
                if (attrS.MyDataType == BP.DA.DataType.AppBoolean)
                {
                    this.AddTR();
                    this.AddTD("值");
                    ddl    = new DDL();
                    ddl.ID = "DDL_Val";
                    ddl.BindAppYesOrNo(0);
                    if (cond != null)
                    {
                        try
                        {
                            ddl.SetSelectItem(cond.OperatorValueInt);
                        }
                        catch
                        {
                        }
                    }
                    this.AddTD(ddl);
                    this.AddTD();
                    this.AddTREnd();
                }
                else
                {
                    this.AddTR();
                    this.AddTD("值");
                    TB tb = new TB();
                    tb.ID = "TB_Val";
                    if (cond != null)
                    {
                        tb.Text = cond.OperatorValueStr;
                    }
                    this.AddTD(tb);
                    this.AddTD();
                    this.AddTREnd();
                }
                break;
            }


            Conds       conds = new Conds();
            QueryObject qo    = new QueryObject(conds);

            qo.AddWhere(CondAttr.NodeID, this.FK_MainNode);
            qo.addAnd();
            qo.AddWhere(CondAttr.DataFrom, (int)ConnDataFrom.Form);
            qo.addAnd();
            qo.AddWhere(CondAttr.CondType, (int)this.HisCondType);

            if (this.ToNodeID != 0)
            {
                qo.addAnd();
                qo.AddWhere(CondAttr.ToNodeID, this.ToNodeID);
            }
            int num = qo.DoQuery();

            this.AddTableEnd();
            this.AddBR();
            this.AddSpace(1);

            var btn = new LinkBtn(false, "Btn_SaveAnd", "保存为And条件");

            btn.SetDataOption("iconCls", "'icon-save'");
            btn.Click += new EventHandler(btn_Save_Click);
            this.Add(btn);
            this.AddSpace(1);

            btn = new LinkBtn(false, "Btn_SaveOr", "保存为Or条件");
            btn.SetDataOption("iconCls", "'icon-save'");
            btn.Click += new EventHandler(btn_Save_Click);
            this.Add(btn);
            this.AddSpace(1);

            btn = new LinkBtn(false, NamesOfBtn.Delete, "删除");
            btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');";
            btn.Click += new EventHandler(btn_Save_Click);
            this.Add(btn);

            this.AddBR();
            this.AddBR();

            if (num == 0)
            {
                return;
            }

            #region 条件
            this.AddTable("class='Table' cellpadding='2' cellspacing='2' style='width:100%;'");
            this.AddTR();
            this.AddTDTitleGroup("序");
            this.AddTDTitleGroup("节点");
            this.AddTDTitleGroup("字段的英文名");
            this.AddTDTitleGroup("字段的中文名");
            this.AddTDTitleGroup("操作符");
            this.AddTDTitleGroup("值");
            this.AddTDTitleGroup("标签");
            this.AddTDTitleGroup("运算关系");
            this.AddTDTitleGroup("操作");
            this.AddTREnd();

            int i = 0;
            foreach (Cond mync in conds)
            {
                if (mync.HisDataFrom != ConnDataFrom.Form)
                {
                    continue;
                }

                i++;

                this.AddTR();
                this.AddTDIdx(i);
                //  this.AddTD(mync.HisDataFrom.ToString());
                this.AddTD(mync.FK_NodeT);
                this.AddTD(mync.AttrKey);
                this.AddTD(mync.AttrName);
                this.AddTDCenter(mync.FK_Operator);
                this.AddTD(mync.OperatorValueStr);
                this.AddTD(mync.OperatorValueT);

                if (mync.CondOrAnd == CondOrAnd.ByAnd)
                {
                    this.AddTD("AND");
                }
                else
                {
                    this.AddTD("OR");
                }

                //if (num > 1)
                //    this.AddTD(mync.HisConnJudgeWayT);
                this.AddTD("<a href='Cond.aspx?MyPK=" + mync.MyPK + "&CondType=" + (int)this.HisCondType + "&FK_Flow=" + this.FK_Flow + "&FK_Attr=" + mync.FK_Attr + "&FK_MainNode=" + mync.NodeID + "&OperatorValue=" + mync.OperatorValueStr + "&FK_Node=" + mync.FK_Node + "&DoType=Del&ToNodeID=" + mync.ToNodeID + "' class='easyui-linkbutton' data-options=\"iconCls:'icon-remove'\" onclick=\"return confirm('确定删除此条件吗?')\">删除</a>");
                this.AddTREnd();
            }
            this.AddTableEnd();
            this.AddBR();

            AddEasyUiPanelInfo("说明", "在上面的条件集合中ccflow仅仅支持要么是And,要么是OR的两种情形,高级的开发就需要事件来支持条件转向,或者采用其他的方式。");

            #endregion
        }
Ejemplo n.º 2
0
        public void BindCond()
        {
            string msg  = "";
            string note = "";

            BP.WF.Cond cond = new Cond();
            cond.MyPK = this.MyPK;
            if (cond.RetrieveFromDBSources() == 0)
            {
                if (this.FK_Attr != null)
                {
                    cond.FK_Attr = this.FK_Attr;
                }
                if (this.FK_MainNode != 0)
                {
                    cond.NodeID = this.FK_MainNode;
                }
                if (this.FK_Node != 0)
                {
                    cond.FK_Node = this.FK_Node;
                }
                if (this.FK_Flow != null)
                {
                    cond.FK_Flow = this.FK_Flow;
                }
            }
            this.AddTable("border=0 widht='500px'");
            //this.AddCaptionLeft("");
            this.AddTR();
            this.AddTDTitle("项目");
            this.AddTDTitle("采集");
            this.AddTDTitle("描述");
            this.AddTREnd();

            this.AddTR();
            this.AddTD("节点");
            Nodes nds  = new Nodes(cond.FK_Flow);
            Nodes ndsN = new Nodes();

            foreach (BP.WF.Node mynd in nds)
            {
                ndsN.AddEntity(mynd);
            }
            DDL ddl = new DDL();

            ddl.ID = "DDL_Node";
            ddl.BindEntities(ndsN, "NodeID", "Name");
            ddl.SetSelectItem(cond.FK_Node);
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            this.AddTD(ddl);
            this.AddTD("节点");
            this.AddTREnd();

            // 属性/字段
            MapAttrs attrs = new MapAttrs();

            attrs.Retrieve(MapAttrAttr.FK_MapData, "ND" + ddl.SelectedItemStringVal);

            MapAttrs attrNs = new MapAttrs();

            foreach (MapAttr attr in attrs)
            {
                if (attr.IsBigDoc)
                {
                    continue;
                }

                switch (attr.KeyOfEn)
                {
                case "Title":
                //case "RDT":
                //case "CDT":
                case "FK_Emp":
                case "MyNum":
                case "FK_NY":
                case WorkAttr.Emps:
                case WorkAttr.OID:
                case StartWorkAttr.Rec:
                case StartWorkAttr.FID:
                    continue;

                default:
                    break;
                }
                attrNs.AddEntity(attr);
            }
            ddl    = new DDL();
            ddl.ID = "DDL_Attr";
            if (attrNs.Count == 0)
            {
                BP.WF.Node nd = new BP.WF.Node(cond.FK_Node);
                nd.RepareMap();
                this.AddTR();
                this.AddTD("");
                this.AddTD("colspan=2", "节点没有找到合适的条件");
                this.AddTREnd();
                this.AddTableEnd();
                return;
            }
            else
            {
                ddl.BindEntities(attrNs, MapAttrAttr.MyPK, MapAttrAttr.Name);
                ddl.AutoPostBack          = true;
                ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
                ddl.SetSelectItem(cond.FK_Attr);
            }

            this.AddTR();
            this.AddTD("属性/字段");
            this.AddTD(ddl);
            this.AddTD("");
            this.AddTREnd();

            MapAttr attrS = new MapAttr(this.DDL_Attr.SelectedItemStringVal);

            this.AddTR();
            this.AddTD("操作符");
            ddl    = new DDL();
            ddl.ID = "DDL_Oper";
            switch (attrS.LGType)
            {
            case BP.En.FieldTypeS.Enum:
            case BP.En.FieldTypeS.FK:
                ddl.Items.Add(new ListItem("=", "="));
                ddl.Items.Add(new ListItem("<>", "<>"));
                break;

            case BP.En.FieldTypeS.Normal:
                switch (attrS.MyDataType)
                {
                case BP.DA.DataType.AppString:
                case BP.DA.DataType.AppDate:
                case BP.DA.DataType.AppDateTime:
                    ddl.Items.Add(new ListItem("=", "="));
                    ddl.Items.Add(new ListItem("LIKE", "LIKE"));
                    ddl.Items.Add(new ListItem("<>", "<>"));
                    break;

                case BP.DA.DataType.AppBoolean:
                    ddl.Items.Add(new ListItem("=", "="));
                    break;

                default:
                    ddl.Items.Add(new ListItem("=", "="));
                    ddl.Items.Add(new ListItem(">", ">"));
                    ddl.Items.Add(new ListItem(">=", ">="));
                    ddl.Items.Add(new ListItem("<", "<"));
                    ddl.Items.Add(new ListItem("<=", "<="));
                    ddl.Items.Add(new ListItem("<>", "<>"));
                    break;
                }
                break;

            default:
                break;
            }

            if (cond != null)
            {
                try
                {
                    ddl.SetSelectItem(cond.OperatorValueInt);
                }
                catch
                {
                }
            }
            this.AddTD(ddl);
            this.AddTD("");
            this.AddTREnd();
            switch (attrS.LGType)
            {
            case BP.En.FieldTypeS.Enum:
                this.AddTR();
                this.AddTD("值");
                ddl    = new DDL();
                ddl.ID = "DDL_Val";
                ddl.BindSysEnum(attrS.UIBindKey);
                if (cond != null)
                {
                    try
                    {
                        ddl.SetSelectItem(cond.OperatorValueInt);
                    }
                    catch
                    {
                    }
                }
                this.AddTD(ddl);
                this.AddTD("");
                this.AddTREnd();
                break;

            case BP.En.FieldTypeS.FK:
                this.AddTR();
                this.AddTD("值");

                ddl    = new DDL();
                ddl.ID = "DDL_Val";
                ddl.BindEntities(attrS.HisEntitiesNoName);
                if (cond != null)
                {
                    try
                    {
                        ddl.SetSelectItem(cond.OperatorValueStr);
                    }
                    catch
                    {
                    }
                }
                this.AddTD(ddl);
                this.AddTD("");
                this.AddTREnd();
                break;

            default:
                if (attrS.MyDataType == BP.DA.DataType.AppBoolean)
                {
                    this.AddTR();
                    this.AddTD("值");
                    ddl    = new DDL();
                    ddl.ID = "DDL_Val";
                    ddl.BindAppYesOrNo(0);
                    if (cond != null)
                    {
                        try
                        {
                            ddl.SetSelectItem(cond.OperatorValueInt);
                        }
                        catch
                        {
                        }
                    }
                    this.AddTD(ddl);
                    this.AddTD();
                    this.AddTREnd();
                }
                else
                {
                    this.AddTR();
                    this.AddTD("值");
                    TB tb = new TB();
                    tb.ID = "TB_Val";
                    if (cond != null)
                    {
                        tb.Text = cond.OperatorValueStr;
                    }
                    this.AddTD(tb);
                    this.AddTD();
                    this.AddTREnd();
                }
                break;
            }


            Conds       conds = new Conds();
            QueryObject qo    = new QueryObject(conds);

            qo.AddWhere(CondAttr.NodeID, this.FK_MainNode);
            qo.addAnd();
            qo.AddWhere(CondAttr.DataFrom, (int)ConnDataFrom.Form);
            qo.addAnd();
            qo.AddWhere(CondAttr.CondType, (int)this.HisCondType);

            if (this.ToNodeID != 0)
            {
                qo.addAnd();
                qo.AddWhere(CondAttr.ToNodeID, this.ToNodeID);
            }
            int num = qo.DoQuery();


            this.AddTRSum();
            this.Add("<TD class=TD colspan=3 align=center>");
            Button btn = new Button();

            btn.ID       = "Btn_Save";
            btn.CssClass = "Btn";
            btn.Text     = " Save ";

            btn.Click += new EventHandler(btn_Save_Click);
            this.Add(btn);

            btn          = new Button();
            btn.ID       = "Btn_Del";
            btn.CssClass = "Btn";
            btn.Text     = "Clear";
            btn.Attributes["onclick"] = " return confirm('您确定要删除吗?');";
            btn.Click += new EventHandler(btn_Save_Click);

            this.Add(btn);

            this.Add("</TD>");
            this.AddTREnd();

            this.AddTableEnd();

            if (num == 0)
            {
                return;
            }


            #region 条件
            this.AddTable("border=0 widht='500px'");
            this.AddCaptionLeft("说明:同时满足如下条件转向成立,只能删除不能编辑.");
            this.AddTR();
            this.AddTDTitle("IDX");
            this.AddTDTitle("节点");
            this.AddTDTitle("字段的英文名");
            this.AddTDTitle("字段的中文名");
            this.AddTDTitle("操作符");
            this.AddTDTitle("值");
            this.AddTDTitle("标签");
            this.AddTDTitle("操作");
            this.AddTREnd();

            int i = 0;
            foreach (Cond mync in conds)
            {
                if (mync.HisDataFrom != ConnDataFrom.Form)
                {
                    continue;
                }

                i++;

                this.AddTR();
                this.AddTDIdx(i);
                //  this.AddTD(mync.HisDataFrom.ToString());
                this.AddTD(mync.FK_NodeT);
                this.AddTD(mync.AttrKey);
                this.AddTD(mync.AttrName);

                this.AddTDCenter(mync.FK_Operator);
                this.AddTD(mync.OperatorValueStr);
                this.AddTD(mync.OperatorValueT);
                //if (num > 1)
                //    this.AddTD(mync.HisConnJudgeWayT);
                this.AddTD("<a href='Cond.aspx?MyPK=" + mync.MyPK + "&CondType=" + (int)this.HisCondType + "&FK_Flow=" + this.FK_Flow + "&FK_Attr=" + mync.FK_Attr + "&FK_MainNode=" + mync.NodeID + "&OperatorValue=" + mync.OperatorValueStr + "&FK_Node=" + mync.FK_Node + "&DoType=Del&ToNodeID=" + mync.ToNodeID + "' >删除</a>");
                this.AddTREnd();
            }
            this.AddTableEnd();
            #endregion
        }