protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "字段复制";

            BP.WF.Node  nd  = new BP.WF.Node(this.FK_Node);
            BP.WF.Nodes nds = new BP.WF.Nodes(nd.FK_Flow);

            Node sNd = new Node(this.NodeOfSelect);

            MapAttrs attrs     = new MapAttrs(this.NodeOfSelect);
            MapAttrs attrsCopy = new MapAttrs(this.FK_Node);


            this.Pub1.AddFieldSet("选择节点");
            this.Pub1.AddUL("Main");
            foreach (BP.WF.Node en in nds)
            {
                if (this.NodeOfSelect == en.NodeID.ToString())
                {
                    this.Pub1.AddLiB("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name);
                }
                else
                {
                    this.Pub1.AddLi("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name);
                }
            }
            this.Pub1.AddULEnd();
            this.Pub1.AddFieldSetEnd();

            this.Pub2.AddTable("width='500px'");

            //this.Pub2.AddTR();
            //this.Pub2.AddTDTitle(this.ToE("Field", "字段"));
            ////this.Pub2.AddTDTitle("描述");
            ////this.Pub2.AddTDTitle("类型");
            ////this.Pub2.AddTDTitle(this.ToE("Show", "显示"));
            //this.Pub2.AddTREnd();

            GroupFields gfs  = new GroupFields(this.NodeOfSelect);
            MapDtls     dtls = new MapDtls(this.NodeOfSelect);
            MapM2Ms     m2ms = new MapM2Ms(this.NodeOfSelect);
            MapFrames   frms = new MapFrames(this.NodeOfSelect);

            bool isHave = false;

            foreach (GroupField gf in gfs)
            {
                this.Pub2.AddTRSum();
                CheckBox cb = new CheckBox();
                cb.ID   = "CB" + gf.OID;
                cb.Text = "<b>" + gf.Lab + "</b>";
                this.Pub2.AddTD(cb);
                this.Pub2.AddTREnd();

                foreach (MapDtl dtl in dtls)
                {
                    if (dtl.GroupID != gf.OID)
                    {
                        continue;
                    }

                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + dtl.No + "_" + dtl.GroupID;
                    cb.Text = "从表:" + dtl.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }

                foreach (MapM2M m2m in m2ms)
                {
                    if (m2m.GroupID != gf.OID)
                    {
                        continue;
                    }
                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + m2m.MyPK + "_" + m2m.GroupID;
                    cb.Text = "多选" + ":" + m2m.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }

                foreach (MapFrame frm in frms)
                {
                    if (frm.GroupID != gf.OID)
                    {
                        continue;
                    }
                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + frm.MyPK + "_" + frm.GroupID;
                    cb.Text = "框架" + ":" + frm.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }


                this.Pub2.AddTR();
                this.Pub2.AddTDBigDocBegain();
                foreach (MapAttr attr in attrs)
                {
                    if (gf.OID != attr.GroupID)
                    {
                        continue;
                    }

                    switch (attr.KeyOfEn)
                    {
                    case BP.WF.GEStartWorkAttr.CDT:
                    case BP.WF.GEStartWorkAttr.Emps:
                    case BP.WF.GEStartWorkAttr.FID:
                    case BP.WF.GEStartWorkAttr.OID:
                    case BP.WF.GEStartWorkAttr.RDT:
                    case BP.WF.GEStartWorkAttr.Rec:
                    case BP.WF.GEStartWorkAttr.FK_NY:
                    case BP.WF.GEStartWorkAttr.WFState:
                    case BP.WF.GEStartWorkAttr.MyNum:
                    case BP.WF.GEStartWorkAttr.FK_Dept:
                    case BP.WF.GEStartWorkAttr.FK_DeptText:
                        continue;

                    default:
                        break;
                    }

                    cb      = new CheckBox();
                    cb.ID   = attr.KeyOfEn;
                    cb.Text = attr.KeyOfEn + " " + attr.Name;

                    if (attrsCopy.Contains(MapAttrAttr.KeyOfEn, attr.KeyOfEn))
                    {
                        cb.Enabled = false;
                    }
                    else
                    {
                        cb.Enabled = true;
                    }

                    isHave = true;
                    this.Pub2.Add(cb);
                }
                this.Pub2.AddTDEnd();
                this.Pub2.AddTREnd();
            }

            this.Pub2.AddTableEndWithBR();
            Button btn = new Button();

            btn.CssClass = "Btn";
            if (isHave == false)
            {
                return;
            }
            this.Pub2.Add("到分组:");
            gfs = new GroupFields(this.FK_Node);
            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_GroupField";
            ddl.Bind(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab);
            ddl.SetSelectItem(this.GroupField);
            this.Pub2.Add(ddl);
            btn.ID   = "Btn_OK";
            btn.Text = " 复制 ";

            btn.UseSubmitBehavior = false;
            btn.OnClientClick     = "this.disabled=true;";
            //this.disabled='disabled'; return true;";
            // btn.Attributes["onclick"] = " return confirm('您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?');";
            // btn.Attributes["onclick"] = " return confirm('" + this.ToE("AYS", "您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?") + "');";

            btn.Click += new EventHandler(btn_Copy_Click);
            this.Pub2.Add(btn);
        }
예제 #2
0
        public void BindSFTable(SFTable en)
        {
            string star = "<font color=red><b>(*)</b></font>";

            this.Ucsys1.AddTable();

            if (this.FromApp == "SL")
            {
                if (this.RefNo == null)
                {
                    this.Ucsys1.AddCaption("新建表");
                }
                else
                {
                    this.Ucsys1.AddCaption("编辑表");
                }
            }
            else
            {
                if (this.RefNo == null)
                {
                    this.Ucsys1.AddCaption("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'><img src='/WF/Img/Btn/Back.gif'>返回</a> - <a href='Do.aspx?DoType=AddSFTable&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>外键</a> - 新建表");
                }
                else
                {
                    this.Ucsys1.AddCaption("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'><img src='/WF/Img/Btn/Back.gif'>返回</a> - <a href='Do.aspx?DoType=AddSFTable&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>外键</a> - 编辑表");
                }
            }

            if (this.RefNo == null)
            {
                this.Title = "新建表";
            }
            else
            {
                this.Title = "编辑表";
            }

            int  idx    = 0;
            bool isItem = false;

            this.Ucsys1.AddTR();
            this.Ucsys1.AddTDTitle("Idx");
            this.Ucsys1.AddTDTitle("项目");
            this.Ucsys1.AddTDTitle("采集");


            // this.Ucsys1.AddFieldSet("帮助", help);

            this.Ucsys1.AddTDTitle("备注");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("数据源" + star);

            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_FK_SFDBSrc";
            SFDBSrcs srcs = new SFDBSrcs();

            srcs.RetrieveDBSrc();
            ddl.Bind(srcs, en.FK_SFDBSrc);
            this.Ucsys1.AddTD(ddl);

            //  this.Ucsys1.AddTD("外键表的数据源必须与该表单的数据源一致.");
            this.Ucsys1.AddTD("选择数据源,点击这里<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=BP.Sys.SFDBSrcs')\">创建</a>,<a href='SFSQL.aspx?DoType=New&MyPK=" + this.MyPK + "&Idx='>刷新</a>。");
            this.Ucsys1.AddTREnd();


            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("表中文名称" + star);
            BP.Web.Controls.TB tb = new BP.Web.Controls.TB();
            tb.ID           = "TB_Name";
            tb.Text         = en.Name;
            tb.AutoPostBack = true;
            tb.TextChanged += new EventHandler(tbName_TextChanged);
            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTD("该表的中文名称,比如:物料类别,科目。");
            this.Ucsys1.AddTREnd();


            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("表英文名称" + star);
            tb      = new BP.Web.Controls.TB();
            tb.ID   = "TB_No";
            tb.Text = en.No;
            if (this.RefNo == null)
            {
                tb.Enabled = true;
            }
            else
            {
                tb.Enabled = false;
            }

            if (tb.Text == "")
            {
                tb.Text = "";
            }

            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTDBigDoc("必须以字母或者下划线开头,不能包含特殊字符。");
            this.Ucsys1.AddTREnd();



            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("数据结构");
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_" + SFTableAttr.CodeStruct;
            ddl.BindSysEnum(SFTableAttr.CodeStruct, (int)en.CodeStruct);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("用于在下拉框中不同格式的展现.");
            this.Ucsys1.AddTREnd();

            //isItem = this.Ucsys1.AddTR(isItem);
            //this.Ucsys1.AddTDIdx(idx++);
            //this.Ucsys1.AddTD("数据源" + star);
            //ddl = new BP.Web.Controls.DDL();
            //SFDBSrcs srcs = new SFDBSrcs();
            //BP.En.QueryObject qo = new QueryObject(srcs);
            //qo.AddWhere(SFDBSrcAttr.DBSrcType, " < ", "100");
            //qo.DoQuery();
            //ddl.Bind(srcs, en.FK_SFDBSrc);
            //this.Ucsys1.AddTD(ddl);
            //this.Ucsys1.AddTD("选择数据源,点击这里<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=BP.Sys.SFDBSrcs')\">创建</a>,<a href='SFSQL.aspx?DoType=New&MyPK=" + this.MyPK + "&Idx='>刷新</a>。");
            //this.Ucsys1.AddTREnd();


            //isItem = this.Ucsys1.AddTR(isItem);
            //this.Ucsys1.AddTDIdx(idx++);
            //this.Ucsys1.AddTD("描述" + star);
            //tb = new BP.Web.Controls.TB();
            //tb.ID = "TB_TableDesc";
            //tb.Text = en.TableDesc;
            //this.Ucsys1.AddTD(tb);
            //this.Ucsys1.AddTD("对该表的备注,比如:物料类别字典表,科目字典表。");
            //this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.Add("<TD colspan=3 align=center>");
            Button btn = new Button();

            btn.ID       = "Btn_Save";
            btn.CssClass = "Btn";
            if (this.RefNo == null)
            {
                btn.Text = "创建";
            }
            else
            {
                btn.Text = "保存";
            }

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


            btn      = new Button();
            btn.ID   = "Btn_Edit";
            btn.Text = "编辑数据"; // "编辑数据"
            if (this.RefNo == null)
            {
                btn.Enabled = false;
            }
            if (en.IsClass)
            {
                btn.Attributes["onclick"] = "WinOpen('../Search.aspx?EnsName=" + en.No + "', 'dg'); return false;";
            }
            else
            {
                btn.Attributes["onclick"] = "WinOpen('SFTableEditData.aspx?RefNo=" + this.RefNo + "', 'dg'); return false;";
            }

            this.Ucsys1.Add(btn);

            if (this.FromApp != "SL")
            {
                btn          = new Button();
                btn.ID       = "Btn_Add";
                btn.CssClass = "Btn";

                btn.Text = "添加到表单";;  // "添加到表单";
                btn.Attributes["onclick"] = " return confirm('您确认吗?');";
                btn.Click += new EventHandler(btn_Add_Click);
                if (this.RefNo == null)
                {
                    btn.Enabled = false;
                }
            }

            this.Ucsys1.Add(btn);
            btn          = new Button();
            btn.ID       = "Btn_Del";
            btn.CssClass = "Btn";

            btn.Text = "删除";
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";
            if (this.RefNo == null)
            {
                btn.Enabled = false;
            }

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

            //string help = "<ul>";
            //help += "<li>输入:新表名或已经存在的表名或者视图,必须是英文字母或者下划线。</li>";
            //help += "<li>如果该表或者视图已经存在本机中,系统就会把他注册到ccform的数据源(Sys_SFTable)里,您可以打开Sys_SFTable查看ccform对外部数据源管理的信息。</li>";
            //help += "<li>如果不存在ccform就会自动创建表,该表有No,Name两个列,并且初始化3笔数据,您可以对该表进行编辑。</li>";
            //help += "</ul>";

            this.Ucsys1.Add(BP.WF.Glo.GenerHelpCCForm("帮助", null, null));

            this.Ucsys1.Add("</TD>");
            this.Ucsys1.AddTREnd();
            this.Ucsys1.AddTableEnd();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string   rpt   = "ND" + int.Parse(this.FK_Flow) + "Rpt";
            MapAttrs attrs = new MapAttrs(rpt);

            Flow fl = new Flow(this.FK_Flow);

            fl.RetrieveFromDBSources();

            fl.No = this.FK_Flow;
            if (string.IsNullOrEmpty(fl.DTSBTable) == true)
            {
                this.Pub1.AddFieldSet("配置错误", "请关闭该窗口,在流程属性里配置业务表名,然后点保存按钮,之后打开该功能界面。");
                return;
            }

            /*检查 用户设置的业务表是否正确,是否连接上.
             *
             * 1, sqlserver 比如: HR.dbo.Emps
             * 2, MySQL.
             * 3, Oracle  HR.Emps
             */


            //获取到业务表的字段名称.
            // 第1列,字段名。 第2列为中文名,第3类为类型.
            DataTable dt = BP.DA.DBAccess.GetTableSchema(fl.DTSBTable);

            this.Pub1.AddTable();
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("序");
            this.Pub1.AddTDTitle("是否同步");
            this.Pub1.AddTDTitle("字段描述");
            this.Pub1.AddTDTitle("类型");
            this.Pub1.AddTDTitle("业务表(" + fl.DTSBTable + ")");
            this.Pub1.AddTREnd();

            int idx = 0;

            Hashtable ht = new Hashtable();

            if (string.IsNullOrEmpty(fl.DTSFields))
            {
                fl.DTSFields = "@";
            }

            string[] fieldArray   = fl.DTSFields.Split('@');
            string[] lcFieldArray = fieldArray[0].Split(',');

            string[] ywFieldArray = fieldArray[1].Split(',');

            for (int i = 0; i < lcFieldArray.Length; i++)
            {
                ht.Add(lcFieldArray[i], ywFieldArray[i]);
            }

            string dtsFields = fl.DTSFields.Split('@')[0];

            foreach (MapAttr attr in attrs)
            {
                idx++;
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx);

                CheckBox cb = new CheckBox();
                cb.ID   = "CB_" + attr.KeyOfEn;
                cb.Text = attr.Name;

                foreach (DictionaryEntry de in ht)
                {
                    if (attr.KeyOfEn == de.Key.ToString())
                    {
                        cb.Checked = true;
                    }
                }

                this.Pub1.AddTD(cb);
                this.Pub1.AddTD(attr.KeyOfEn);
                this.Pub1.AddTD(attr.MyDataTypeStr);

                BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
                ddl.ID = "DDL_" + attr.KeyOfEn;

                ddl.Bind(dt, "FNAME", "FNAME");
                if (cb.Checked == true)
                {
                    try
                    {
                        ddl.SetSelectItem(ht[attr.KeyOfEn].ToString());
                    }
                    catch (Exception)
                    {
                    }
                }
                this.Pub1.AddTD(ddl);
                this.Pub1.AddTREnd();
            }
            this.Pub1.AddTableEnd();

            Button btn = new Button();

            btn.ID     = "Btn_Save";
            btn.Text   = "保存";
            btn.Click += new EventHandler(btn_Click);

            Button btnClose = new Button();

            btnClose.ID     = "Btn_Close";
            btnClose.Text   = "取消";
            btnClose.Click += new EventHandler(btnClose_Click);

            this.Pub1.Add(btn);
            this.Pub1.Add(btnClose);
        }
