public void EditBeforeAdd(MapAttr mapAttr)
        {
            this.Pub1.AddTable();
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("ID");
            this.Pub1.AddTDTitle("项目");
            this.Pub1.AddTDTitle("采集");
            this.Pub1.AddTDTitle("备注");
            this.Pub1.AddTREnd();

            if (mapAttr.IsTableAttr)
            {
                /* if here is table attr, It's will let use can change data type. */
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx++);
                this.Pub1.AddTD("改变数据类型");
                DDL ddlType = new DDL();
                ddlType.ID = "DDL_DTType";
                BP.Sys.XML.SysDataTypes xmls = new BP.Sys.XML.SysDataTypes();
                xmls.RetrieveAll();
                ddlType.Bind(xmls, "No", "Name");
                ddlType.SetSelectItem(mapAttr.MyDataTypeS);

                ddlType.AutoPostBack          = true;
                ddlType.SelectedIndexChanged += new EventHandler(ddlType_SelectedIndexChanged);

                this.Pub1.AddTD(ddlType);
                this.Pub1.AddTD("");
                this.Pub1.AddTREnd();
            }

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("字段中文名称");
            TB tb = new TB();

            tb.ID   = "TB_Name";
            tb.Text = mapAttr.Name;
            tb.Attributes["width"] = "100%";

            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("字段英文名");
            tb      = new TB();
            tb.ID   = "TB_KeyOfEn";
            tb.Text = mapAttr.KeyOfEn;
            if (this.RefNo != null)
            {
                tb.Enabled = false;
            }

            tb.Attributes["onkeyup"] = "return IsDigit(this);";
            this.Pub1.AddTD(tb);

            if (string.IsNullOrEmpty(mapAttr.KeyOfEn))
            {
                this.Pub1.AddTD("字母/数字/下划线组合");
            }
            else
            {
                this.Pub1.AddTD("<a href=\"javascript:clipboardData.setData('Text','" + mapAttr.KeyOfEn + "');alert('已经copy到粘帖版上');\" ><img src='../Img/Btn/Copy.gif' class='ICON' />复制字段名</a></TD>");
            }

            this.Pub1.AddTREnd();


            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("默认值");
            tb      = new TB();
            tb.ID   = "TB_DefVal";
            tb.Text = mapAttr.DefValReal;


            switch (this.FType)
            {
            case BP.DA.DataType.AppDouble:
            case BP.DA.DataType.AppInt:
            case BP.DA.DataType.AppFloat:
                this.Pub1.AddTDNum(tb);
                tb.ShowType = TBType.Num;
                tb.Text     = mapAttr.DefVal;
                if (tb.Text == "")
                {
                    tb.Text = "0";
                }
                break;

            case BP.DA.DataType.AppMoney:
            case BP.DA.DataType.AppRate:
                this.Pub1.AddTDNum(tb);
                tb.ShowType = TBType.Moneny;
                break;

            default:
                this.Pub1.AddTD(tb);
                break;
            }

            tb.ShowType = mapAttr.HisTBType;
            switch (this.FType)
            {
            case DataType.AppDateTime:
            case DataType.AppDate:
                CheckBox cb = new CheckBox();
                cb.Text = "默认系统当前日期";
                cb.ID   = "CB_DefVal";
                if (mapAttr.DefValReal == "@RDT")
                {
                    cb.Checked = true;
                }
                else
                {
                    cb.Checked = false;
                }
                cb.AutoPostBack    = true;
                cb.CheckedChanged += new EventHandler(cb_CheckedChanged_rdt);
                this.Pub1.AddTD(cb);
                break;

            case DataType.AppString:
                DDL ddl = new DDL();
                ddl.AutoPostBack = true;

                BP.WF.XML.DefVals vals = new BP.WF.XML.DefVals();
                vals.Retrieve("Lang", WebUser.SysLang);
                foreach (BP.WF.XML.DefVal def in vals)
                {
                    ddl.Items.Add(new ListItem(def.Name, def.Val));
                }

                //ddl.Items.Add(new ListItem("选择系统约定默认值", ""));
                //ddl.Items.Add(new ListItem("操作员编号", "@WebUser.No"));
                //ddl.Items.Add(new ListItem("操作员名称", "@WebUser.Name"));
                //ddl.Items.Add(new ListItem("隶属部门编号", "@WebUser.FK_Dept"));
                //ddl.Items.Add(new ListItem("隶属部门名称", "@WebUser.FK_DeptName"));

                //ddl.Items.Add(new ListItem("当前日期-1", "@yyyy年mm月dd日"));
                //ddl.Items.Add(new ListItem("当前日期-2", "@yy年mm月dd日"));

                //ddl.Items.Add(new ListItem("当前年度", "@FK_ND"));
                //ddl.Items.Add(new ListItem("当前月份", "@FK_YF"));

                ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged_DefVal);
                ddl.SetSelectItem(mapAttr.DefValReal);
                ddl.ID = "DDL_SelectDefVal";
                this.Pub1.AddTD(ddl);
                break;

            default:
                this.Pub1.AddTD("&nbsp;");
                break;
            }
            this.Pub1.AddTREnd();

            #region 是否可以为空.
            switch (this.FType)
            {
            case BP.DA.DataType.AppDouble:
            case BP.DA.DataType.AppInt:
            case BP.DA.DataType.AppFloat:
            case BP.DA.DataType.AppMoney:
            case BP.DA.DataType.AppRate:
                idx++;
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx);
                this.Pub1.AddTD("是否可以为空");
                DDL ddlIsNull = new DDL();
                ddlIsNull.Items.Add(new ListItem("不能为空,按照默认值计算.", "0"));
                ddlIsNull.Items.Add(new ListItem("可以为空,与默认值无关.", "1"));
                ddlIsNull.ID = "DDL_IsNull";

                if (mapAttr.MinLen == 0)
                {
                    ddlIsNull.SetSelectItem(0);
                }
                else
                {
                    ddlIsNull.SetSelectItem(1);
                }

                this.Pub1.AddTD("colspan=2", ddlIsNull);
                this.Pub1.AddTREnd();
                break;

            default:
                break;
            }
            #endregion 是否可以为空.


            RadioButton rb = new RadioButton();
            if (MapData.IsEditDtlModel == false)
            {
                //this.Pub1.AddTR();
                //this.Pub1.AddTD("界面上是否可见");
                //this.Pub1.Add("<TD>");
                //rb = new RadioButton();
                //rb.ID = "RB_UIVisible_0";
                //rb.Text = "不 可 见";
                //rb.GroupName = "s1";
                //if (mapAttr.UIVisible)
                //    rb.Checked = false;
                //else
                //    rb.Checked = true;
                //this.Pub1.Add(rb);

                //rb = new RadioButton();
                //rb.ID = "RB_UIVisible_1";
                //rb.Text = "可见 ";
                //rb.GroupName = "s1";

                //if (mapAttr.UIVisible)
                //    rb.Checked = true;
                //else
                //    rb.Checked = false;
                //this.Pub1.Add(rb);
                //this.Pub1.Add("</TD>");
                //this.Pub1.AddTD("控制是否显示在页面上");
                //this.Pub1.AddTREnd();
            }

            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("是否可编辑");
            this.Pub1.Add("<TD>");


            rb           = new RadioButton();
            rb.ID        = "RB_UIIsEnable_0";
            rb.Text      = "不可编辑";
            rb.GroupName = "s";
            rb.Checked   = !mapAttr.UIIsEnable;

            this.Pub1.Add(rb);
            rb           = new RadioButton();
            rb.ID        = "RB_UIIsEnable_1";
            rb.Text      = "可编辑";
            rb.GroupName = "s";
            rb.Checked   = mapAttr.UIIsEnable;

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

            #region 是否可界面可见
            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("是否界面可见"); //是否界面可见
            this.Pub1.AddTDBegin();
            rb           = new RadioButton();
            rb.ID        = "RB_UIVisible_0";
            rb.Text      = "不可见"; // 界面不可见
            rb.GroupName = "sa3";
            if (mapAttr.UIVisible)
            {
                rb.Checked = false;
            }
            else
            {
                rb.Checked = true;
            }

            this.Pub1.Add(rb);
            if (mapAttr.IsTableAttr)
            {
                rb.Enabled = false;
            }

            rb           = new RadioButton();
            rb.ID        = "RB_UIVisible_1";
            rb.Text      = "界面可见"; // 界面可见;
            rb.GroupName = "sa3";

            if (mapAttr.UIVisible)
            {
                rb.Checked = true;
            }
            else
            {
                rb.Checked = false;
            }

            if (mapAttr.IsTableAttr)
            {
                rb.Enabled = false;
            }

            this.Pub1.Add(rb);
            this.Pub1.AddTDEnd();

            this.Pub1.AddTD("不可见则为隐藏字段.");
            //   this.Pub1.AddTD("控制该它在表单的界面里是否可见");
            this.Pub1.AddTREnd();
            #endregion 是否可界面可见
        }
