public void BindAdv() { EnsAppCfgs ens = new EnsAppCfgs(); ens.Retrieve(EnsAppCfgAttr.EnsName, this.EnsName); if (ens.Count == 0) { this.UCSys1.AddMsgOfInfo("提示:", "没有设置应用程序配置。"); return; } this.UCSys1.AddTable("width=100%"); if (BP.Web.WebUser.No == "admin") { this.UCSys1.AddCaptionLeftTX("<a href='?EnsName=" + this.EnsName + "'>基本设置</a> - <a href='?EnsName=" + this.EnsName + "&DoType=Adv'>高级设置</a> - <a href='EnsDataIO.aspx?EnsName=" + this.EnsName + "' >导入导出</a>"); } else { this.UCSys1.AddCaptionLeftTX("基本设置"); } this.UCSys1.AddTR(); this.UCSys1.AddTDTitle("配置项"); this.UCSys1.AddTDTitle("内容"); this.UCSys1.AddTDTitle("信息"); this.UCSys1.AddTREnd(); Entity en1 = BP.DA.ClassFactory.GetEns(this.EnsName).GetNewEntity; Attrs attrs = en1.EnMap.HisCfgAttrs; bool is1 = false; foreach (Attr attr in attrs) { if (attr.IsRefAttr) { continue; } EnsAppCfg en = ens.GetEntityByKey(EnsAppCfgAttr.CfgKey, attr.Key) as EnsAppCfg; is1 = this.UCSys1.AddTR(is1); this.UCSys1.AddTD(attr.Key); this.UCSys1.AddTD(attr.Desc); switch (attr.UIContralType) { case UIContralType.DDL: BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL(); ddl.ID = "DDL_" + attr.Key; SysEnums ses = new SysEnums(attr.Key, attr.UITag); ddl.BindSysEnum(attr.Key); if (en == null) { ddl.SetSelectItem(attr.DefaultVal.ToString()); } else { ddl.SetSelectItem(en.CfgValOfInt); } this.UCSys1.AddTD(ddl); break; case UIContralType.CheckBok: CheckBox cb = new CheckBox(); cb.ID = "CB_" + attr.Key; cb.Text = attr.Desc; if (en == null) { if (attr.DefaultVal.ToString() == "0") { cb.Checked = false; } else { cb.Checked = true; } } else { cb.Checked = en.CfgValOfBoolen; } this.UCSys1.AddTD(cb); break; default: TextBox tb = new TextBox(); tb.ID = "TB_" + attr.Key; if (en == null) { tb.Text = attr.DefaultVal.ToString(); } else { tb.Text = en.CfgVal; } tb.Attributes["width"] = "100%"; this.UCSys1.AddTD(tb); break; } this.UCSys1.AddTREnd(); } this.UCSys1.AddTableEnd(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = "保存"; btn.Click += new EventHandler(btn_Click); this.UCSys1.Add(btn); btn = new Button(); btn.ID = "Btn_SaveAndClose"; btn.CssClass = "Btn"; btn.Text = "保存并关闭"; btn.Click += new EventHandler(btn_Click); this.UCSys1.Add(btn); }
public void BindNormal() { EnsAppCfgs ens = new EnsAppCfgs(); ens.Retrieve(EnsAppCfgAttr.EnsName, this.EnsName); EnsAppXmls xmls = new EnsAppXmls(); xmls.Retrieve(EnsAppCfgAttr.EnsName, this.EnsName); this.UCSys1.AddTable("width=100%"); if (BP.Web.WebUser.No == "admin") { this.UCSys1.AddCaptionLeftTX("<a href='?EnsName=" + this.EnsName + "'>基本设置</a> - <a href='?EnsName=" + this.EnsName + "&DoType=Adv'>高级设置</a> - <a href='EnsDataIO.aspx?EnsName=" + this.EnsName + "' >导入导出</a>"); } else { this.UCSys1.AddCaptionLeftTX("基本设置"); } this.UCSys1.AddTR(); this.UCSys1.AddTR(); this.UCSys1.AddTDTitle("配置项"); this.UCSys1.AddTDTitle("内容"); this.UCSys1.AddTDTitle("信息"); this.UCSys1.AddTDTitle("备注"); //this.UCSys1.AddTDTitle("配置项"); //this.UCSys1.AddTDTitle("内容"); //this.UCSys1.AddTDTitle("信息"); //this.UCSys1.AddTDTitle("备注"); this.UCSys1.AddTREnd(); bool is1 = false; foreach (EnsAppXml xml in xmls) { EnsAppCfg en = ens.GetEntityByKey(EnsAppCfgAttr.CfgKey, xml.No) as EnsAppCfg; is1 = this.UCSys1.AddTR(is1); this.UCSys1.AddTD(xml.No); this.UCSys1.AddTD(xml.Name); switch (xml.DBType) { case "Enum": BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL(); ddl.ID = "DDL_" + xml.No; SysEnums ses = new SysEnums(xml.EnumKey, xml.EnumVals); ddl.BindSysEnum(xml.EnumKey); if (en == null) { ddl.SetSelectItem(xml.DefValInt); } else { ddl.SetSelectItem(en.CfgValOfInt); } this.UCSys1.AddTD(ddl); break; case "Boolen": CheckBox cb = new CheckBox(); cb.ID = "CB_" + xml.No; cb.Text = xml.Name; if (en == null) { cb.Checked = xml.DefValBoolen; } else { cb.Checked = en.CfgValOfBoolen; } this.UCSys1.AddTD(cb); break; default: TextBox tb = new TextBox(); tb.ID = "TB_" + xml.No; if (en == null) { tb.Text = xml.DefVal; } else { tb.Text = en.CfgVal; } tb.Attributes["width"] = "100%"; this.UCSys1.AddTD(tb); break; } this.UCSys1.AddTDBigDoc(xml.Desc); this.UCSys1.AddTREnd(); } if (xmls.Count == 0) { this.UCSys1.AddTableEnd(); return; } this.UCSys1.AddTableEnd(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = "保存"; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_Click); this.UCSys1.Add(btn); btn = new Button(); btn.ID = "Btn_SaveAndClose"; btn.CssClass = "Btn"; btn.Text = "保存并关闭"; btn.Click += new EventHandler(btn_Click); this.UCSys1.Add(btn); }