예제 #4
0
        public void BindSFTable(SFTable en)
        {
            bool   isItem = false;
            string star   = "<font color=red><b>(*)</b></font>";

            this.Ucsys1.AddTable();

            #region 生成标题.
            if (this.FromApp == "SL")
            {
                if (this.RefNo == null)
                {
                    this.Ucsys1.AddCaption("新建表");
                }
                else
                {
                    this.Ucsys1.AddCaption("编辑表");
                }
            }
            else
            {
                if (this.RefNo == null)
                {
                    this.Ucsys1.AddCaption("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'><img src='/WF/Img/Btn/Back.gif'>返回</a> - <a href='Do.aspx?DoType=AddSFSQL&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>外部表</a> - 新建表");
                }
                else
                {
                    this.Ucsys1.AddCaption("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'><img src='/WF/Img/Btn/Back.gif'>返回</a> - <a href='Do.aspx?DoType=AddSFSQL&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>外部表</a> - 编辑表");
                }
            }

            if (this.RefNo == null)
            {
                this.Title = "新建表";
            }
            else
            {
                this.Title = "编辑表";
            }

            #endregion 生成标题.

            int idx = 0;
            this.Ucsys1.AddTR();
            this.Ucsys1.AddTDTitle("Idx");
            this.Ucsys1.AddTDTitle("项目");
            this.Ucsys1.AddTDTitle("采集");
            this.Ucsys1.AddTDTitle("备注");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("数据源" + star);

            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_FK_SFDBSrc";

            SFDBSrcs srcs = new SFDBSrcs();
            srcs.RetrieveDBSrc();

            ddl.Bind(srcs, en.FK_SFDBSrc);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("选择数据源,点击这里<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=BP.Sys.SFDBSrcs')\">创建</a>,<a href='SFSQL.aspx?DoType=New&MyPK=" + this.MyPK + "&Idx='>刷新</a>。");
            this.Ucsys1.AddTREnd();


            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("中文名称" + star);
            BP.Web.Controls.TB tb = new BP.Web.Controls.TB();
            tb.ID           = "TB_" + SFTableAttr.Name;
            tb.Text         = en.Name;
            tb.Columns      = 35;
            tb.AutoPostBack = true;
            tb.TextChanged += new EventHandler(tbName_TextChanged);
            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTD("该表的中文名称,比如:物料类别,科目。");
            this.Ucsys1.AddTREnd();


            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("英文名称" + star);
            tb      = new BP.Web.Controls.TB();
            tb.ID   = "TB_" + SFTableAttr.No;
            tb.Text = en.No;
            if (this.RefNo == null)
            {
                tb.Enabled = true;
            }
            else
            {
                tb.Enabled = false;
            }

            if (tb.Text == "")
            {
                tb.Text = "";
            }
            tb.Columns = 35;
            tb.Attributes["onkeyup"] = "return IsDigit(this);";


            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTDBigDoc("必须以字母或者下划线开头,不能包含特殊字符。");
            this.Ucsys1.AddTREnd();


            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("数据结构");
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_" + SFTableAttr.CodeStruct;
            ddl.BindSysEnum(SFTableAttr.CodeStruct, (int)en.CodeStruct);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("字典表的数据结构,用于在下拉框中不同格式的展现。");
            this.Ucsys1.AddTREnd();

            //isItem = this.Ucsys1.AddTR(isItem);
            //this.Ucsys1.AddTDIdx(idx++);
            //this.Ucsys1.AddTD("描述");
            //tb = new BP.Web.Controls.TB();
            //tb.ID = "TB_"+SFTableAttr.TableDesc;
            //tb.Text = en.TableDesc;
            //this.Ucsys1.AddTD(tb);
            //this.Ucsys1.AddTD("对该表的备注,比如:物料类别字典表,科目字典表。");
            //this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("colspan=3", "查询SQL" + star + "支持ccform表达式,允许有@WebUser.No,@WebUser.Name,@WebUser.FK_Dept变量。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            tb          = new BP.Web.Controls.TB();
            tb.ID       = "TB_" + SFTableAttr.SelectStatement; //查询.
            tb.Text     = en.SelectStatement;                  //查询语句.
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 4;
            tb.Columns  = 70;
            //tb.Attributes["width"] = "98%";
            this.Ucsys1.AddTD("colspan=3", tb);
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("colspan=3", "比如:SELECT BH AS No, MC as Name FROM CC_USER WHERE CCType=3<br>SELECT BH AS No, MC as Name FROM CC_USER WHERE [email protected]_Dept");
            this.Ucsys1.AddTREnd();

            //isItem = this.Ucsys1.AddTR(isItem);
            //this.Ucsys1.AddTDIdx(idx++);
            //this.Ucsys1.AddTD("数据缓存(分钟)" + star);
            //tb = new BP.Web.Controls.TB();
            //tb.ID = "TB_"+SFTableAttr.CashMinute;
            //tb.TextExtInt = en.CashMinute;
            //tb.Columns = 5;
            //this.Ucsys1.AddTD(tb);
            //this.Ucsys1.AddTD("默认为0表示不缓存,缓存的数据存储在Sys_Dict里面.");
            //this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.Add("<TD colspan=3 align=center>");
            Button btn = new Button();
            btn.ID       = "Btn_Save";
            btn.CssClass = "Btn";
            if (this.RefNo == null)
            {
                btn.Text = "创建";
            }
            else
            {
                btn.Text = "保存";
            }
            btn.Click += new EventHandler(btn_Save_Click);
            this.Ucsys1.Add(btn);

            //btn = new Button();
            //btn.ID = "Btn_Edit";
            //btn.CssClass = "Btn";
            //btn.Text =  "查看数据"; // "编辑数据"
            //if (this.RefNo == null)
            //    btn.Enabled = false;
            //if (en.IsClass)
            //    btn.Attributes["onclick"] = "WinOpen('../Search.aspx?EnsName=" + en.No + "','dg' ); return false;";
            //else
            //    btn.Attributes["onclick"] = "WinOpen('SFTableEditData.aspx?RefNo=" + this.RefNo + "','dg' ); return false;";
            //this.Ucsys1.Add(btn);

            if (this.FromApp != "SL")
            {
                btn          = new Button();
                btn.ID       = "Btn_Add";
                btn.CssClass = "Btn";
                btn.Text     = "添加到表单";; // "添加到表单";
                btn.Attributes["onclick"] = " return confirm('您确认吗?');";
                btn.Click += new EventHandler(btn_Add_Click);
                if (this.RefNo == null)
                {
                    btn.Enabled = false;
                }
                this.Ucsys1.Add(btn);
            }

            btn          = new Button();
            btn.ID       = "Btn_Del";
            btn.CssClass = "Btn";
            btn.Text     = "删除";
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";
            if (this.RefNo == null)
            {
                btn.Enabled = false;
            }

            btn.Click += new EventHandler(btn_Del_Click);
            this.Ucsys1.Add(btn);
            this.Ucsys1.Add("</TD>");
            this.Ucsys1.AddTREnd();
            this.Ucsys1.AddTableEnd();

            //string help = "<ul>";
            //help += "<li>输入:新表名或已经存在的表名或者视图,必须是英文字母或者下划线。</li>";
            //help += "<li>如果该表或者视图已经存在本机中,系统就会把他注册到ccform的数据源(Sys_SFTable)里,您可以打开Sys_SFTable查看ccform对外部数据源管理的信息。</li>";
            //help += "<li>如果不存在ccform就会自动创建表,该表有No,Name两个列,并且初始化3笔数据,您可以对该表进行编辑。</li>";
            //help += "</ul>";
            //this.Ucsys1.AddFieldSet("帮助", help);
        }