Пример #2
0
        public void EditBeforeAdd(MapAttr mapAttr)
        {
            this.Pub1.AddTable();
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("ID");
            this.Pub1.AddTDTitle("项目");
            this.Pub1.AddTDTitle("采集");
            this.Pub1.AddTDTitle("备注");
            this.Pub1.AddTREnd();

            if (mapAttr.IsTableAttr)
            {
                /* if here is table attr, It's will let use can change data type. */
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx++);
                this.Pub1.AddTD("改变数据类型");
                DDL ddlType = new DDL();
                ddlType.ID = "DDL_DTType";
                BP.Sys.XML.SysDataTypes xmls = new BP.Sys.XML.SysDataTypes();
                xmls.RetrieveAll();
                ddlType.Bind(xmls, "No", "Name");
                ddlType.SetSelectItem(mapAttr.MyDataTypeS);

                ddlType.AutoPostBack          = true;
                ddlType.SelectedIndexChanged += new EventHandler(ddlType_SelectedIndexChanged);

                this.Pub1.AddTD(ddlType);
                this.Pub1.AddTD("");
                this.Pub1.AddTREnd();
            }

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("字段英文名称");
            TB tb = new TB();

            tb.ID   = "TB_KeyOfEn";
            tb.Text = mapAttr.KeyOfEn;
            if (this.RefNo != null)
            {
                tb.Enabled = false;
            }

            tb.Attributes["onkeyup"] = "return IsDigit(this);";


            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("字母或者字母数字组合");
            this.Pub1.AddTREnd();


            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("字段中文名称");
            tb      = new TB();
            tb.ID   = "TB_Name";
            tb.Text = mapAttr.Name;
            tb.Attributes["width"] = "100%";

            this.Pub1.AddTD(tb);
            this.Pub1.AddTD("");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("默认值");
            tb      = new TB();
            tb.ID   = "TB_DefVal";
            tb.Text = mapAttr.DefValReal;

            // tb.Width = 20;

            switch (this.FType)
            {
            case BP.DA.DataType.AppDouble:
            case BP.DA.DataType.AppInt:
            case BP.DA.DataType.AppFloat:
                this.Pub1.AddTDNum(tb);
                tb.ShowType = TBType.Num;
                tb.Text     = mapAttr.DefVal;
                if (tb.Text == "")
                {
                    tb.Text = "0";
                }
                break;

            case BP.DA.DataType.AppMoney:
            case BP.DA.DataType.AppRate:
                this.Pub1.AddTDNum(tb);
                tb.ShowType = TBType.Moneny;
                break;

            default:
                this.Pub1.AddTD(tb);
                break;
            }

            tb.ShowType = mapAttr.HisTBType;
            switch (this.FType)
            {
            case DataType.AppDateTime:
            case DataType.AppDate:
                CheckBox cb = new CheckBox();
                cb.Text = "默认系统当前日期";
                cb.ID   = "CB_DefVal";
                if (mapAttr.DefValReal == "@RDT")
                {
                    cb.Checked = true;
                }
                else
                {
                    cb.Checked = false;
                }
                cb.AutoPostBack    = true;
                cb.CheckedChanged += new EventHandler(cb_CheckedChanged_rdt);
                this.Pub1.AddTD(cb);
                break;

            case DataType.AppString:
                DDL ddl = new DDL();
                ddl.AutoPostBack = true;

                BP.WF.XML.DefVals vals = new BP.WF.XML.DefVals();
                vals.Retrieve("Lang", WebUser.SysLang);
                foreach (BP.WF.XML.DefVal def in vals)
                {
                    ddl.Items.Add(new ListItem(def.Name, def.Val));
                }

                //ddl.Items.Add(new ListItem("选择系统约定默认值", ""));
                //ddl.Items.Add(new ListItem("操作员编号", "@WebUser.No"));
                //ddl.Items.Add(new ListItem("操作员名称", "@WebUser.Name"));
                //ddl.Items.Add(new ListItem("操作员部门编号", "@WebUser.FK_Dept"));
                //ddl.Items.Add(new ListItem("操作员部门名称", "@WebUser.FK_DeptName"));

                //ddl.Items.Add(new ListItem("当前日期-1", "@yyyy年mm月dd日"));
                //ddl.Items.Add(new ListItem("当前日期-2", "@yy年mm月dd日"));

                //ddl.Items.Add(new ListItem("当前年度", "@FK_ND"));
                //ddl.Items.Add(new ListItem("当前月份", "@FK_YF"));

                ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged_DefVal);
                ddl.SetSelectItem(mapAttr.DefValReal);
                ddl.ID = "DDL_SelectDefVal";
                this.Pub1.AddTD(ddl);
                break;

            default:
                this.Pub1.AddTD("&nbsp;");
                break;
            }
            this.Pub1.AddTREnd();

            RadioButton rb = new RadioButton();

            if (MapData.IsEditDtlModel == false)
            {
                //this.Pub1.AddTR();
                //this.Pub1.AddTD("界面上是否可见");
                //this.Pub1.Add("<TD>");
                //rb = new RadioButton();
                //rb.ID = "RB_UIVisible_0";
                //rb.Text = "不 可 见";
                //rb.GroupName = "s1";
                //if (mapAttr.UIVisible)
                //    rb.Checked = false;
                //else
                //    rb.Checked = true;
                //this.Pub1.Add(rb);

                //rb = new RadioButton();
                //rb.ID = "RB_UIVisible_1";
                //rb.Text = "可见 ";
                //rb.GroupName = "s1";

                //if (mapAttr.UIVisible)
                //    rb.Checked = true;
                //else
                //    rb.Checked = false;
                //this.Pub1.Add(rb);
                //this.Pub1.Add("</TD>");
                //this.Pub1.AddTD("控制是否显示在页面上");
                //this.Pub1.AddTREnd();
            }

            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("是否可编辑");
            this.Pub1.Add("<TD>");

            rb           = new RadioButton();
            rb.ID        = "RB_UIIsEnable_0";
            rb.Text      = "不可编辑";
            rb.GroupName = "s";
            rb.Checked   = !mapAttr.UIIsEnable;

            this.Pub1.Add(rb);
            rb           = new RadioButton();
            rb.ID        = "RB_UIIsEnable_1";
            rb.Text      = "可编辑";
            rb.GroupName = "s";
            rb.Checked   = mapAttr.UIIsEnable;

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


            #region 是否可单独行显示
            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("呈现方式"); //呈现方式;
            this.Pub1.AddTDBegin();
            rb           = new RadioButton();
            rb.ID        = "RB_UIIsLine_0";
            rb.Text      = "两列显示"; // 两行
            rb.GroupName = "sa";
            if (mapAttr.UIIsLine)
            {
                rb.Checked = false;
            }
            else
            {
                rb.Checked = true;
            }

            this.Pub1.Add(rb);
            rb           = new RadioButton();
            rb.ID        = "RB_UIIsLine_1";
            rb.Text      = "整行显示"; // "一行";
            rb.GroupName = "sa";

            if (mapAttr.UIIsLine)
            {
                rb.Checked = true;
            }
            else
            {
                rb.Checked = false;
            }

            this.Pub1.Add(rb);
            this.Pub1.AddTDEnd();
            this.Pub1.AddTD("对傻瓜表单有效");


            // this.Pub1.AddTD("控制该它在表单的显示方式");
            this.Pub1.AddTREnd();
            #endregion 是否可编辑


            #region 是否可界面可见
            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("是否界面可见");   //是否界面可见
            this.Pub1.AddTDBegin();
            rb           = new RadioButton();
            rb.ID        = "RB_UIVisible_0";
            rb.Text      = "不可见"; // 界面不可见
            rb.GroupName = "sa3";
            if (mapAttr.UIVisible)
            {
                rb.Checked = false;
            }
            else
            {
                rb.Checked = true;
            }

            this.Pub1.Add(rb);
            if (mapAttr.IsTableAttr)
            {
                rb.Enabled = false;
            }

            rb           = new RadioButton();
            rb.ID        = "RB_UIVisible_1";
            rb.Text      = "界面可见"; // 界面可见;
            rb.GroupName = "sa3";

            if (mapAttr.UIVisible)
            {
                rb.Checked = true;
            }
            else
            {
                rb.Checked = false;
            }

            if (mapAttr.IsTableAttr)
            {
                rb.Enabled = false;
            }

            this.Pub1.Add(rb);
            this.Pub1.AddTDEnd();

            this.Pub1.AddTD("不可见则为隐藏字段.");
            //   this.Pub1.AddTD("控制该它在表单的界面里是否可见");
            this.Pub1.AddTREnd();
            #endregion 是否可界面可见
        }