protected void Btn_OK_Click(object sender, EventArgs e) { Entities ens = DA.ClassFactory.GetEns(this.Request.QueryString["EnsName"]); ens.RetrieveAll(); foreach (Entity en in ens) { RadioBtn rb = (RadioBtn)this.UCSys1.FindControl("RB_" + en.GetValStringByKey(this.RefKey)); if (rb.Checked == false) { continue; } string val = en.GetValStringByKey(this.RefKey); string ddl = this.Request.QueryString["DDLID"]; if (ddl != null) { /* */ // ddl = ddl.Replace("DDL_"); string mainEns = this.Request.QueryString["MainEns"]; BP.Sys.UserRegedit ur = new UserRegedit(WebUser.No, mainEns + "_SearchAttrs"); string cfgval = ur.Vals; int idx = cfgval.IndexOf(ddl + "="); string start = cfgval.Substring(0, idx); string end = cfgval.Substring(idx); end = end.Substring(end.IndexOf("@")); ur.Vals = start + val + end; ur.Update(); } string clientscript = "<script language='javascript'> window.returnValue = '" + val + "'; window.close(); </script>"; this.Page.Response.Write(clientscript); return; } }
public void SetDGData() { if (this.IsPostBack == false) { this.Ucsys1.AddBR(); this.Ucsys1.AddMsgOfInfo("<img src='/WF/Img/Btn/help.gif' border=0 />使用帮助:", " <BR><BR>1、请输入要查找的关键字,关键字模糊匹配任何字段。<BR><BR>2、组织好查询条件。<BR><BR>3、按确定按钮,完成查找。<BR><BR>4、双点击您所选择的记录完成数据选择。<BR><BR>5、为了提高效率,系统显示前100个。<BR><BR>"); return; } this.UcTitle.Clear(); this.Ucsys1.Clear(); this.Ucsys2.Clear(); string key = this.TextBox1.Text.Trim(); if (key == "" || key == null) { this.Ucsys1.AddMsgOfWarning("请输入关键字", null); return; } string FK_Dept = this.DropDownList1.SelectedValue; this.UcTitle.Add(this.GenerLabelStr("提示:双击您选择的记录,完成选择操作。")); this.Ucsys1.AddTable(); this.Ucsys1.AddTR(); this.Ucsys1.AddTDTitle("序号"); this.Ucsys1.AddTDTitle("选择"); this.Ucsys1.AddTDTitle("地址"); this.Ucsys1.AddTDTitle("法人"); this.Ucsys1.AddTDTitle("电话"); this.Ucsys1.AddTREnd(); string like_Dept = "'%'||:FK_Dept||'%'"; string like = "'%'||:key||'%'"; string sql = "SELECT No,Name,Addr, FR, Tel FROM DS_Taxpayer WHERE (FK_Dept LIKE " + like_Dept + ") AND ( No LIKE " + like + " OR Name LIKE " + like + " OR FR LIKE " + like + ") AND rownum <=100 "; BP.DA.Paras ps = new Paras(); ps.SQL = sql; ps.Add("FK_Dept", FK_Dept); ps.Add("key", key); System.Data.DataTable dt = DBAccess.RunSQLReturnTable(ps); string keyval = this.TextBox1.Text; string keyvalRed = "<font color=red>" + this.TextBox1.Text + "</font>"; int i = 0; foreach (DataRow dr in dt.Rows) { this.Ucsys1.AddTRTX(); this.Ucsys1.AddTDIdx(i++); BP.Web.Controls.RadioBtn rb = new RadioBtn(); rb.ID = "RB_" + dr["No"].ToString(); string text = dr["No"].ToString() + dr["Name"].ToString(); rb.Text = text.Replace(keyval, keyvalRed); rb.GroupName = "s"; string clientscript = "window.returnValue = '" + dr["No"].ToString() + "';window.close();"; // rb.Attributes["ondblclick"] = clientscript; rb.Attributes["ondblclick"] = clientscript; this.Ucsys1.AddTD("TD", rb); this.Ucsys1.AddTD(dr["Addr"].ToString().Replace(keyval, keyvalRed)); this.Ucsys1.AddTD(dr["FR"].ToString().Replace(keyval, keyvalRed)); this.Ucsys1.AddTD(dr["Tel"].ToString().Replace(keyval, keyvalRed)); this.Ucsys1.AddTREnd(); } this.Ucsys1.AddTableEnd(); //QueryObject qo = new QueryObject(ens); //qo = this.BPToolBar1.GetnQueryObject(ens, en); //string url = this.Request.RawUrl; //if (url.IndexOf("PageIdx") != -1) // url = url.Substring(0, url.IndexOf("PageIdx") - 1); //this.Ucsys2.BindPageIdx(qo.GetCOUNT(), SystemConfig.PageSize, pageIdx, url); //qo.DoQuery(en.PK, SystemConfig.PageSize, pageIdx); //this.Ucsys1.AddTable(); //this.Ucsys1.AddTR(); //this.Ucsys1.AddTDTitle("序号"); //this.Ucsys1.AddTDTitle("选择"); //this.Ucsys1.AddTDTitle("地址"); //this.Ucsys1.AddTDTitle("法人"); //this.Ucsys1.AddTDTitle("电话"); //this.Ucsys1.AddTREnd(); //int i = 1; //foreach (Entity en1 in ens) //{ // this.Ucsys1.AddTRTX(); // this.Ucsys1.AddTDIdx(i++); // BP.Web.Controls.RadioBtn rb = new RadioBtn(); // rb.ID = "RB_" + en1.GetValStrByKey("No"); // rb.Text = en1.GetValStrByKey("No") + en1.GetValStrByKey("Name"); // rb.GroupName = "s"; // string clientscript = "window.returnValue = '" + en1.GetValStringByKey("No") + "';window.close();"; // // rb.Attributes["ondblclick"] = clientscript; // rb.Attributes["ondblclick"] = clientscript; // this.Ucsys1.AddTD("TD", rb); // this.Ucsys1.AddTD(en1.GetValStrByKey("Addr")); // this.Ucsys1.AddTD(en1.GetValStrByKey("FR")); // this.Ucsys1.AddTD(en1.GetValStrByKey("Tel")); // this.Ucsys1.AddTREnd(); //} //this.Ucsys1.AddTableEnd(); //this.Ucsys2.BindPageIdx(qo.GetCOUNT(), SystemConfig.PageSize, pageIdx, url); //qo.DoQuery(en.PK, SystemConfig.PageSize, pageIdx); //this.BPToolBar1.SaveSearchState(this.EnsName); //return ens; }
public void BindEdit(MapData md, MapFrame dtl) { this.Pub1.AddTable(); // this.Pub1.AddCaptionLeftTX("<a href='MapDef.aspx?MyPK=" + md.No + "'>" + "返回" + ":" + md.Name + "</a> - " + this.ToE("DtlTable", "从表") + ":(" + dtl.Name + ")"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("ID"); this.Pub1.AddTDTitle("项目"); this.Pub1.AddTDTitle("采集"); this.Pub1.AddTDTitle("备注"); this.Pub1.AddTREnd(); int idx = 1; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("编号"); TB tb = new TB(); tb.ID = "TB_" + MapFrameAttr.NoOfObj; tb.Text = dtl.NoOfObj; if (this.DoType == "Edit") { tb.Enabled = false; } 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 = dtl.Name; tb.Columns = 50; this.Pub1.AddTD("colspan=2", tb); this.Pub1.AddTREnd(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("框架连接"); tb = new TB(); tb.ID = "TB_URL"; tb.Text = dtl.URL; tb.Columns = 50; this.Pub1.AddTD("colspan=2", tb); this.Pub1.AddTREnd(); this.Pub1.AddTR1(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("框架宽度"); tb = new TB(); tb.ID = "TB_W"; tb.Text = dtl.W; tb.ShowType = TBType.TB; 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_H"; tb.ShowType = TBType.TB; tb.Text = dtl.H; this.Pub1.AddTD(tb); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTR1(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTDBegin("colspan=3"); RadioBtn rb = new RadioBtn(); rb.Text = "指定框架宽度高度"; rb.ID = "RB_IsAutoSize_0"; rb.GroupName = "s"; if (dtl.IsAutoSize) { rb.Checked = false; } else { rb.Checked = true; } this.Pub1.Add(rb); rb = new RadioBtn(); rb.Text = "让框架自适应大小"; rb.ID = "RB_IsAutoSize_1"; rb.GroupName = "s"; if (dtl.IsAutoSize) { rb.Checked = true; } else { rb.Checked = false; } this.Pub1.Add(rb); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); GroupFields gfs = new GroupFields(md.No); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("显示在分组"); DDL ddl = new DDL(); ddl.ID = "DDL_GroupField"; ddl.BindEntities(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab, false, AddAllLocation.None); ddl.SetSelectItem(dtl.GroupID); this.Pub1.AddTD("colspan=2", ddl); this.Pub1.AddTREnd(); this.Pub1.AddTRSum(); this.Pub1.AddTDBegin("colspan=4 align=center"); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = " 保存 "; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); btn = new Button(); btn.ID = "Btn_SaveAndClose"; btn.CssClass = "Btn"; btn.Text = " 保存并关闭 "; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); if (this.FK_MapFrame != null) { btn = new Button(); btn.ID = "Btn_Del"; btn.CssClass = "Btn"; btn.Text = "删除"; // "删除"; btn.Attributes["onclick"] = " return confirm('您确认吗?');"; btn.Click += new EventHandler(btn_Del_Click); this.Pub1.Add(btn); btn = new Button(); btn.ID = "Btn_New"; btn.CssClass = "Btn"; btn.Text = "新建"; // "删除"; btn.Click += new EventHandler(btn_New_Click); this.Pub1.Add(btn); } this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
protected void Page_Load(object sender, EventArgs e) { PushMsgs msgs = new PushMsgs(this.FK_Flow); var msg = msgs.GetEntityByKey(PushMsgAttr.FK_Event, this.Event, PushMsgAttr.FK_Node, int.Parse(this.NodeID)) as PushMsg; if (msg == null) { msg = new PushMsg(); msg.FK_Event = this.Event; msg.FK_Node = int.Parse(this.NodeID); } if (!string.IsNullOrWhiteSpace(this.ThePushWay)) { if (this.ThePushWay != msg.PushWay.ToString()) { msg.PushDoc = string.Empty; msg.Tag = string.Empty; } msg.PushWay = int.Parse(this.ThePushWay); } this.Pub1.AddTable("class='Table' cellspacing='1' cellpadding='1' border='1' style='width:100%'"); this.Pub1.AddTR(); this.Pub1.AddTD("style='width:100px'", "推送设置方式:"); var ddl = new DDL(); ddl.BindSysEnum(PushMsgAttr.PushWay); ddl.ID = "DDL_" + PushMsgAttr.PushWay; ddl.SetSelectItem((int)msg.PushWay); ddl.AutoPostBack = true; ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged); this.Pub1.AddTD(ddl); this.Pub1.AddTREnd(); switch ((PushWay)msg.PushWay) { case PushWay.ByParas: #region 照系统指定参数 Pub1.AddTR(); Pub1.AddTD("输入参数名:"); Pub1.AddTDBegin(); var rad = new RadioBtn(); rad.GroupName = "Para"; rad.ID = "RB_0"; rad.Text = "系统参数"; rad.Checked = msg.PushDoc == "0"; Pub1.Add(rad); var tb = new TB(); tb.ID = "TB_" + PushMsgAttr.Tag; if (msg.PushDoc == "0") { tb.Text = msg.Tag; } else { tb.Text = "NoticeTo"; } Pub1.Add(tb); Pub1.Add(" 默认为NoticeTo"); Pub1.AddBR(); rad = new RadioBtn(); rad.GroupName = "Para"; rad.ID = "RB_1"; rad.Text = "表单字段参数"; rad.Checked = msg.PushDoc == "1"; Pub1.Add(rad); MapAttrs attrs = new MapAttrs(); attrs.Retrieve(MapAttrAttr.FK_MapData, "ND" + this.NodeID); MapAttrs attrNs = new MapAttrs(); foreach (MapAttr attr in attrs) { if (attr.IsBigDoc) { continue; } switch (attr.KeyOfEn) { case "Title": 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_" + PushMsgAttr.Tag; ddl.BindEntities(attrNs, MapAttrAttr.MyPK, MapAttrAttr.Name); ddl.AutoPostBack = false; if (msg.PushDoc == "1") { ddl.SetSelectItem(msg.Tag); } Pub1.Add(ddl); Pub1.AddTREnd(); #endregion break; case PushWay.NodeWorker: #region 照指定结点的工作人员 Pub1.AddTR(); Pub1.AddTDBegin("colspan='2'"); Pub1.Add("请选择要推送到的节点工作人员:<br />"); Nodes nds = new Nodes(this.FK_Flow); CheckBox cb = null; foreach (BP.WF.Node nd in nds) { if (nd.NodeID == int.Parse(this.NodeID)) { continue; } cb = new CheckBox(); cb.ID = "CB_" + nd.NodeID; cb.Text = nd.NodeID + " " + nd.Name; cb.Checked = msg.PushDoc.Contains("@" + nd.NodeID + "@"); Pub1.Add(cb); Pub1.AddBR(); } Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecDepts: #region 照指定的部门 Pub1.AddTR(); Pub1.AddTDBegin("colspan='2'"); this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'"); this.Pub1.AddTR(); this.Pub1.AddTD("colspan='3' class='GroupTitle'", "部门选择"); this.Pub1.AddTREnd(); //NodeDepts ndepts = new NodeDepts(int.Parse(this.NodeID)); Depts depts = new Depts(); depts.RetrieveAll(); int i = 0; //foreach (NodeDept dept in ndepts) foreach (Dept dept in depts) { i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } cb = new CheckBox(); //cb.ID = "CB_" + dept.FK_Dept; //cb.Text = (depts.GetEntityByKey(dept.FK_Dept) as Dept).Name; cb.ID = "CB_" + dept.No; cb.Text = dept.Name; //if (msg.PushDoc.Contains("@" + dept.FK_Dept + "@")) if (msg.PushDoc.Contains("@" + dept.No + "@")) { cb.Checked = true; } this.Pub1.AddTD(cb); if (i == 3) { Pub1.AddTREnd(); } } switch (i) { case 1: Pub1.AddTD(); Pub1.AddTD(); Pub1.AddTREnd(); break; case 2: Pub1.AddTD(); Pub1.AddTREnd(); break; default: break; } this.Pub1.AddTableEnd(); Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecEmps: #region 照指定的人员 Pub1.AddTR(); //Pub1.AddTDBegin("colspan='2'"); Pub1.AddTD("选择人员:"); Pub1.AddTDBegin(); tb = new TB(); tb.ID = "TB_Users"; tb.TextMode = TextBoxMode.MultiLine; tb.Style.Add("width", "99%"); tb.Rows = 4; tb.ReadOnly = true; var hf = new HiddenField(); hf.ID = "HID_Users"; //加载已经选择的人员 if (!string.IsNullOrWhiteSpace(msg.PushDoc)) { hf.Value = msg.PushDoc.Replace("@@", ",").Trim('@'); var emps = new Emps(); emps.RetrieveAll(); tb.Text = hf.Value.Split(',').Select(o => (emps.GetEntityByKey(o) as Emp).Name).Aggregate( string.Empty, (curr, next) => curr + next + ",").TrimEnd(','); } Pub1.Add(tb); Pub1.Add(hf); Pub1.AddBR(); Pub1.AddBR(); Pub1.Add( "<a class='easyui-linkbutton' data-options=\"iconCls:'icon-user'\" href='javascript:void(0)' onclick=\"showWin('../Comm/Port/SelectUser_Jq.aspx','" + tb.ClientID + "','" + hf.ClientID + "');\">选择人员...</a>"); Pub1.AddTDEnd(); //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'"); //depts = new Depts(); //depts.RetrieveAll(); //var emps = new Emps(); //emps.RetrieveAll(); //var empDepts = new EmpDepts(); //empDepts.RetrieveAll(); //var nemps = new NodeEmps(int.Parse(this.NodeID)); //Emp emp = null; //foreach (Dept dept in depts) //{ // this.Pub1.AddTR(); // var mycb = new CheckBox(); // mycb.Text = dept.Name; // mycb.ID = "CB_D_" + dept.No; // this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb); // this.Pub1.AddTREnd(); // i = 0; // string ctlIDs = ""; // foreach (EmpDept ed in empDepts) // { // if (ed.FK_Dept != dept.No) // continue; // //排除非当前结点绑定的人员 // if (nemps.GetEntityByKey(NodeEmpAttr.FK_Emp, ed.FK_Emp) == null) // continue; // i++; // if (i == 4) // i = 1; // if (i == 1) // Pub1.AddTR(); // emp = emps.GetEntityByKey(ed.FK_Emp) as Emp; // cb = new CheckBox(); // cb.ID = "CB_E_" + emp.No; // ctlIDs += cb.ID + ","; // cb.Text = emp.Name; // if (msg.PushDoc.Contains("@" + emp.No + "@")) // cb.Checked = true; // Pub1.AddTD(cb); // if (i == 3) // Pub1.AddTREnd(); // } // mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; // switch (i) // { // case 1: // Pub1.AddTD(); // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // case 2: // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // default: // break; // } //} //Pub1.AddTableEnd(); //Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecSQL: #region 照指定的SQL查询语句 Pub1.AddTR(); this.Pub1.AddTDBegin("colspan='2'"); this.Pub1.Add("SQL查询语句:<br />"); tb = new TB(); tb.ID = "TB_" + PushMsgAttr.PushDoc; tb.Columns = 50; tb.Style.Add("width", "99%"); tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 4; tb.Text = msg.PushDoc; this.Pub1.Add(tb); this.Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; case PushWay.SpecStations: #region 照指定的岗位 Pub1.AddTR(); Pub1.AddTDBegin("colspan='2'"); if (BP.WF.Glo.OSModel == OSModel.WorkFlow) { SysEnums ses = new SysEnums("StaGrade"); Stations sts = new Stations(); sts.RetrieveAll(); string sql = "SELECT No,Name FROM Port_Station WHERE StaGrade NOT IN (SELECT IntKey FROM Sys_Enum WHERE EnumKey='StaGrade')"; DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 0) { if (ses.Count == 0) { SysEnum se = new SysEnum(); se.EnumKey = "StaGrade"; se.Lab = "普通岗"; se.IntKey = 0; se.Insert(); ses.AddEntity(se); } foreach (Station st in sts) { st.StaGrade = 0; st.Save(); } } this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0' border='0' style='width:100%'"); foreach (SysEnum se in ses) { this.Pub1.AddTR(); CheckBox mycb = new CheckBox(); mycb.Text = se.Lab; mycb.ID = "CB_SG_" + se.IntKey; this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb); this.Pub1.AddTREnd(); i = 0; string ctlIDs = ""; foreach (Station st in sts) { if (st.StaGrade != se.IntKey) { continue; } i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } cb = new CheckBox(); cb.ID = "CB_S_" + st.No; ctlIDs += cb.ID + ","; cb.Text = st.Name; if (msg.PushDoc.Contains("@" + st.No + "@")) { cb.Checked = true; } Pub1.AddTD(cb); if (i == 3) { Pub1.AddTREnd(); } } mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; switch (i) { case 1: Pub1.AddTD(); Pub1.AddTD(); Pub1.AddTREnd(); break; case 2: Pub1.AddTD(); Pub1.AddTREnd(); break; default: break; } } this.Pub1.AddTableEnd(); } else { /*BPM 模式*/ BP.GPM.StationTypes tps = new BP.GPM.StationTypes(); tps.RetrieveAll(); BP.GPM.Stations sts = new BP.GPM.Stations(); sts.RetrieveAll(); string sql = "SELECT No,Name FROM Port_Station WHERE FK_StationType NOT IN (SELECT No FROM Port_StationType)"; DataTable dt = DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count != 0) { if (tps.Count == 0) { var stp = new BP.GPM.StationType { No = "01", Name = "普通岗" }; stp.Save(); tps.AddEntity(stp); } //更新所有对不上岗位类型的岗位,岗位类型为01或第一个 foreach (BP.GPM.Station st in sts) { st.FK_StationType = tps[0].No; st.Update(); } } this.Pub1.AddTable("class='Table' cellSpacing='0' cellPadding='0' border='0' style='width:100%'"); foreach (BP.GPM.StationType tp in tps) { this.Pub1.AddTR(); CheckBox mycb = new CheckBox(); mycb.Text = tp.Name; mycb.ID = "CB_ST_" + tp.No; this.Pub1.AddTD("colspan='3' class='GroupTitle'", mycb); this.Pub1.AddTREnd(); i = 0; string ctlIDs = ""; foreach (BP.GPM.Station st in sts) { if (st.FK_StationType != tp.No) { continue; } i++; if (i == 4) { i = 1; } if (i == 1) { Pub1.AddTR(); } cb = new CheckBox(); cb.ID = "CB_S_" + st.No; ctlIDs += cb.ID + ","; cb.Text = st.Name; if (msg.PushDoc.Contains("@" + st.No + "@")) { cb.Checked = true; } this.Pub1.AddTD(cb); if (i == 3) { Pub1.AddTREnd(); } } mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; switch (i) { case 1: Pub1.AddTD(); Pub1.AddTD(); Pub1.AddTREnd(); break; case 2: Pub1.AddTD(); Pub1.AddTREnd(); break; default: break; } } this.Pub1.AddTableEnd(); } #region 原逻辑,只考虑了一种模式,停用 //Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'"); //SysEnums ses = new SysEnums("StaGrade"); //Stations sts = new Stations(); //NodeStations nsts = new NodeStations(int.Parse(this.NodeID)); //sts.RetrieveAll(); //foreach (SysEnum se in ses) //{ // this.Pub1.AddTR(); // var mycb = new CheckBox(); // mycb.Text = se.Lab; // mycb.ID = "CB_SG_" + se.IntKey; // this.Pub1.AddTD("colspan=3 class='GroupTitle'", mycb); // this.Pub1.AddTREnd(); // i = 0; // string ctlIDs = ""; // foreach (Station st in sts) // { // if (st.StaGrade != se.IntKey) // continue; // //排除非当前结点的岗位 // if (nsts.GetEntityByKey(NodeStationAttr.FK_Station, st.No) == null) // continue; // i++; // if (i == 4) // i = 1; // if (i == 1) // Pub1.AddTR(); // cb = new CheckBox(); // cb.ID = "CB_S_" + st.No; // ctlIDs += cb.ID + ","; // cb.Text = st.Name; // if (msg.PushDoc.Contains("@" + st.No + "@")) // cb.Checked = true; // Pub1.AddTD(cb); // if (i == 3) // Pub1.AddTREnd(); // } // mycb.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')"; // switch (i) // { // case 1: // Pub1.AddTD(); // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // case 2: // Pub1.AddTD(); // Pub1.AddTREnd(); // break; // default: // break; // } //} //Pub1.AddTableEnd(); #endregion Pub1.AddTDEnd(); Pub1.AddTREnd(); #endregion break; } Pub1.AddTableEnd(); Pub1.AddBR(); Pub1.AddSpace(1); var btn = new LinkBtn(false, NamesOfBtn.Save, "保存"); btn.Click += new EventHandler(btn_Click); Pub1.Add(btn); if (!string.IsNullOrWhiteSpace(msg.MyPK)) { Pub1.AddSpace(1); btn = new LinkBtn(false, NamesOfBtn.Delete, "删除"); btn.Click += new EventHandler(btn_Delete_Click); btn.Attributes["onclick"] = "return confirm('你确定要删除此消息推送设置吗?');"; Pub1.Add(btn); } }
public void BindNumType(MapAttr mattr) { this.Pub1.AddTable("align=left"); this.Pub1.AddCaptionLeft("数据获取 - 当一个字段值需要从其它表中得到时,请设置此功能。"); this.Pub1.AddTR(); this.Pub1.Add("<TD>"); RadioBtn rb = new RadioBtn(); rb.GroupName = "s"; rb.Text = "方式0:不做任何设置。"; rb.ID = "RB_Way_0"; if (mattr.HisAutoFull == AutoFullWay.Way0) { rb.Checked = true; } this.Pub1.AddFieldSet(rb); this.Pub1.Add("不做任何设置。"); this.Pub1.AddFieldSetEnd(); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.Add("<TD>"); rb = new RadioBtn(); rb.GroupName = "s"; rb.Text = "方式1:本表单中数据计算。"; //""; rb.ID = "RB_Way_1"; if (mattr.HisAutoFull == AutoFullWay.Way1_JS) { rb.Checked = true; } this.Pub1.AddFieldSet(rb); this.Pub1.Add("比如:@单价*@数量"); this.Pub1.AddBR(); TextBox tb = new TextBox(); tb.ID = "TB_JS"; tb.Width = 450; tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 5; if (mattr.HisAutoFull == AutoFullWay.Way1_JS) { tb.Text = mattr.AutoFullDoc; } this.Pub1.Add(tb); this.Pub1.AddFieldSetEnd(); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); // 方式2 利用SQL自动填充 this.Pub1.AddTR(); this.Pub1.Add("<TD>"); rb = new RadioBtn(); rb.GroupName = "s"; rb.Text = "方式2:利用SQL自动填充。"; rb.ID = "RB_Way_2"; if (mattr.HisAutoFull == AutoFullWay.Way2_SQL) { rb.Checked = true; } this.Pub1.AddFieldSet(rb); this.Pub1.Add("比如:Select Addr From 商品表 WHERE No=@FK_Pro FK_Pro是本表中的任意字段名<BR>"); tb = new TextBox(); tb.ID = "TB_SQL"; tb.Width = 450; tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 5; if (mattr.HisAutoFull == AutoFullWay.Way2_SQL) { tb.Text = mattr.AutoFullDoc; } this.Pub1.Add(tb); this.Pub1.AddFieldSetEnd(); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); // 方式3 本表单中外键列 this.Pub1.AddTR(); this.Pub1.Add("<TD>"); rb = new RadioBtn(); rb.GroupName = "s"; rb.Text = "方式3:本表单中外键列。"; // rb.Text = "方式3:本表单中外键列</font></b>"; rb.ID = "RB_Way_3"; if (mattr.HisAutoFull == AutoFullWay.Way3_FK) { rb.Checked = true; } this.Pub1.AddFieldSet(rb); this.Pub1.Add("比如:表单中有商品编号列,需要填充商品地址、供应商电话。"); this.Pub1.AddBR(); // 让它等于外键表的一个值。 Attrs attrs = null; MapData md = new MapData(); md.No = mattr.FK_MapData; if (md.RetrieveFromDBSources() == 0) { attrs = md.GenerHisMap().HisFKAttrs; } else { MapDtl mdtl = new MapDtl(); mdtl.No = mattr.FK_MapData; attrs = mdtl.GenerMap().HisFKAttrs; } if (attrs.Count > 0) { } else { rb.Enabled = false; if (rb.Checked) { rb.Checked = false; } this.Pub1.Add("@本表没有外键字段。"); } foreach (Attr attr in attrs) { if (attr.IsRefAttr) { continue; } rb = new RadioBtn(); rb.Text = attr.Desc; rb.ID = "RB_FK_" + attr.Key; rb.GroupName = "sd"; if (mattr.AutoFullDoc.Contains(attr.Key)) { rb.Checked = true; } this.Pub1.Add(rb); DDL ddl = new DDL(); ddl.ID = "DDL_" + attr.Key; string sql = ""; switch (BP.SystemConfig.AppCenterDBType) { case DBType.Oracle: case DBType.Informix: continue; sql = "Select fname as 'No' ,fDesc as 'Name' FROM Sys_FieldDesc WHERE tableName='" + attr.HisFKEn.EnMap.PhysicsTable + "'"; break; default: sql = "Select name as 'No' ,Name as 'Name' from syscolumns WHERE ID=OBJECT_ID('" + attr.HisFKEn.EnMap.PhysicsTable + "')"; break; } // string sql = "Select fname as 'No' ,fDesc as 'Name' FROM Sys_FieldDesc WHERE tableName='" + attr.HisFKEn.EnMap.PhysicsTable + "'"; //string sql = "Select NO , NAME FROM Port_Emp "; DataTable dt = DBAccess.RunSQLReturnTable(sql); foreach (DataRow dr in dt.Rows) { // ddl.Items.Add(new ListItem(this.ToE("Field") + dr[0].ToString() + " " + this.ToE("Desc") + " " + dr[1].ToString(), dr[0].ToString())); ListItem li = new ListItem(dr[0].ToString() + ";" + dr[1].ToString(), dr[0].ToString()); if (mattr.AutoFullDoc.Contains(dr[0].ToString())) { li.Selected = true; } ddl.Items.Add(li); } this.Pub1.Add(ddl); this.Pub1.AddBR(); } this.Pub1.AddFieldSetEnd(); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); // 方式3 本表单中外键列 this.Pub1.AddTR(); this.Pub1.Add("<TD>"); rb = new RadioBtn(); rb.GroupName = "s"; rb.Text = "方式4:对一个从表的列求值。"; rb.ID = "RB_Way_4"; if (mattr.HisAutoFull == AutoFullWay.Way4_Dtl) { rb.Checked = true; } this.Pub1.AddFieldSet(rb); this.Pub1.Add("比如:对从表中的列求值。"); this.Pub1.AddBR(); // 让它对一个从表求和、求平均、求最大、求最小值。 MapDtls dtls = new MapDtls(mattr.FK_MapData); if (dtls.Count > 0) { } else { rb.Enabled = false; if (rb.Checked) { rb.Checked = false; } // this.Pub1.Add("@没有从表。"); } foreach (MapDtl dtl in dtls) { DDL ddlF = new DDL(); ddlF.ID = "DDL_" + dtl.No + "_F"; MapAttrs mattrs1 = new MapAttrs(dtl.No); int count = 0; foreach (MapAttr mattr1 in mattrs1) { if (mattr1.LGType != FieldTypeS.Normal) { continue; } if (mattr1.KeyOfEn == MapAttrAttr.MyPK) { continue; } if (mattr1.IsNum == false) { continue; } switch (mattr1.KeyOfEn) { case "OID": case "RefOID": case "FID": continue; default: break; } count++; ListItem li = new ListItem(mattr1.Name, mattr1.KeyOfEn); if (mattr.HisAutoFull == AutoFullWay.Way4_Dtl) { if (mattr.AutoFullDoc.Contains("=" + mattr1.KeyOfEn)) { li.Selected = true; } } ddlF.Items.Add(li); } if (count == 0) { continue; } rb = new RadioBtn(); rb.Text = dtl.Name; rb.ID = "RB_" + dtl.No; rb.GroupName = "dtl"; if (mattr.AutoFullDoc.Contains(dtl.No)) { rb.Checked = true; } this.Pub1.Add(rb); DDL ddl = new DDL(); ddl.ID = "DDL_" + dtl.No + "_Way"; ddl.Items.Add(new ListItem("求合计", "SUM")); ddl.Items.Add(new ListItem("求平均", "AVG")); ddl.Items.Add(new ListItem("求最大", "MAX")); ddl.Items.Add(new ListItem("求最小", "MIN")); this.Pub1.Add(ddl); if (mattr.HisAutoFull == AutoFullWay.Way4_Dtl) { if (mattr.AutoFullDoc.Contains("SUM")) { ddl.SetSelectItem("SUM"); } if (mattr.AutoFullDoc.Contains("AVG")) { ddl.SetSelectItem("AVG"); } if (mattr.AutoFullDoc.Contains("MAX")) { ddl.SetSelectItem("MAX"); } if (mattr.AutoFullDoc.Contains("MIN")) { ddl.SetSelectItem("MIN"); } } this.Pub1.Add(ddlF); this.Pub1.AddBR(); } this.Pub1.AddFieldSetEnd(); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); #region 方式5 //this.Pub1.AddTD(); //this.Pub1.AddTR(); //this.Pub1.AddFieldSet(rb); //this.Pub1.Add(this.ToE("Way2D", "嵌入的JS")); //tb = new TextBox(); //tb.ID = "TB_JS"; //tb.Width = 450; //tb.TextMode = TextBoxMode.MultiLine; //tb.Rows = 5; //if (mattr.HisAutoFull == AutoFullWay.Way5_JS) // tb.Text = mattr.AutoFullDoc; //this.Pub1.Add(tb); //this.Pub1.AddFieldSetEnd(); //this.Pub1.AddTDEnd(); //this.Pub1.AddTREnd(); #endregion 方式5 this.Pub1.AddTRSum(); this.Pub1.AddTDBegin("aligen=center"); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = " 保存 "; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); btn = new Button(); btn.ID = "Btn_SaveAndClose"; btn.CssClass = "Btn"; btn.Text = " 保存并关闭 "; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); return; }
public void SetDataV2() { this.UCSys1.Clear(); Entities ens = DA.ClassFactory.GetEns(this.Request.QueryString["EnsName"]); ens.RetrieveAll(); Entity en = ens.GetNewEntity; string space = ""; if (this.DropDownList1.SelectedValue == "None") { bool isGrade = ens.IsGradeEntities; if (isGrade) { this.UCSys1.Add("<a name='top' ></a>"); int num = ens.GetCountByKey("Grade", 2); if (num > 1) { int i = 0; this.UCSys1.AddTable(); this.UCSys1.AddTR(); this.UCSys1.AddTDTitle("序号"); this.UCSys1.AddTDTitle("<img src='../Images/Home.gif' border=0 />数据选择导航"); this.UCSys1.AddTREnd(); foreach (Entity myen in ens) { if (myen.GetValIntByKey("Grade") != 2) { continue; } i++; this.UCSys1.AddTR(); this.UCSys1.AddTDIdx(i); this.UCSys1.AddTD("<a href='#ID" + myen.GetValStringByKey(this.RefKey) + "' > " + myen.GetValStringByKey(this.RefKey) + " " + myen.GetValStringByKey(this.RefText) + "</a>"); this.UCSys1.AddTREnd(); } this.UCSys1.AddTableEnd(); } } this.UCSys1.AddTable(); this.UCSys1.AddTR(); this.UCSys1.AddTDTitle("IDX"); this.UCSys1.AddTDTitle(""); this.UCSys1.AddTREnd(); bool is1 = false; int idx = 0; foreach (Entity myen in ens) { idx++; is1 = this.UCSys1.AddTR(is1); this.UCSys1.AddTDIdx(idx); RadioBtn rb = new RadioBtn(); rb.GroupName = "s"; if (isGrade) { int grade = myen.GetValIntByKey("Grade"); space = ""; space = space.PadLeft(grade - 1, '-'); space = space.Replace("-", " "); // this.UCSys1.AddTD(space); switch (grade) { case 2: rb.Text = "<a href='#top' name='ID" + myen.GetValStringByKey(this.RefKey) + "' ><Img src='../Images/Top.gif' border=0 /></a><b><font color=green>" + myen.GetValStringByKey(this.RefKey) + myen.GetValStringByKey(this.RefText) + "</font></b>"; break; case 3: rb.Text = "<b>" + myen.GetValStringByKey(this.RefKey) + myen.GetValStringByKey(this.RefText) + "</b>"; break; default: rb.Text = myen.GetValStringByKey(this.RefKey) + myen.GetValStringByKey(this.RefText); break; } } else { rb.Text = myen.GetValStringByKey(this.RefText); } rb.ID = "RB_" + myen.GetValStringByKey(this.RefKey); string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();"; rb.Attributes["onclick"] = clientscript; //this.UCSys1.Add(rb); //this.UCSys1.AddBR(); this.UCSys1.AddTD(rb); this.UCSys1.AddTREnd(); } this.UCSys1.AddTableEnd(); return; } string key = this.DropDownList1.SelectedValue; Attr attr = en.EnMap.GetAttrByKey(key); if (attr.MyFieldType == FieldType.Enum || attr.MyFieldType == FieldType.PKEnum) { SysEnums ses = new SysEnums(attr.Key); this.UCSys1.AddTable(); //("<TABLE border=1 >"); foreach (SysEnum se in ses) { this.UCSys1.Add("<TR><TD class='Toolbar'>"); this.UCSys1.Add(se.Lab); this.UCSys1.Add("</TD></TR>"); this.UCSys1.Add("<TR><TD>"); #region add dtl this.UCSys1.AddTable(); int i = -1; foreach (Entity myen in ens) { if (myen.GetValIntByKey(attr.Key) != se.IntKey) { continue; } i++; if (i == 3) { i = 0; } if (i == 0) { this.UCSys1.Add("<TR>"); } RadioBtn rb = new RadioBtn(); rb.GroupName = "dsfsd"; rb.Text = myen.GetValStringByKey(this.RefText); rb.ID = "RB_" + myen.GetValStringByKey(this.RefKey); string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();"; // rb.Attributes["ondblclick"] = clientscript; rb.Attributes["onclick"] = clientscript; this.UCSys1.AddTD(rb); if (i == 2) { this.UCSys1.Add("</TR>"); } } this.UCSys1.Add("</TABLE>"); #endregion add dtl. this.UCSys1.Add("</TD></TR>"); } this.UCSys1.Add("</TABLE>"); return; } if (attr.Key == "FK_Dept") { BP.Port.Depts Depts = new BP.Port.Depts(); Depts.RetrieveAll(); this.UCSys1.AddTR(); this.UCSys1.AddTDToolbar("一级分组"); this.UCSys1.AddTREnd(); this.UCSys1.AddTR(); this.UCSys1.AddTDBegin(); this.UCSys1.AddTable(); /* 显示导航信息 */ int i = 0; //int span = 2; foreach (BP.Port.Dept Dept in Depts) { if (Dept.Grade == 2 || Dept.Grade == 1) { i++; this.UCSys1.Add("<TR>"); this.UCSys1.AddTDIdx(i); this.UCSys1.AddTD("<a href='#ID_2" + Dept.No + "' > " + Dept.No + " " + Dept.Name + "</a><BR>"); this.UCSys1.Add("</TR>"); } } this.UCSys1.AddTableEnd(); this.UCSys1.AddTDEnd(); this.UCSys1.AddTREnd(); // ===================== this.UCSys1.AddTR(); this.UCSys1.AddTDToolbar("二级分组"); this.UCSys1.AddTREnd(); this.UCSys1.AddTDBegin(); this.UCSys1.AddTable(); /* 显示导航信息 */ // int i = 0; //int span = 2; i = 0; foreach (BP.Port.Dept Dept in Depts) { i++; this.UCSys1.Add("<TR>"); this.UCSys1.AddTDIdx(i); if (Dept.Grade == 2) { this.UCSys1.AddTD(" <a name='ID_2" + Dept.No + "' >" + Dept.No + "</A> <a href='#ID" + Dept.No + "' ><b>" + Dept.Name + "</b></a><A HREF='#top'><Img src='../Images/Top.gif' border=0 /></a><BR>"); } else { this.UCSys1.AddTD(" " + Dept.No + " <a href='#ID" + Dept.No + "' name='#ID_2" + Dept.No + "' >" + Dept.Name + "</a><BR>"); } this.UCSys1.Add("</TR>"); } this.UCSys1.Add("</Table>"); this.UCSys1.Add("</TD></TR>"); //============ 数据 foreach (BP.Port.Dept groupen in Depts) { this.UCSys1.Add("<TR><TD class='Toolbar' >"); this.UCSys1.Add("<a href='#ID_2" + groupen.No + "' name='ID" + groupen.No + "' ><Img src='../Images/Top.gif' border=0 /></a> " + groupen.GetValStringByKey(attr.UIRefKeyText)); this.UCSys1.Add("</TD></TR>"); this.UCSys1.Add("<TR><TD>"); #region add info . this.UCSys1.AddTable(); i = -1; foreach (Entity myen in ens) { if (myen.GetValStringByKey(attr.Key) != groupen.GetValStringByKey(attr.UIRefKeyValue)) { continue; } i++; if (i == 3) { i = 0; } if (i == 0) { this.UCSys1.Add("<TR>"); } RadioBtn rb = new RadioBtn(); rb.GroupName = "dsfsd"; rb.Text = myen.GetValStringByKey(this.RefText); rb.ID = "RB_" + myen.GetValStringByKey(this.RefKey); string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();"; // rb.Attributes["ondblclick"] = clientscript; rb.Attributes["onclick"] = clientscript; this.UCSys1.AddTD(rb); if (i == 2) { this.UCSys1.Add("</TR>"); } } this.UCSys1.Add("</Table>"); #endregion add info . this.UCSys1.Add("</TD></TR>"); } this.UCSys1.Add("</TABLE>"); } else { Entities groupens = ClassFactory.GetEns(attr.UIBindKey); groupens.RetrieveAll(); this.UCSys1.AddTable(); //("<TABLE border=1 >"); if (groupens.Count > 19) { this.UCSys1.Add("<TR><TD class='Toolbar' ><img src='../Images/Home.gif' border=0 />数据选择导航 <font size='2'>提示:点分组连接就可到达分组数据</font></TD></TR>"); this.UCSys1.Add("<TR><TD>"); this.UCSys1.AddTable(); /* 显示导航信息 */ int i = 0; //int span = 2; foreach (Entity groupen in groupens) { i++; this.UCSys1.AddTR(); this.UCSys1.AddTDIdx(i); this.UCSys1.AddTD("<a href='#ID" + groupen.GetValStringByKey(attr.UIRefKeyValue) + "' > " + groupen.GetValStringByKey(attr.UIRefKeyValue) + " " + groupen.GetValStringByKey(attr.UIRefKeyText) + "</a><BR>"); this.UCSys1.AddTREnd(); } this.UCSys1.Add("</Table>"); this.UCSys1.Add("</TD></TR>"); } foreach (Entity groupen in groupens) { this.UCSys1.Add("<TR><TD class='Toolbar' >"); this.UCSys1.Add("<a href='#top' name='ID" + groupen.GetValStringByKey(attr.UIRefKeyValue) + "' ><Img src='../Images/Top.gif' border=0 /></a> " + groupen.GetValStringByKey(attr.UIRefKeyText)); this.UCSys1.Add("</TD></TR>"); this.UCSys1.Add("<TR><TD>"); #region add info . this.UCSys1.AddTable(); int i = -1; foreach (Entity myen in ens) { if (myen.GetValStringByKey(attr.Key) != groupen.GetValStringByKey(attr.UIRefKeyValue)) { continue; } i++; if (i == 3) { i = 0; } if (i == 0) { this.UCSys1.AddTR(); } RadioBtn rb = new RadioBtn(); rb.GroupName = "dsfsd"; rb.Text = myen.GetValStringByKey(this.RefText); rb.ID = "RB_" + myen.GetValStringByKey(this.RefKey); string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();"; // rb.Attributes["ondblclick"] = clientscript; rb.Attributes["onclick"] = clientscript; this.UCSys1.AddTD(rb); if (i == 2) { this.UCSys1.AddTREnd(); } } this.UCSys1.AddTableEnd(); #endregion add info . this.UCSys1.Add("</TD></TR>"); } this.UCSys1.AddTableEnd(); } }