예제 #5
0
        public void BindSFTable(SFTable en)
        {
            bool   isItem = false;
            string star   = "<font color=red><b>(*)</b></font>";

            this.Ucsys1.AddTable();

            #region 生成标题.
            if (this.FromApp == "SL")
            {
                if (this.RefNo == null)
                {
                    this.Ucsys1.AddCaption("新建WebService数据源接口");
                }
                else
                {
                    this.Ucsys1.AddCaption("编辑WebService数据源接口");
                }
            }
            else
            {
                this.Ucsys1.AddCaption("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'><img src='/WF/Img/Btn/Back.gif'>返回</a> - <a href='Do.aspx?DoType=AddSFWS&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>WebService数据源接口</a> - 新建WebService数据源接口");
            }

            if (this.RefNo == null)
            {
                this.Title = "新建WebService数据源接口";
            }
            else
            {
                this.Title = "编辑WebService数据源接口";
            }

            #endregion 生成标题.

            int idx = 0;
            this.Ucsys1.AddTR();
            this.Ucsys1.AddTDTitle("Idx");
            this.Ucsys1.AddTDTitle("项目");
            this.Ucsys1.AddTDTitle("采集");
            this.Ucsys1.AddTDTitle("备注");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("接口英文名称" + star);
            var tb = new BP.Web.Controls.TB();
            tb.ID   = "TB_" + SFTableAttr.No;
            tb.Text = en.No;
            if (this.RefNo == null)
            {
                tb.Enabled = true;
            }
            else
            {
                tb.Enabled = false;
            }

            if (tb.Text == "")
            {
                tb.Text = "SF_";
            }

            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTDBigDoc("必须以字母或者下划线开头,不能包含特殊字符。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("接口中文名称" + star);
            tb      = new BP.Web.Controls.TB();
            tb.ID   = "TB_" + SFTableAttr.Name;
            tb.Text = en.Name;
            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTD("WebService中的接口方法的中文名称。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("数据源" + star);
            BP.Web.Controls.DDL ddl  = new BP.Web.Controls.DDL();
            SFDBSrcs            srcs = new SFDBSrcs();
            BP.En.QueryObject   qo   = new QueryObject(srcs);
            qo.AddWhere(SFDBSrcAttr.DBSrcType, " = ", "100");
            qo.DoQuery();
            ddl.Bind(srcs, en.FK_SFDBSrc);
            ddl.ID                    = "DDL_" + SFTableAttr.FK_SFDBSrc;
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("选择数据源,点击这里<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=BP.Sys.SFDBSrcs')\">创建</a>,<a href='SFWS.aspx?DoType=New&MyPK=" + this.MyPK + "&Idx='>刷新</a>。");
            this.Ucsys1.AddTREnd();

            var rt = en.TableDesc.Split(',');

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("选择接口" + star);
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_" + SFTableAttr.TableDesc;

            if (srcs.Count > 0)
            {
                var ms = GetWebServiceMethods(!string.IsNullOrWhiteSpace(en.FK_SFDBSrc) ? (SFDBSrc)srcs.GetEntityByKey(SFDBSrcAttr.No, en.FK_SFDBSrc) : (SFDBSrc)srcs[0]);

                foreach (var m in ms)
                {
                    ddl.Items.Add(new ListItem(m.Value, m.Key));
                }

                ddl.SetSelectItem(rt.Length == 2 ? rt[0] : ms.Count > 0 ? ms.First().Key : string.Empty);
            }

            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTDBigDoc("选择WebService中的接口方法名。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("colspan=3", "接口参数定义" + star + "支持ccform表达式,允许有@WebUser.No,@WebUser.Name,@WebUser.FK_Dept变量。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            tb          = new BP.Web.Controls.TB();
            tb.ID       = "TB_" + SFTableAttr.SelectStatement;
            tb.Text     = en.SelectStatement;
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 3;
            tb.Columns  = 70;
            this.Ucsys1.AddTD("colspan=3", tb);
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("colspan=3", "如:WorkId=@WorkID&FK_Flow=@FK_Flow&FK_Node=@FK_Node&SearchType=1,带@的参数值在运行时自动使用发起流程的相关参数值替换,而不带@的参数值使用后面的赋值;参数个数与WebServices接口方法的参数个数一致,且顺序一致,且值均为字符类型。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("返回值类型" + star);
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_ResultType";

            ddl.Items.Add(new ListItem("DataTable数据表", "DataTable"));
            ddl.Items.Add(new ListItem("DataSet数据集", "DataSet"));
            ddl.Items.Add(new ListItem("Json字符串", "Json"));
            ddl.Items.Add(new ListItem("Xml字符串", "Xml"));

            if (rt.Length == 2)
            {
                ddl.SetSelectItem(rt[1]);
            }

            this.Ucsys1.AddTDBegin();
            this.Ucsys1.Add(ddl);
            this.Ucsys1.AddBR();
            this.Ucsys1.Add("注意:所有返回值类型都需有No,Name这两列。" +
                            "<script type='text/javascript'>" +
                            "   var info = '1. DataTable数据表,必须为DataTable命名。\\n" +
                            "2. DataSet数据集,只取数据集里面的第1个DataTable。\\n" +
                            "3. Json字符串,格式如:\\n" +
                            "[\\n" +
                            "  {\"No\":\"001\",\"Name\":\"生产部\"},\\n" +
                            "  {\"No\":\"002\",\"Name\":\"研发部\"},\\n" +
                            "  ...\\n" +
                            "]\\n" +
                            "4. Xml字符串,格式如:\\n" +
                            "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n" +
                            "<Array>\\n" +
                            "  <Item>\\n" +
                            "    <No>001</No>\\n" +
                            "    <Name>生产部</Name>\\n" +
                            "  </Item>\\n" +
                            "  <Item>\\n" +
                            "    <No>002</No>\\n" +
                            "    <Name>研发部</Name>\\n" +
                            "  </Item>\\n" +
                            "  ...\\n" +
                            "</Array>';" +
                            "</script>" +
                            "<a href='javascript:void(0)' onclick='alert(info)'>格式说明</a>");
            this.Ucsys1.AddTDEnd();
            this.Ucsys1.AddTDBigDoc("选择WebService中的接口方法返回值的类型。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("返回数据结构");
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_" + SFTableAttr.CodeStruct;
            ddl.BindSysEnum(SFTableAttr.CodeStruct, (int)en.CodeStruct);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("WebService接口返回的数据结构,用于在下拉框中不同格式的展现。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.Add("<TD colspan=3 align=center>");
            Button btn = new Button();
            btn.ID       = "Btn_Save";
            btn.CssClass = "Btn";
            if (this.RefNo == null)
            {
                btn.Text = "创建";
            }
            else
            {
                btn.Text = "保存";
            }
            btn.Click += new EventHandler(btn_Save_Click);
            this.Ucsys1.Add(btn);

            if (this.FromApp != "SL")
            {
                btn          = new Button();
                btn.ID       = "Btn_Add";
                btn.CssClass = "Btn";
                btn.Text     = "添加到表单";; // "添加到表单";
                btn.Attributes["onclick"] = " return confirm('您确认吗?');";
                btn.Click += new EventHandler(btn_Add_Click);
                if (this.RefNo == null)
                {
                    btn.Enabled = false;
                }
                this.Ucsys1.Add(btn);
            }

            btn          = new Button();
            btn.ID       = "Btn_Del";
            btn.CssClass = "Btn";
            btn.Text     = "删除";
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";
            if (this.RefNo == null)
            {
                btn.Enabled = false;
            }

            btn.Click += new EventHandler(btn_Del_Click);
            this.Ucsys1.Add(btn);
            this.Ucsys1.Add("</TD>");
            this.Ucsys1.AddTREnd();
            this.Ucsys1.AddTableEnd();
        }
예제 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string   rpt   = "ND" + int.Parse(this.FK_Flow) + "Rpt";
            MapAttrs attrs = new MapAttrs(rpt);

            Flow fl = new Flow(this.FK_Flow);

            fl.RetrieveFromDBSources();

            fl.No = this.FK_Flow;
            if (string.IsNullOrEmpty(this.TableName) == true)
            {
                this.Pub1.AddFieldSet("配置错误", "请关闭该窗口,在流程属性里配置业务表名,然后点保存按钮,之后打开该功能界面。");
                return;
            }

            //获得数据表列.
            SFDBSrc   src = new SFDBSrc(this.FK_DBSrc);
            DataTable dt  = src.GetColumns(this.TableName);

            foreach (DataRow dr in dt.Rows)
            {
                string fType = dr["DBType"].ToString();
                string desc  = dr["Name"].ToString();

                dr["Name"] = dr["No"] + " " + dr["DBType"] + "(" + dr["DBLength"] + ") " + dr["Name"];
            }

            this.Pub1.AddTable();
            this.Pub1.AddCaptionLeft("请设置流程字段与业务表字段的同步映射");
            this.Pub1.AddTR();

            string textCenter = " style='text-align:center;'";

            this.Pub1.AddTDTitle(textCenter, "序");
            this.Pub1.AddTDTitle(textCenter, "是否同步");
            this.Pub1.AddTDTitle(textCenter, "类型");
            this.Pub1.AddTDTitle(textCenter, "业务表(" + fl.DTSBTable + ")");
            this.Pub1.AddTREnd();

            int       idx = 0;
            Hashtable ht  = new Hashtable();

            if (string.IsNullOrEmpty(fl.DTSFields))
            {
                fl.DTSFields = "@";
            }

            string[] fieldArr = fl.DTSFields.Split('@');
            string[] lcArr    = fieldArr[0].Split(',');
            string[] ywArr    = fieldArr[1].Split(',');

            for (int i = 0; i < lcArr.Length; i++)
            {
                ht.Add(lcArr[i], ywArr[i]);
            }


            #region 锁定workid 在第一行上.

            //guid workid必须选择一项
            BP.Web.Controls.RadioBtn rb_workId = new BP.Web.Controls.RadioBtn();
            rb_workId.ID        = "rb_workId";
            rb_workId.GroupName = "RB_KEY";
            rb_workId.Text      = "OID - WorkID";

            BP.Web.Controls.RadioBtn rb_guid = new BP.Web.Controls.RadioBtn();
            rb_guid.ID        = "rb_guid";
            rb_guid.GroupName = "RB_KEY";
            rb_guid.Text      = "GUID";

            foreach (DictionaryEntry de in ht)
            {
                if (de.Key.ToString().ToUpper() == "OID")
                {
                    rb_workId.Checked = true;
                }
                else
                {
                    rb_guid.Checked = true;
                }
            }

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx("1");

            this.Pub1.AddTDBegin();
            this.Pub1.Add(rb_workId);
            this.Pub1.Add(rb_guid);
            this.Pub1.AddTDEnd();

            this.Pub1.AddTD("主键<img src='../../Img/PRI/2.png' border=0/>");

            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.Width = 250;
            ddl.ID    = "DDL_OID";

            ddl.Bind(dt, dt.Columns["No"].ToString(), dt.Columns["Name"].ToString());
            ddl.SetSelectItem(fl.DTSBTablePK);

            this.Pub1.AddTD(textCenter, ddl);
            this.Pub1.AddTREnd();
            #endregion 锁定workid 在第一行上.


            bool is1 = false;
            foreach (MapAttr attr in attrs)
            {
                if (attr.KeyOfEn.ToUpper() == "OID" || attr.KeyOfEn.ToUpper() == "GUID")
                {
                    continue;
                }

                idx++;

                is1 = this.Pub1.AddTR(is1);

                this.Pub1.AddTDIdx(idx);

                CheckBox cb = new CheckBox();
                cb.ID   = "CB_" + attr.KeyOfEn;
                cb.Text = attr.KeyOfEn + " - " + attr.Name;

                foreach (DictionaryEntry de in ht)
                {
                    if (attr.KeyOfEn == de.Key.ToString())
                    {
                        cb.Checked = true;
                    }
                }

                this.Pub1.AddTD(cb);
                this.Pub1.AddTD(attr.MyDataTypeStr);

                ddl       = new BP.Web.Controls.DDL();
                ddl.ID    = "DDL_" + attr.KeyOfEn;
                ddl.Width = 250;

                ddl.Bind(dt, dt.Columns["No"].ToString(), dt.Columns["Name"].ToString());

                if (cb.Checked == true)
                {
                    try
                    {
                        ddl.SetSelectItem(ht[attr.KeyOfEn].ToString());
                    }
                    catch
                    {
                    }
                }

                //类似的默认选中  区分大小写  方法if(ddl.SetSelectItem(attr.KeyOfEn)){cb.Checked = true;}不适用
                foreach (DataRow dr in dt.Rows)
                {
                    if (attr.KeyOfEn.ToUpper() == dr[0].ToString().ToUpper())
                    {
                        ddl.SetSelectItem(dr[0].ToString());
                        cb.Checked = true;
                        break;
                    }
                }

                this.Pub1.AddTD(textCenter, ddl);
                this.Pub1.AddTREnd();
            }


            this.Pub1.AddTableEnd();

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

            Button btn = new Button();
            btn.ID   = "Btn_Save";
            btn.Text = "保存";

            btn.Click += new EventHandler(btn_Save_Click);

            Button btnClose = new Button();
            btnClose.ID     = "Btn_Close";
            btnClose.Text   = "取消";
            btnClose.Click += new EventHandler(btnClose_Click);

            this.Pub1.Add(btn);
            this.Pub1.Add(btnClose);

            this.Pub1.AddBR();
            this.Pub1.AddBR();
            this.Pub1.AddBR();
        }