public void BindSysEnum(SysEnumMain en) { SysEnums ses = new SysEnums(); if (en.No.Length > 0) { //ses = new SysEnums(en.No); ses.Retrieve(SysEnumAttr.EnumKey, en.No); } this.Pub1.AddTable(); if (this.RefNo == null) { this.Pub1.AddCaptionLeft("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>增加新字段向导</a> - <a href='Do.aspx?DoType=AddSysEnum&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>枚举字段</a> - 新建"); } else { this.Pub1.AddCaptionLeft("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>增加新字段向导</a> - <a href='Do.aspx?DoType=AddSysEnum&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>枚举字段</a> - 编辑"); } if (this.RefNo == null) { this.Title = "新建枚举"; } else { this.Title = "编辑枚举类型"; } this.Pub1.AddTR(); this.Pub1.AddTDTitle(" "); this.Pub1.AddTDTitle(" "); this.Pub1.AddTDTitle("备注"); this.Pub1.AddTREnd(); this.Pub1.AddTRSum(); this.Pub1.AddTD("编号"); BP.Web.Controls.TB 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; } this.Pub1.AddTD(tb); this.Pub1.AddTD("枚举英文名称"); this.Pub1.AddTREnd(); this.Pub1.AddTRSum(); this.Pub1.AddTD("名称"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_Name"; tb.Text = en.Name; this.Pub1.AddTD(tb); this.Pub1.AddTD("枚举中文名称"); this.Pub1.AddTREnd(); int idx = 0; while (idx < 20) { this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + idx; SysEnum se = ses.GetEntityByKey(SysEnumAttr.IntKey, idx) as SysEnum; if (se != null) { tb.Text = se.Lab; } // tb.Text = en.Name; this.Pub1.AddTD(tb); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); idx++; } this.Pub1.AddTRSum(); this.Pub1.Add("<TD colspan=3 align=center>"); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = " 保存 "; btn.Click += new EventHandler(btn_Save_Click); this.Pub1.Add(btn); btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Add"; btn.Text = "添加到表单"; // "添加到表单"; btn.Attributes["onclick"] = " return confirm('您确认吗?');"; btn.Click += new EventHandler(btn_Add_Click); if (this.RefNo == null) { btn.Enabled = false; } this.Pub1.Add(btn); btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Del"; btn.Text = " 删除 "; btn.Attributes["onclick"] = " return confirm('您确认吗?');"; if (this.RefNo == null) { btn.Enabled = false; } btn.Click += new EventHandler(btn_Del_Click); this.Pub1.Add(btn); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
protected void Page_Load(object sender, EventArgs e) { HungUp hu = new HungUp(); hu.MyPK = this.WorkID + "_" + this.FK_Node; int i = hu.RetrieveFromDBSources(); GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID); this.Pub1.AddFieldSet("对工作<b>(" + gwf.Title + ")</b>挂起方式"); RadioButton rb = new RadioButton(); rb.GroupName = "s"; rb.Text = "永久挂起"; rb.ID = "RB_HungWay0"; if (hu.HungUpWay == 0) { rb.Checked = true; } else { rb.Checked = false; } this.Pub1.Add(rb); this.Pub1.AddBR(); rb = new RadioButton(); rb.GroupName = "s"; rb.Text = "在指定的日期自动解除挂起."; rb.ID = "RB_HungWay1"; if (hu.HungUpWay == HungUpWay.SpecDataRel) { rb.Checked = true; } else { rb.Checked = false; } this.Pub1.Add(rb); this.Pub1.AddBR(); this.Pub1.Add(" 解除流程挂起的日期:"); BP.Web.Controls.TB tb = new BP.Web.Controls.TB(); tb.ShowType = BP.Web.Controls.TBType.DateTime; tb.ID = "TB_RelData"; if (hu.DTOfUnHungUpPlan.Length == 0) { DateTime dt = DateTime.Now.AddDays(7); hu.DTOfUnHungUpPlan = dt.ToString(DataType.SysDataTimeFormat); } tb.Text = hu.DTOfUnHungUpPlan; this.Pub1.Add(tb); this.Pub1.AddFieldSetEnd(); this.Pub1.AddFieldSet("挂起原因:"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_Note"; tb.TextMode = TextBoxMode.MultiLine; tb.Columns = 70; tb.Height = 50; this.Pub1.Add(tb); this.Pub1.AddFieldSetEnd(); this.Pub1.Add(" "); Button btn = new Button(); btn.ID = "Btn_OK"; if (gwf.WFState == WFState.HungUp) { btn.Text = " 取消挂起 "; } else { btn.Text = " 挂起 "; } btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); btn = new Button(); btn.ID = "Btn_Cancel"; btn.Text = " 关闭 "; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); }
protected void Page_Load(object sender, EventArgs e) { this.Title = "表单事件"; FrmEventXmls xmls = new FrmEventXmls(); xmls.RetrieveAll(); FrmEventXml curr = null; this.Pub1.Add("<a href='http://ccflow.org' target=_blank ><img src='/DataUser/ICON/" + SystemConfig.CompanyID + "/LogBiger.png' border=0 width='120px;' /></a><hr>"); this.Pub1.AddUL(); foreach (FrmEventXml xml in xmls) { if (xml.No == this.DoType) { curr = xml; this.Pub1.AddLi("<a href='FrmEvent.aspx?DoType=" + xml.No + "&FK_MapData=" + this.FK_MapData + "' ><b>" + xml.Name + "</b></a>"); } else { this.Pub1.AddLi("<a href='FrmEvent.aspx?DoType=" + xml.No + "&FK_MapData=" + this.FK_MapData + "' >" + xml.Name + "</a>"); } } this.Pub1.AddULEnd(); if (this.DoType == null) { this.Pub2.AddFieldSet("Help"); this.Pub2.AddH2("什么是表单事件?"); this.Pub2.AddH2("如何使用表单事件?"); this.Pub2.Add("请参考操作手册, http://ccflow.org ."); this.Pub2.AddFieldSetEnd(); return; } FrmEvent fe = new FrmEvent(this.FK_MapData, this.DoType); this.Pub2.AddTable("width=100%"); this.Pub2.AddCaptionLeft("表单事件:" + curr.Name); this.Pub2.AddTR(); this.Pub2.AddTD("事件类型"); BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL(); ddl.ID = "DDL_" + FrmEventAttr.FK_Event; ddl.BindSysEnum("EventDoType", (int)fe.HisDoType); this.Pub2.AddTD(ddl); this.Pub2.AddTREnd(); this.Pub2.AddTR(); this.Pub2.AddTDBegin("colspan=2"); this.Pub2.Add("执行内容<br>"); BP.Web.Controls.TB tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + FrmEventAttr.DoDoc; tb.Text = fe.DoDoc; tb.TextMode = TextBoxMode.MultiLine; tb.Columns = 60; tb.Rows = 5; this.Pub2.Add(tb); this.Pub2.AddTDEnd(); this.Pub2.AddTREnd(); this.Pub2.AddTR(); this.Pub2.AddTDBegin("colspan=2"); this.Pub2.Add("执行成功提示<br>"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + FrmEventAttr.MsgOK; tb.Text = fe.MsgOKString; tb.TextMode = TextBoxMode.MultiLine; tb.Columns = 60; tb.Rows = 5; this.Pub2.Add(tb); this.Pub2.AddTDEnd(); this.Pub2.AddTREnd(); this.Pub2.AddTR(); this.Pub2.AddTDBegin("colspan=2"); this.Pub2.Add("执行错误提示<br>"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + FrmEventAttr.MsgError; tb.Text = fe.MsgErrorString; tb.TextMode = TextBoxMode.MultiLine; tb.Columns = 60; tb.Rows = 5; this.Pub2.Add(tb); this.Pub2.AddTDEnd(); this.Pub2.AddTREnd(); this.Pub2.AddTableEndWithHR(); Button btn = new Button(); btn.Click += new EventHandler(btn_Click); btn.Text = " Save "; btn.CssClass = "Btn"; this.Pub2.Add(btn); }
protected void Page_Load(object sender, EventArgs e) { HungUp hu = new HungUp(); hu.MyPK = this.WorkID + "_" + this.FK_Node; int i = hu.RetrieveFromDBSources(); GenerWorkFlow gwf = new GenerWorkFlow(); gwf.WorkID = this.WorkID; if (gwf.RetrieveFromDBSources() == 0) { this.Pub1.AddFieldSet("错误", "当前是开始节点,或者工作不存在."); return; } this.Pub1.AddFieldSet("对工作<b>(" + gwf.Title + ")</b>挂起方式"); RadioButton rb = new RadioButton(); rb.GroupName = "s"; rb.Text = "永久挂起"; rb.ID = "RB_HungWay0"; if (hu.HungUpWay == 0) { rb.Checked = true; } else { rb.Checked = false; } this.Pub1.Add(rb); this.Pub1.AddBR(); rb = new RadioButton(); rb.GroupName = "s"; rb.Text = "在指定的日期自动解除挂起.<br>"; rb.ID = "RB_HungWay1"; if (hu.HungUpWay == HungUpWay.SpecDataRel) { rb.Checked = true; } else { rb.Checked = false; } this.Pub1.Add(rb); this.Pub1.Add(" 解除流程挂起的日期:"); BP.Web.Controls.TB tb = new BP.Web.Controls.TB(); tb.ReadOnly = false; tb.ID = "TB_RelData"; if (hu.DTOfUnHungUpPlan.Length == 0) { DateTime dt = DateTime.Now.AddDays(7); hu.DTOfUnHungUpPlan = dt.ToString(DataType.SysDataTimeFormat); } tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; tb.Text = hu.DTOfUnHungUpPlan; this.Pub1.Add(tb); this.Pub1.AddBR(); this.Pub1.Add("挂起原因(可以为空):"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_Note"; tb.TextMode = TextBoxMode.MultiLine; tb.Columns = 70; tb.Height = 50; this.Pub1.Add(tb); this.Pub1.AddFieldSetEnd(); this.Pub1.Add(" "); Button btn = new Button(); btn.ID = "Btn_OK"; if (gwf.WFState == WFState.HungUp) { btn.Text = " 取消挂起 "; } else { btn.Text = " 挂起 "; } btn.Click += new EventHandler(btn_Click); btn.Attributes["onclick"] = " return confirm('您确定要执行吗?');"; this.Pub1.Add(btn); btn = new Button(); btn.ID = "Btn_Cancel"; btn.Text = " 返回 "; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); }
protected void Page_Load(object sender, EventArgs e) { #region 属性 string sealName = null; #endregion 属性 #warning 没有缓存经常预览与设计不一致 MapData md = new MapData(); md.No = this.FK_MapData; if (this.Request.QueryString["IsTest"] == "1") { md.RepairMap(); BP.Sys.SystemConfig.DoClearCash_del(); } if (this.Request.QueryString["IsLoadData"] == "1") { this.UCEn1.IsLoadData = true; } if (md.RetrieveFromDBSources() == 0 && md.Name.Length > 3) { /*如果没有找到,就可能是 dtl 。*/ if (md.HisFrmType == FrmType.Url || md.HisFrmType == FrmType.SLFrm) { string no = Request.QueryString["NO"]; string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&UserNo=" + WebUser.No + "&SID=" + this.SID; /*如果是URL.*/ if (md.Url.Contains("?") == true) { this.Response.Redirect(md.Url + "&" + urlParas, true); } else { this.Response.Redirect(md.Url + "?" + urlParas, true); } return; } /* 没有找到此map. */ MapDtl dtl = new MapDtl(this.FK_MapData); GEDtl dtlEn = dtl.HisGEDtl; dtlEn.SetValByKey("OID", this.FID); if (dtlEn.EnMap.Attrs.Count <= 0) { md.RepairMap(); this.Response.Redirect(this.Request.RawUrl, true); return; } int i = dtlEn.RetrieveFromDBSources(); string[] paras = this.RequestParas.Split('&'); foreach (string str in paras) { if (string.IsNullOrEmpty(str) || str.Contains("=") == false) { continue; } string[] kvs = str.Split('='); dtlEn.SetValByKey(kvs[0], kvs[1]); } Width = md.MaxRight + md.MaxLeft * 2 + 10 + ""; if (float.Parse(Width) < 500) { Width = "900"; } Height = md.MaxEnd > md.FrmH ? md.MaxEnd + "" : md.FrmH + ""; if (float.Parse(Height) <= 800) { Height = "800"; } this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >"); if (md.HisFrmType == FrmType.FreeFrm) { this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData); } if (md.HisFrmType == FrmType.Column4Frm) { this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData); } this.AddJSEvent(dtlEn); this.UCEn1.Add("</div>"); } else { /*如果没有找到,就可能是dtl。*/ if (md.HisFrmType == FrmType.Url || md.HisFrmType == FrmType.SLFrm) { string no = Request.QueryString["NO"]; string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&IsEdit=" + this.IsEdit.ToString() + "&UserNo=" + WebUser.No + "&SID=" + this.SID; /*如果是URL.*/ if (md.Url.Contains("?") == true) { this.Response.Redirect(md.Url + "&" + urlParas, true); } else { this.Response.Redirect(md.Url + "?" + urlParas, true); } return; } if (md.HisFrmType == FrmType.WordFrm) { string no = Request.QueryString["NO"]; string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&UserNo=" + WebUser.No + "&SID=" + this.SID + "&FK_MapData=" + this.FK_MapData + "&OIDPKVal=" + this.OIDPKVal + "&FID=" + this.FID + "&FK_Flow=" + this.FK_Flow; /*如果是URL.*/ string requestParas = this.RequestParas; string[] parasArrary = this.RequestParas.Split('&'); foreach (string str in parasArrary) { if (string.IsNullOrEmpty(str) || str.Contains("=") == false) { continue; } string[] kvs = str.Split('='); if (urlParas.Contains(kvs[0])) { continue; } urlParas += "&" + kvs[0] + "=" + kvs[1]; } if (md.Url.Contains("?") == true) { this.Response.Redirect("FrmWord.aspx?1=2" + "&" + urlParas, true); } else { this.Response.Redirect("FrmWord.aspx" + "?" + urlParas, true); } return; } if (md.HisFrmType == FrmType.ExcelFrm) { this.Response.Redirect("FrmExcel.aspx?1=2" + this.RequestParas, true); return; } GEEntity en = md.HisGEEn; #region 求出 who is pk 值. int pk = this.OID; string nodeid = this.FK_Node.ToString(); if (nodeid != "0" && string.IsNullOrEmpty(this.FK_Flow) == false) { /*说明是流程调用它, 就要判断谁是表单的PK.*/ FrmNode fn = new FrmNode(this.FK_Flow, this.FK_Node, this.FK_MapData); switch (fn.WhoIsPK) { case WhoIsPK.FID: pk = this.FID; if (pk == 0) { throw new Exception("@没有接收到参数FID"); } break; case WhoIsPK.CWorkID: /*延续流程ID*/ pk = this.CWorkID; if (pk == 0) { throw new Exception("@没有接收到参数CWorkID"); } break; case WhoIsPK.PWorkID: /*父流程ID*/ pk = this.PWorkID; if (pk == 0) { throw new Exception("@没有接收到参数PWorkID"); } break; case WhoIsPK.OID: default: break; } } en.SetValByKey("OID", pk); #endregion 求出pk 值. if (en.EnMap.Attrs.Count <= 0) { md.RepairMap(); //让他刷新一下,重新进入. this.Response.Redirect(this.Request.RawUrl, true); return; } //检查实体数据是否存在,并重新设置默认值 if (en.RetrieveFromDBSources() == 0) { en.ResetDefaultValAllAttr(); try { en.DirectInsert(); } catch (Exception ex) { md.RepairMap(); en.CheckPhysicsTable(); throw new Exception("@装载出现错误:如果是第一次出现该错误,请刷新一次,系统有可能自动修复了。技术信息:" + ex.Message); } } string[] paras = this.RequestParas.Split('&'); foreach (string str in paras) { if (string.IsNullOrEmpty(str) || str.Contains("=") == false) { continue; } string[] kvs = str.Split('='); en.SetValByKey(kvs[0], kvs[1]); } if (en.ToString() == "0") { en.SetValByKey("OID", pk); } this.OIDPKVal = pk; #region 处理表单权限控制方案 Width = md.FrmW.ToString();//md.MaxRight + md.MaxLeft * 2 + 10 + ""; if (float.Parse(Width) < 500) { Width = "900"; } Height = md.MaxEnd > md.FrmH ? md.MaxEnd + "" : md.FrmH + ""; if (float.Parse(Height) <= 800) { Height = "800"; } this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >"); if (nodeid != null) { this.UCEn1.FK_Node = this.FK_Node; /*处理表单权限控制方案*/ this.HisFrmNode = new FrmNode(); int ii = this.HisFrmNode.Retrieve(FrmNodeAttr.FK_Frm, this.FK_MapData, FrmNodeAttr.FK_Node, int.Parse(nodeid)); if (ii == 0 || this.HisFrmNode.FrmSln == 0) { /*说明没有配置,或者方案编号为默认就不用处理,*/ this.UCEn1.BindCCForm(en, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData); } else { FrmFields fls = new FrmFields(this.FK_MapData, this.HisFrmNode.FrmSln); //求出集合. MapAttrs mattrs = new MapAttrs(this.FK_MapData); foreach (FrmField item in fls) { foreach (MapAttr attr in mattrs) { if (attr.KeyOfEn != item.KeyOfEn) { continue; } if (item.IsSigan) { item.UIIsEnable = false; } if (attr.SignType == SignType.CA) { long workId = Convert.ToInt64(this.OID); FrmField keyOfEn = new FrmField(); QueryObject info = new QueryObject(keyOfEn); info.AddWhere(FrmFieldAttr.FK_Node, this.FK_Node); info.addAnd(); info.AddWhere(FrmFieldAttr.FK_MapData, attr.FK_MapData); info.addAnd(); info.AddWhere(FrmFieldAttr.KeyOfEn, attr.KeyOfEn); info.addAnd(); info.AddWhere(MapAttrAttr.UIIsEnable, "1"); if (info.DoQuery() > 0) { sealName = en.GetValStrByKey(attr.KeyOfEn); } } attr.UIIsEnable = item.UIIsEnable; attr.UIVisible = item.UIVisible; attr.IsSigan = item.IsSigan; attr.DefValReal = item.DefVal; } } #region 设置默认值. if (this.IsEdit == true) { bool isHave = false; foreach (MapAttr attr in mattrs) { //if (attr.UIIsEnable) // continue; if (attr.DefValReal.Contains("@") == false) { continue; } en.SetValByKey(attr.KeyOfEn, attr.DefVal); isHave = true; } if (isHave) { en.DirectUpdate(); //让其直接更新. } } #endregion 设置默认值. //按照当前方案绑定表单. /* * 修改说明:如果是自定义方案,就不要装载填充了. */ ////是否要重新装载数据. bool isLoadData = this.IsLoadData; if (this.HisFrmNode.IsEnableLoadData == true) { /*如果允许启用.*/ } else { isLoadData = false; } this.UCEn1.BindCCForm(en, md, mattrs, this.FK_MapData, !this.IsEdit, Int64.Parse(Width), isLoadData); #region 检查必填项 string scriptCheckFrm = ""; scriptCheckFrm += "\t\n<script type='text/javascript' >"; scriptCheckFrm += "\t\n function CheckFrmSlnIsNull(){ "; scriptCheckFrm += "\t\n var isPass = true;"; scriptCheckFrm += "\t\n var alloweSave = true;"; scriptCheckFrm += "\t\n var erroMsg = '提示信息:';"; //表单权限设置为必填项 //查询出来,需要不为空的 Paras ps = new Paras(); ps.SQL = "SELECT KeyOfEn, Name FROM Sys_FrmSln WHERE FK_MapData=" + ps.DBStr + "FK_MapData AND FK_Node=" + ps.DBStr + "FK_Node AND IsNotNull=" + ps.DBStr + "IsNotNull"; ps.Add(FrmFieldAttr.FK_MapData, this.FK_MapData); ps.Add(FrmFieldAttr.FK_Node, this.FK_Node); ps.Add(FrmFieldAttr.IsNotNull, 1); //查询 System.Data.DataTable dtKeys = DBAccess.RunSQLReturnTable(ps); // 检查数据是否完整. foreach (System.Data.DataRow dr in dtKeys.Rows) { string key = dr[0].ToString(); string name = dr[1].ToString(); BP.Web.Controls.TB TB_NotNull = this.UCEn1.GetTBByID("TB_" + key); if (TB_NotNull != null) { scriptCheckFrm += "\t\n try{ "; scriptCheckFrm += "\t\n var element = document.getElementById('" + TB_NotNull.ClientID + "');"; //验证输入的正则格式 scriptCheckFrm += "\t\n if(element && element.readOnly == true) return;"; scriptCheckFrm += "\t\n isPass = EleSubmitCheck(element,'.{1}','" + name + ",不能为空。');"; scriptCheckFrm += "\t\n if(isPass == false){"; scriptCheckFrm += "\t\n alloweSave = false;"; scriptCheckFrm += "\t\n erroMsg += '" + name + ",不能为空。';"; scriptCheckFrm += "\t\n }"; scriptCheckFrm += "\t\n } catch(e) { "; scriptCheckFrm += "\t\n alert(e.name + e.message); return false;"; scriptCheckFrm += "\t\n } "; } } scriptCheckFrm += "\t\n return alloweSave; } "; scriptCheckFrm += "\t\n</script>"; #endregion //检查必填项 this.UCEn1.Add(scriptCheckFrm); } } else { this.UCEn1.BindCCForm(en, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData); } this.UCEn1.Add("</div>"); #endregion if (!IsPostBack) { if (md.IsHaveCA) { #region 检查是否有ca签名. //if (md.IsHaveCA == true) //{ // if (string.IsNullOrEmpty(sealName)) // sealName = WebUser.No; // string basePath = Server.MapPath("~/DataUser/Siganture/" + WorkID); // if (!System.IO.Directory.Exists(basePath)) // { // System.IO.Directory.CreateDirectory(basePath); // } // // basePath = "C:\\"; // this.TB_SealFile.Text = basePath + "\\" + sealName + ".jpg"; // #region 获取存储的 签名信息 // BP.Tools.WFSealData sealData = new BP.Tools.WFSealData(); // sealData.RetrieveByAttrAnd(BP.Tools.WFSealDataAttr.OID, WorkID, BP.Tools.WFSealDataAttr.FK_Node, FK_Node); // //sealData.RetrieveFromDBSources(); // if (!string.IsNullOrEmpty(sealData.SealData)) // { // this.TB_SealData.Text = sealData.SealData; // } // #endregion // //this.TB_SealData.Text = en.GetValStringByKey("SealData"); //} #endregion 检查是否有ca签名. } } this.AddJSEvent(en); } Session["Count"] = null; this.Btn_Save.Visible = this.HisFrmNode.IsEdit; this.Btn_Save.Enabled = this.HisFrmNode.IsEdit; this.Btn_Save.BackColor = System.Drawing.Color.White; Node curNd = new Node(); curNd.NodeID = this.FK_Node; curNd.RetrieveFromDBSources(); if (curNd.FormType == NodeFormType.SheetTree) { this.Btn_Save.Visible = true; this.Btn_Save.Enabled = true; this.Btn_Print.Enabled = false; this.Btn_Print.Visible = false; } else { this.Btn_Print.Visible = this.HisFrmNode.IsPrint; this.Btn_Print.Enabled = this.HisFrmNode.IsPrint; this.Btn_Print.Attributes["onclick"] = "window.open('Print.aspx?FK_Node=" + this.FK_Node + "&FID=" + this.FID + "&FK_MapData=" + this.FK_MapData + "&WorkID=" + this.OID + "', '', 'dialogHeight: 350px; dialogWidth:450px; center: yes; help: no'); return false;"; } }
public void BindSFTable(SFTable en) { string star = "<font color=red><b>(*)</b></font>"; this.Ucsys1.AddTable(); if (this.RefNo == null) { this.Ucsys1.AddCaption("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>增加新字段向导</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 + "'>增加新字段向导</a> - <a href='Do.aspx?DoType=AddSFTable&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>外键</a> - 编辑表"); } if (this.RefNo == null) { this.Title = "新建表"; } else { this.Title = "编辑表"; } this.Ucsys1.AddTR(); this.Ucsys1.AddTDTitle("项目"); this.Ucsys1.AddTDTitle("采集"); this.Ucsys1.AddTDTitle("备注"); this.Ucsys1.AddTREnd(); this.Ucsys1.AddTR(); this.Ucsys1.AddTD("表英文名称" + star); BP.Web.Controls.TB 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 = "SF_"; } this.Ucsys1.AddTD(tb); this.Ucsys1.AddTD("输入:新表名或已经存在的表名"); this.Ucsys1.AddTREnd(); this.Ucsys1.AddTR(); this.Ucsys1.AddTD("表中文名称" + star); tb = new BP.Web.Controls.TB(); tb.ID = "TB_Name"; tb.Text = en.Name; this.Ucsys1.AddTD(tb); this.Ucsys1.AddTD(); this.Ucsys1.AddTREnd(); this.Ucsys1.AddTR(); 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(); this.Ucsys1.AddTR(); 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('../PanelEns.aspx?EnsName=" + en.No + "','dg' ); return false;"; } else { btn.Attributes["onclick"] = "WinOpen('SFTableEditData.aspx?RefNo=" + this.RefNo + "','dg' ); return false;"; } this.Ucsys1.Add(btn); 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(); }
protected void Page_Load(object sender, EventArgs e) { FrmAttachment ath = new FrmAttachment(); ath.MyPK = this.FK_MapData + "_" + this.Ath; if (this.Ath != null) { ath.RetrieveFromDBSources(); } ath.FK_MapData = this.FK_MapData; ath.NoOfObj = this.Ath; ath.MyPK = this.FK_MapData + "_" + this.Ath; //this.Response.Write(this.Ath); //this.Response.Write(" -- "+this.FK_MapData); this.Title = "附件属性设置"; this.Pub1.AddTable(); //this.Pub1.AddCaptionLeft("附件"); this.Pub1.AddTR(); this.Pub1.AddTDTitle("项目"); this.Pub1.AddTDTitle("采集"); this.Pub1.AddTDTitle("说明"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("编号"); TextBox tb = new TextBox(); tb.ID = "TB_" + FrmAttachmentAttr.NoOfObj; tb.Text = ath.NoOfObj; if (this.Ath != null) { tb.Enabled = false; } this.Pub1.AddTD(tb); this.Pub1.AddTD("标示号只能英文字母数字或下滑线."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("名称"); tb = new TextBox(); tb.ID = "TB_" + FrmAttachmentAttr.Name; tb.Text = ath.Name; this.Pub1.AddTD(tb); this.Pub1.AddTD("附件的中文名称."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("文件格式"); tb = new TextBox(); tb.ID = "TB_" + FrmAttachmentAttr.Exts; tb.Text = ath.Exts; this.Pub1.AddTD(tb); this.Pub1.AddTD("实例:doc,docx,xls,多种格式用逗号分开."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("保存到"); tb = new TextBox(); tb.ID = "TB_" + FrmAttachmentAttr.SaveTo; tb.Text = ath.SaveTo; tb.Columns = 60; this.Pub1.AddTD("colspan=2", tb); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("类别"); tb = new TextBox(); tb.ID = "TB_" + FrmAttachmentAttr.Sort; tb.Text = ath.Sort; tb.Columns = 60; this.Pub1.AddTD("colspan=2", tb); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("colspan=3", "帮助:类别可以为空,设置的格式为:类别名1,类别名2,类别名3"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD(""); CheckBox cb = new CheckBox(); cb.ID = "CB_" + FrmAttachmentAttr.IsDownload; cb.Text = "是否可下载"; cb.Checked = ath.IsDownload; this.Pub1.AddTD(cb); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD(""); cb = new CheckBox(); cb.ID = "CB_" + FrmAttachmentAttr.IsDelete; cb.Text = "是否可删除"; cb.Checked = ath.IsDelete; this.Pub1.AddTD(cb); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD(""); cb = new CheckBox(); cb.ID = "CB_" + FrmAttachmentAttr.IsUpload; cb.Text = "是否可上传"; cb.Checked = ath.IsUpload; this.Pub1.AddTD(cb); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD(""); cb = new CheckBox(); cb.ID = "CB_" + FrmAttachmentAttr.IsNote; cb.Text = "是否增加备注列"; cb.Checked = ath.IsNote; this.Pub1.AddTD(cb); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("高度"); BP.Web.Controls.TB mytb = new BP.Web.Controls.TB(); mytb.ID = "TB_" + FrmAttachmentAttr.H; mytb.Text = ath.H.ToString(); mytb.ShowType = BP.Web.Controls.TBType.Float; this.Pub1.AddTD("colspan=1", mytb); this.Pub1.AddTD("对傻瓜表单有效"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("宽度"); mytb = new BP.Web.Controls.TB(); mytb.ID = "TB_" + FrmAttachmentAttr.W; mytb.Text = ath.W.ToString(); mytb.ShowType = BP.Web.Controls.TBType.Float; mytb.Columns = 60; this.Pub1.AddTD("colspan=1", mytb); this.Pub1.AddTD("对傻瓜表单有效"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("自动控制"); cb = new CheckBox(); cb.ID = "CB_" + FrmAttachmentAttr.IsAutoSize; cb.Text = "自动控制高度与宽度(对傻瓜表单有效)"; cb.Checked = ath.IsAutoSize; this.Pub1.AddTD("colspan=2", cb); this.Pub1.AddTREnd(); GroupFields gfs = new GroupFields(ath.FK_MapData); this.Pub1.AddTR1(); this.Pub1.AddTD("显示在分组"); BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL(); ddl.ID = "DDL_GroupField"; ddl.BindEntities(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab, false, BP.Web.Controls.AddAllLocation.None); ddl.SetSelectItem(ath.GroupID); this.Pub1.AddTD("colspan=2", ddl); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD(""); Button btn = new Button(); btn.ID = "Btn_Save"; btn.Text = " Save "; btn.CssClass = "Btn"; btn.Click += new EventHandler(btn_Click); this.Pub1.AddTD(btn); if (this.Ath != null) { btn = new Button(); btn.ID = "Btn_Delete"; btn.Text = " Delete "; btn.CssClass = "Btn"; btn.Attributes["onclick"] = " return confirm('您确认吗?');"; btn.Click += new EventHandler(btn_Click); this.Pub1.AddTD(btn); } else { this.Pub1.AddTD(); } this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
protected void Page_Load(object sender, EventArgs e) { this.Pub1.AddTable(); this.Pub1.AddCaption("演示使用BP的用户控件来呈现与采集数据."); this.Pub1.AddTR(); this.Pub1.AddTD("帐号"); BP.Web.Controls.TB tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + BPUserAttr.No; this.Pub1.AddTD(tb); this.Pub1.AddTD("不能为空,字母或者下划线组合."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("密码"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + BPUserAttr.Pass; this.Pub1.AddTD(tb); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("重输密码"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_Pass1"; this.Pub1.AddTD(tb); this.Pub1.AddTD("两次密码不能重复."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("姓名"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + BPUserAttr.Name; this.Pub1.AddTD(tb); this.Pub1.AddTD("不能为空"); this.Pub1.AddTREnd(); //枚举类型. this.Pub1.AddTR(); this.Pub1.AddTD("性别"); BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL(); ddl.BindSysEnum("XB"); // 在Sys_Eumm 已经注册了该枚举值. ddl.ID = "TB_" + BPUserAttr.XB; this.Pub1.AddTD(ddl); this.Pub1.AddTD("请选择"); this.Pub1.AddTREnd(); // 数值类型. this.Pub1.AddTR(); this.Pub1.AddTD("年龄"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + BPUserAttr.Age; this.Pub1.AddTD(tb); this.Pub1.AddTD("输入int类型数据."); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("地址"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + BPUserAttr.Addr; this.Pub1.AddTD(tb); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("电话"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + BPUserAttr.Tel; this.Pub1.AddTD(tb); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTD("邮件"); tb = new BP.Web.Controls.TB(); tb.ID = "TB_" + BPUserAttr.Email; this.Pub1.AddTD(tb); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); this.Pub1.AddTR(); Button btn = new Button(); btn.ID = "Btn_Reg"; btn.Text = "注册新用户"; btn.Click += new EventHandler(btn_Click); this.Pub1.AddTD("colspan=3", btn); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
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(); }
/// <summary> /// 设置数据 /// </summary> /// <param name="en"></param> public void SetCtrlValues(Entity en) { Attrs attrs = en.EnMap.Attrs; foreach (System.Web.UI.Control ctl in this.Controls) { #region 排除非预定的控件 if (ctl == null || string.IsNullOrEmpty(ctl.ID)) { continue; } string id = ctl.ID; if (id.Contains("TB_") || id.Contains("CB_") || id.Contains("DDL_")) { /*约定的控件*/ } else { continue; } #endregion 排除非预定的控件 #region 设置控件信息。 foreach (Attr attr in attrs) { string myID = "TB_" + attr.Key; if (myID == id) { TextBox tb = ctl as TextBox; if (tb != null) { tb.Text = en.GetValStrByKey(attr.Key); tb.MaxLength = attr.MaxLength; continue; } BP.Web.Controls.TB tbSelf = ctl as BP.Web.Controls.TB; if (tbSelf != null) { tbSelf.Text = en.GetValStrByKey(attr.Key); tb.MaxLength = attr.MaxLength; continue; } } myID = "DDL_" + attr.Key; if (myID == id) { DropDownList ddl = ctl as DropDownList; if (ddl != null) { if (ddl.Items.Count == 0) { if (attr.IsEnum) { BP.Web.Ctrl.Glo.DDL_BindEnum(ddl, attr.UIBindKey, en.GetValIntByKey(attr.Key)); } if (attr.IsFK) { BP.Web.Ctrl.Glo.DDL_BindEns(ddl, attr.UIBindKey, en.GetValStrByKey(attr.Key)); } } foreach (ListItem li in ddl.Items) { li.Selected = false; } string val = en.GetValStrByKey(attr.Key); foreach (ListItem li in ddl.Items) { if (li.Value == val) { li.Selected = true; break; } } //try //{ // ddl.SelectedValue = val; // continue; //} //catch(Exception ex) //{ // throw new Exception(ex.Message+" - "+val); //} } BP.Web.Controls.DDL ddlSelf = ctl as BP.Web.Controls.DDL; if (ddlSelf != null) { ddlSelf.SetSelectItem(en.GetValStrByKey(attr.Key)); continue; } } myID = "CB_" + attr.Key; if (myID == id) { CheckBox cb = ctl as CheckBox; if (cb != null) { if (en.GetValIntByKey(attr.Key) == 1) { cb.Checked = true; } else { cb.Checked = false; } continue; } } } #endregion 设置控件信息。 } }
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); }
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(); }