protected void Page_Load(object sender, EventArgs e) { MapDtl dtl = new MapDtl(); dtl.No = this.FK_MapDtl; if (dtl.RetrieveFromDBSources() == 0) { dtl.FK_MapData = this.FK_MapData; dtl.Name = this.FK_MapData; dtl.Insert(); dtl.IntMapAttrs(); } this.Pub1.AddTable("width=100% height='100%' align=left "); this.Pub1.AddTR(" ID='0_0' "); this.Pub1.Add("<TD colspan=4 class=TRSum ><div style='text-align:left; float:left'><a href=\"javascript:EditDtl('" + this.FK_MapData + "','" + dtl.No + "')\" >" + dtl.Name + "</a></div><div style='text-align:right; float:right'><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.AddF('" + dtl.No + "');\"><img src='/WF/Img/Btn/New.gif' border=0/>插入列</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.AddFGroup('" + dtl.No + "');\"><img src='/WF/Img/Btn/New.gif' border=0/>插入列组</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.CopyF('" + dtl.No + "');\"><img src='/WF/Img/Btn/Copy.gif' border=0/>复制列</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.HidAttr('" + dtl.No + "');\"><img src='/WF/Img/Btn/Copy.gif' border=0/>隐藏列</a><a href=\"javascript:document.getElementById('F" + dtl.No + "').contentWindow.DtlMTR('" + dtl.No + "');\"><img src='/WF/Img/Btn/Copy.gif' border=0/>多表头</a> <a href='Action.aspx?FK_MapData=" + this.FK_MapDtl + "' >从表事件</a><a href=\"javascript:DtlDoUp('" + dtl.No + "')\" ><img src='/WF/Img/Btn/Up.gif' border=0/></a> <a href=\"javascript:DtlDoDown('" + dtl.No + "')\" ><img src='/WF/Img/Btn/Down.gif' border=0/></a></div></td>"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.Add("<TD colspan=4 ID='TD" + dtl.No + "' height='50px' align=left>"); string src = "MapDtlDe.aspx?DoType=Edit&FK_MapData=" + this.FK_MapData + "&FK_MapDtl=" + dtl.No; this.Pub1.Add("<iframe ID='F" + dtl.No + "' frameborder=0 style='align:left;padding:0px;border:0px;' leftMargin='0' topMargin='0' src='" + src + "' width='100%' height='400' /></iframe>"); this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
protected void Page_Load(object sender, EventArgs e) { MapData md = new MapData(this.FK_MapData); this.Title = md.Name + " - 设计明细"; switch (this.DoType) { case "Edit": MapDtl dtl = new MapDtl(); if (this.FK_MapDtl == null) { dtl.No = this.FK_MapData + "Dtl"; } else { dtl.No = this.FK_MapDtl; dtl.Retrieve(); } BindEdit(md, dtl); break; default: case "New": int num = BP.DA.DBAccess.RunSQLReturnValInt("SELECT COUNT(*) FROM Sys_MapDtl WHERE FK_MapData='" + this.FK_MapData + "'") + 1; MapDtl dtl1 = new MapDtl(); dtl1.Name = "从表" + num; dtl1.No = this.FK_MapData + "Dtl" + num; dtl1.PTable = this.FK_MapData + "Dtl" + num; BindEdit(md, dtl1); break; } }
protected void Page_Load(object sender, EventArgs e) { MapDtl dtl = new MapDtl(this.MyPK); this.Title = "从表头"; this.Pub1.AddTable(); this.Pub1.AddCaptionLeft("请书写html标记,以《TR》开头,以《/TR》结尾。"); this.Pub1.AddTR(); TextBox tb = new TextBox(); tb.ID = "TB_Doc"; tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 15; tb.Columns = 60; tb.Text = dtl.MTR; // tb.Attributes["onblur"] = "Rep('"+tb.ClientID+"')"; this.Pub1.AddTD(tb); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = "保存"; btn.OnClientClick += "javascript:Rep();"; // btn.Attributes["onclick"] = "return Rep('" + tb.ClientID + "');"; btn.Click += new EventHandler(btn_Click); this.Pub1.Add(btn); }
void btn_Go_Click(object sender, EventArgs e) { MapDtl dtl = new MapDtl(this.FK_MapDtl); dtl.IntMapAttrs(); this.Response.Redirect("MapDtlDe.aspx?DoType=Edit&FK_MapData=" + this.FK_MapData + "&FK_MapDtl=" + this.FK_MapDtl, true); }
void btn_Click(object sender, EventArgs e) { MapDtl dtl = new MapDtl(this.MyPK); dtl.MTR = this.Pub1.GetTextBoxByID("TB_Doc").Text; dtl.Update(); this.WinClose(); }
protected void Page_Load(object sender, EventArgs e) { #region 功能执行. if (this.DoType == "DeleteFJ") { FrmAttachment ath1 = new FrmAttachment(); ath1.MyPK = this.FK_MapData + "_" + this.Ath + "_" + this.FK_Node; ath1.Delete(); this.WinClose(); return; } if (this.DoType == "DeleteDtl") { MapDtl dtl = new MapDtl(); dtl.No = this.FK_MapDtl + "_" + this.FK_Node; dtl.Delete(); this.WinClose(); return; } #endregion 功能执行. MapData md = new MapData(this.FK_MapData); FrmField sln = new FrmField(); sln.CheckPhysicsTable(); switch (this.DoType) { case "Dtl": //附件方案. this.Title = "从表权限"; BindDtl(); break; case "FJ": //附件方案. this.Title = "表单附件权限"; BindFJ(); break; case "Field": //字段方案. this.Title = "表单字段权限"; this.BindSln(); break; case "Copy": //字段方案. this.Title = "从其它节点复制权限"; this.BindCopy(); break; case "DoCopy": //字段方案. this.Title = "执行复制权限方案"; this.DoCopy(); break; default: this.Title = "没有涉及到的类型:" + this.DoType; break; } }
protected override void afterDelete() { MapDtl dtl = new MapDtl(); dtl.No = this.No; dtl.Delete(); base.afterDelete(); }
protected override bool beforeUpdate() { MapDtl dtl = new MapDtl(this.No); //启用审核 dtl.IsEnablePass = this.IsEnablePass; //超链接 dtl.IsEnableLink = this.IsEnableLink; dtl.LinkLabel = this.LinkLabel; dtl.LinkUrl = this.LinkUrl; dtl.LinkTarget = this.LinkTarget; dtl.Update(); //获得事件实体. var febd = BP.Sys.Glo.GetFormDtlEventBaseByEnName(this.No); if (febd == null) { this.FEBD = ""; } else { this.FEBD = febd.ToString(); } #region 检查填充的SQL是否符合要求. #endregion //更新分组标签. @fanleiwei. 代码有变化. BP.Sys.GroupField gf = new GroupField(); int i = gf.Retrieve(GroupFieldAttr.CtrlType, "Dtl", GroupFieldAttr.CtrlID, this.No); if (i == 0) { gf.CtrlID = this.No; gf.CtrlType = "Dtl"; gf.FrmID = this.FK_MapData; gf.Insert(); } if (i > 1) { gf.Delete(); i = gf.Retrieve(GroupFieldAttr.CtrlType, "Dtl", GroupFieldAttr.CtrlID, this.No); } if (i == 1 && gf.Lab.Equals(this.Name) == false) { gf.Lab = this.Name; gf.Update(); } return(base.beforeUpdate()); }
void btn_Exp_Click(object sender, EventArgs e) { Button btn = sender as Button; string id = btn.ID.Replace("Btn_Exp", ""); MapDtl dtl = new MapDtl(id); GEDtls dtls = new GEDtls(id); this.ExportDGToExcelV2(dtls, dtl.Name + ".xls"); return; }
/// <summary> /// 创建流程,发送分流点第1步. /// </summary> public void Step1() { Flow fl = new Flow("122"); fl.DoDelData(); // 让zhanghaicheng 登录. BP.WF.Dev2Interface.Port_Login(userNo); //创建空白工作, 发起开始节点. workid = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow); //获得他的work. Node nd = new Node(12201); Work wk = nd.HisWork; wk.OID = workid; wk.Retrieve(); // 初始化明细表的接收人数据. MapDtl dtl = wk.HisMapDtls[0] as MapDtl; GEDtl enDtl = dtl.HisGEDtl; enDtl.RefPK = workid.ToString(); enDtl.SetValByKey("ChuLiRen", "zhangyifan"); enDtl.SetValByKey("ChuLiRenMingCheng", "张一帆"); enDtl.SetValByKey("PiCiHao", "AA"); //批次号. enDtl.Insert(); enDtl = dtl.HisGEDtl; enDtl.RefPK = workid.ToString(); enDtl.SetValByKey("ChuLiRen", "zhangyifan"); enDtl.SetValByKey("ChuLiRenMingCheng", "张一帆"); enDtl.SetValByKey("PiCiHao", "AA"); //批次号. enDtl.Insert(); enDtl = dtl.HisGEDtl; enDtl.RefPK = workid.ToString(); enDtl.SetValByKey("ChuLiRen", "zhangyifan"); enDtl.SetValByKey("ChuLiRenMingCheng", "张一帆"); enDtl.SetValByKey("PiCiHao", "BB"); //批次号. enDtl.Insert(); // 执行向下发送. SendReturnObjs objs = BP.WF.Dev2Interface.Node_SendWork(this.fk_flow, this.workid); if (objs.VarTreadWorkIDs == "") { throw new Exception("sss"); } }
protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "Copy Node Dtl Fields Esc to exit."; if (this.Dtl != null) { this.BindAttrs(); return; } MapDtl dtl = new MapDtl(this.MyPK); //string sql = "SELECT DISTINCT PTable, No, Name From Sys_MapDtl WHERE No <> '"+this.MyPK+"'"; string sql = "SELECT b.Name as NodeName, a.No AS DtlNo, a.Name as DtlName"; sql += " FROM Sys_MapDtl a , Sys_MapData b "; sql += " WHERE A.FK_MapData=b.No AND B.No LIKE '" + this.MyPK.Substring(0, 4) + "%' AND B.No<>'" + this.MyPK + "'"; DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql); if (dt.Rows.Count == 0) { this.WinCloseWithMsg("没有可复制的节点数据。"); return; } if (dt.Rows.Count == 1) { this.Response.Redirect("CopyDtlField.aspx?MyPK=" + this.MyPK + "&Dtl=" + dt.Rows[0]["DtlNo"].ToString(), true); return; } this.AddFieldSet("本流程上的明细数据"); this.AddUL(); foreach (DataRow dr in dt.Rows) { this.AddLi("CopyDtlField.aspx?MyPK=" + this.MyPK + "&Dtl=" + dr["DtlNo"].ToString(), "节点名:" + dr["NodeName"].ToString() + " 表名称:" + dr["DtlName"].ToString()); } this.AddULEnd(); this.AddFieldSetEnd(); //this.AddFieldSet("其他流程上的明细数据"); //this.AddUL(); //foreach (DataRow dr in dt.Rows) //{ // this.AddLi("CopyDtlField.aspx?MyPK=" + this.MyPK + "&Dtl=" + dr["No"].ToString(), dr["Name"].ToString()); //} //this.AddULEnd(); //this.AddFieldSetEnd(); }
protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "明细选项"; WorkOptDtlXmls xmls = new WorkOptDtlXmls(); xmls.RetrieveAll(); MapDtl dtl = new MapDtl(this.FK_MapDtl); this.Pub1.Add("\t\n<div id='tabsJ' align='center'>"); this.Pub1.Add("\t\n<ul>"); foreach (WorkOptDtlXml item in xmls) { switch (item.No) { case "UnPass": if (dtl.IsEnablePass == false) { continue; } break; case "SelectItems": if (dtl.IsEnableSelectImp == false) { continue; } break; default: break; } string url = item.URL + "?DoType=" + item.No + "&WorkID=" + this.WorkID + "&FK_MapDtl=" + this.FK_MapDtl + "&FID=" + this.FID; this.Pub1.AddLi("<a href=\"" + url + "\" ><span>" + item.Name + "</span></a>"); } this.Pub1.Add("\t\n</ul>"); this.Pub1.Add("\t\n</div>"); switch (this.DoType) { case "UnPass": this.BindUnPass(); break; case "ExpImp": default: this.BindExpImp(); break; } }
protected void Page_Load(object sender, EventArgs e) { MapDtl dtl = new MapDtl(this.FK_MapData); GEDtl dtlEn = dtl.HisGEDtl; dtlEn.SetValByKey("OID", this.OID); dtlEn.RetrieveFromDBSources(); MapAttrs mattrs = new MapAttrs(dtl.No); foreach (MapAttr mattr in mattrs) { if (mattr.DefValReal.Contains("@") == false) { continue; } dtlEn.SetValByKey(mattr.KeyOfEn, mattr.DefVal); } this.Btn_Save.UseSubmitBehavior = false; this.Btn_Save.OnClientClick = "this.disabled=true;"; //this.disabled='disabled'; return true;"; //是否要重新装载数据. bool isLoadData = false; if (this.Request.QueryString["IsLoadData"] == "1") { isLoadData = true; } if (this.Request.QueryString["IsReadonly"] == "1") { isLoadData = false; } this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, this.IsReadonly, 0, isLoadData); if (this.IsReadonly) { this.Btn_Save.Visible = false; this.Btn_Save.Enabled = false; } else { this.Btn_Save.Visible = true; this.Btn_Save.Enabled = true; } }
void btn_Del_Click(object sender, EventArgs e) { try { MapDtl dtl = new MapDtl(); dtl.No = this.FK_MapDtl; dtl.Delete(); this.WinClose(); //this.Response.Redirect("MapDtl.aspx?DoType=DtlList&FK_MapData=" + this.FK_MapData, true); } catch (Exception ex) { this.Alert(ex.Message); } }
public void BindDtl() { BP.Sys.MapDtls dtls = new BP.Sys.MapDtls(); dtls.Retrieve(MapDtlAttr.FK_MapData, this.FK_MapData); this.Pub2.AddTable("width='100%'"); this.Pub2.AddTR(); this.Pub2.AddTDTitle("Idx"); this.Pub2.AddTDTitle("编号"); this.Pub2.AddTDTitle("名称"); this.Pub2.AddTDTitle("原始属性"); this.Pub2.AddTDTitle("编辑"); this.Pub2.AddTDTitle("删除"); this.Pub2.AddTREnd(); int idx = 0; foreach (BP.Sys.MapDtl item in dtls) { if (item.FK_Node != 0) { continue; } idx++; this.Pub2.AddTR(); this.Pub2.AddTDIdx(idx); this.Pub2.AddTD(item.No); this.Pub2.AddTD(item.Name); this.Pub2.AddTD("<a href=\"javascript:EditDtlYuanShi('" + this.FK_MapData + "','" + item.No + "')\">原始属性</a>"); this.Pub2.AddTD("<a href=\"javascript:EditDtl('" + this.FK_Node + "','" + this.FK_MapData + "','" + item.No + "')\">编辑</a>"); MapDtl en = new MapDtl(); en.No = item.No + "_" + this.FK_Node; if (en.RetrieveFromDBSources() == 0) { this.Pub2.AddTD(); } else { this.Pub2.AddTD("<a href=\"javascript:DeleteDtl('" + this.FK_Node + "','" + this.FK_MapData + "','" + item.No + "')\">删除</a>"); } this.Pub2.AddTREnd(); } this.Pub2.AddTableEnd(); }
public string GenerSum(MapAttr mattr, MapDtl dtl) { if (dtl.IsShowSum == false) { return(""); } if (mattr.MyDataType == DataType.AppBoolean) { return(""); } string left = "\n document.forms[0]." + this.Pub1.GetTextBoxByID("TB_" + mattr.KeyOfEn).ClientID + ".value = "; string right = ""; for (int i = 1; i <= dtl.RowsOfList; i++) { string tbID = "TB_" + mattr.KeyOfEn + "_" + i; TextBox tb = this.Pub1.GetTextBoxByID(tbID); if (tb == null) { continue; } if (i == 0) { right += " parseFloat( document.forms[0]." + tb.ClientID + ".value.replace( ',' , '' ) ) "; } else { right += " +parseFloat( document.forms[0]." + tb.ClientID + ".value.replace( ',' , '' ) ) "; } } string s = left + right + " ;"; switch (mattr.MyDataType) { case BP.DA.DataType.AppMoney: case BP.DA.DataType.AppRate: return(s += "\t\n document.forms[0]." + this.Pub1.GetTextBoxByID("TB_" + mattr.KeyOfEn).ClientID + ".value= VirtyMoney(document.forms[0]." + this.Pub1.GetTextBoxByID("TB_" + mattr.KeyOfEn).ClientID + ".value ) ;"); default: return(s); } }
protected void Page_Load(object sender, EventArgs e) { BP.Sys.MapDtls ens = new BP.Sys.MapDtls(); ens.Retrieve(MapDtlAttr.FK_MapData, this.FK_MapData); this.Pub1.AddTable("width='100%'"); this.Pub1.AddCaptionLeft("表单明细表权限."); this.Pub1.AddTR(); this.Pub1.AddTDTitle("Idx"); this.Pub1.AddTDTitle("编号"); this.Pub1.AddTDTitle("名称"); this.Pub1.AddTDTitle("编辑"); this.Pub1.AddTDTitle("删除"); this.Pub1.AddTREnd(); int idx = 0; foreach (BP.Sys.MapDtl item in ens) { if (item.FK_Node != 0) { continue; } idx++; this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx); this.Pub1.AddTD(item.No); this.Pub1.AddTD(item.Name); this.Pub1.AddTD("<a href=\"javascript:Edit('" + this.FK_Node + "','" + this.FK_MapData + "','" + item.No + "')\">编辑</a>"); MapDtl en = new MapDtl(); if (en.RetrieveFromDBSources() == 0) { this.Pub1.AddTD(); } else { this.Pub1.AddTD("<a href=\"javascript:Delete('" + this.FK_Node + "','" + this.FK_MapData + "','" + item.No + "')\">删除</a>"); } this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); }
protected override void afterUpdate() { //修改关联明细表 MapDtl dtl = new MapDtl(); dtl.No = this.No; if (dtl.RetrieveFromDBSources() == 1) { dtl.Name = this.Name; dtl.PTable = this.PTable; dtl.DirectUpdate(); MapData map = new MapData(this.No); //避免显示在表单库中 map.FK_FrmSort = ""; map.FK_FormTree = ""; map.DirectUpdate(); } base.afterUpdate(); }
void btn_Imp_Click(object sender, EventArgs e) { MapDtl dtl = new MapDtl(this.FK_MapDtl); Button btn = sender as Button; if (btn.ID.Contains("ImpClear")) { /*如果是清空方式导入。*/ BP.DA.DBAccess.RunSQL("DELETE FROM " + dtl.PTable + " WHERE RefPK='" + this.WorkID + "'"); } Node nd = new Node(dtl.FK_MapData); MapData md = new MapData(dtl.FK_MapData); string starter = "SELECT Rec FROM " + md.PTable + " WHERE OID=" + this.WorkID; starter = BP.DA.DBAccess.RunSQLReturnString(starter); GEDtls geDtls = new GEDtls(this.FK_MapDtl); geDtls.Retrieve(GEDtlAttr.Rec, starter, "IsPass", "0"); string strs = ""; foreach (GEDtl item in geDtls) { if (this.Pub1.GetCBByID("CB_" + item.OID).Checked == false) { continue; } strs += ",'" + item.OID + "'"; } if (strs == "") { this.Alert("请选择要执行的数据。"); return; } strs = strs.Substring(1); BP.DA.DBAccess.RunSQL("UPDATE " + dtl.PTable + " SET RefPK='" + this.WorkID + "',BatchID=0,Check_Note='',Check_RDT='" + BP.DA.DataType.CurrentDataTime + "', Checker='',IsPass=1 WHERE OID IN (" + strs + ")"); this.WinClose(); }
void btn_DelUnPass_Click(object sender, EventArgs e) { MapDtl dtl = new MapDtl(this.FK_MapDtl); Node nd = new Node(dtl.FK_MapData); MapData md = new MapData(dtl.FK_MapData); string starter = "SELECT Rec FROM " + md.PTable + " WHERE OID=" + this.WorkID; starter = BP.DA.DBAccess.RunSQLReturnString(starter); GEDtls geDtls = new GEDtls(this.FK_MapDtl); geDtls.Retrieve(GEDtlAttr.Rec, starter, "IsPass", "0"); foreach (GEDtl item in geDtls) { if (this.Pub1.GetCBByID("CB_" + item.OID).Checked == false) { continue; } item.Delete(); } this.Response.Redirect(this.Request.RawUrl, true); }
protected void Btn_Save_Click(object sender, EventArgs e) { try { MapDtl dtl = new MapDtl(this.FK_MapData); GEDtl dtlEn = dtl.HisGEDtl; dtlEn.SetValByKey("OID", this.OID); int i = dtlEn.RetrieveFromDBSources(); dtlEn = this.UCEn1.Copy(dtlEn) as GEDtl; dtlEn.SetValByKey(GEDtlAttr.RefPK, this.WorkID); if (i == 0) { dtlEn.OID = 0; dtlEn.Insert(); } else { dtlEn.Update(); } this.Response.Redirect("FrmDtl.aspx?WorkID=" + dtlEn.RefPK + "&FK_MapData=" + this.FK_MapData + "&IsReadonly=" + this.IsReadonly + "&OID=" + dtlEn.OID, true); //if (fes.Contains(FrmEventAttr.FK_Event, FrmEventList.SaveAfter) == true // || fes.Contains(FrmEventAttr.FK_Event, FrmEventList.SaveBefore) == true) //{ // /*如果包含保存*/ // // /FrmDtl.aspx?FK_MapData=ND11699Dtl1&WorkID=2078&OID=7365&IsReadonly=False // this.Response.Redirect(this.Request.RawUrl, true); // //this.Response.Redirect("FrmDtl.aspx?WorkID=" + this.WorkID + "&FK_MapData=" + this.FK_MapData + "&IsReadonly="+this.IsReadonly, true); //} } catch (Exception ex) { this.UCEn1.AddMsgOfWarning("error:", ex.Message); } }
protected override void afterUpdate() { //修改关联明细表 MapDtl dtl = new MapDtl(); dtl.No = this.No; if (dtl.RetrieveFromDBSources() == 1) { dtl.Name = this.Name; dtl.PTable = this.PTable; dtl.DirectUpdate(); MapData map = new MapData(this.No); //避免显示在表单库中 map.FK_FrmSort = ""; map.FK_FormTree = ""; map.DirectUpdate(); } //调用frmEditAction, 完成其他的操作. BP.Sys.CCFormAPI.AfterFrmEditAction(this.No); base.afterUpdate(); }
protected void Page_Load(object sender, EventArgs e) { #region 载入相关文件. this.Page.RegisterClientScriptBlock("sguw", "<link href='./Style/Frm/Tab.css' rel='stylesheet' type='text/css' />"); this.Page.RegisterClientScriptBlock("s2g4uh", "<script language='JavaScript' src='./Style/Frm/jquery.min.js' ></script>"); this.Page.RegisterClientScriptBlock("sdfuy24j", "<script language='JavaScript' src='./Style/Frm/jquery.idTabs.min.js' ></script>"); #endregion 载入相关文件. #region 查询出来从表. MapDtl mdtl = new MapDtl(this.EnsName); GEDtls dtls = new GEDtls(this.EnsName); QueryObject qo = null; try { qo = new QueryObject(dtls); switch (mdtl.DtlOpenType) { case DtlOpenType.ForEmp: qo.AddWhere(GEDtlAttr.RefPK, this.RefPKVal); break; case DtlOpenType.ForWorkID: qo.AddWhere(GEDtlAttr.RefPK, this.RefPKVal); break; case DtlOpenType.ForFID: qo.AddWhere(GEDtlAttr.FID, this.RefPKVal); break; } qo.DoQuery(); } catch (Exception ex) { dtls.GetNewEntity.CheckPhysicsTable(); throw ex; //#region 解决Access 不刷新的问题。 //string rowUrl = this.Request.RawUrl; //if (rowUrl.IndexOf("rowUrl") > 1) //{ // throw ex; //} //else //{ // //this.Response.Redirect(rowUrl + "&rowUrl=1&IsWap=" + this.IsWap, true); // return; //} //#endregion } #endregion 查询出来从表. #region 初始化空白行 if (this.IsReadonly == false) { mdtl.RowsOfList = mdtl.RowsOfList + this.addRowNum; int num = dtls.Count; if (mdtl.IsInsert) { int dtlCount = dtls.Count; for (int i = 0; i < mdtl.RowsOfList - dtlCount; i++) { BP.Sys.GEDtl dt = new GEDtl(this.EnsName); dt.ResetDefaultVal(); dt.OID = i; dtls.AddEntity(dt); } if (num == mdtl.RowsOfList) { BP.Sys.GEDtl dt1 = new GEDtl(this.EnsName); dt1.ResetDefaultVal(); dt1.OID = mdtl.RowsOfList + 1; dtls.AddEntity(dt1); } } } #endregion 初始化空白行 MapData md = new MapData(mdtl.No); this.UCEn1.Clear(); this.UCEn1.Add("\t\n<div class=\"easyui-tabs\" fit=\"true\" border=\"false\" style='width:" + md.FrmW + "px;height:" + md.FrmH + "px;' data-options=\"tools:'#tab-tools'\">"); //begain. #region 输出标签. int idx = 0; int dtlsNum = dtls.Count; foreach (GEDtl dtl in dtls) { idx++; this.UCEn1.Add("\t\n<div id=" + idx + " title='第" + idx + "条' style='overflow: auto;'>"); string src = ""; src = "FrmDtl.aspx?FK_MapData=" + this.EnsName + "&WorkID=" + this.RefPKVal + "&OID=" + dtl.OID + "&IsReadonly=" + this.IsReadonly; this.UCEn1.Add("\t\n<iframe id='IF" + idx + "' Onblur=\"SaveDtlData('" + idx + "');\" frameborder='0' style='width:" + md.FrmW + "px;height:" + md.FrmH + "px;' src=\"" + src + "\"></iframe>"); this.UCEn1.Add("\t\n</div>"); } this.UCEn1.Add("\t\n </div>"); if (this.IsReadonly == false && mdtl.IsInsert) { int addNum = addRowNum + 1; int cutNum = addRowNum - 1; this.UCEn1.Add("\t\n<div id=\"tab-tools\">"); if (cutNum >= 0) { this.UCEn1.Add("\t\n<a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + cutNum + "' class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-reload'\">移除</a>"); this.UCEn1.Add("\t\n<a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + addNum + "' class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'icon-reload'\">插入</a>"); } else { this.UCEn1.Add("\t\n<a href='DtlCard.aspx?EnsName=" + this.EnsName + "&RefPKVal=" + this.RefPKVal + "&addRowNum=" + addNum + "' >插入</a>"); } this.UCEn1.Add("\t\n</div>"); } #endregion 输出标签. if (this.IsReadonly == false) { } #region 处理iFrom SaveDtlData。 //string js = ""; //js = "\t\n<script type='text/javascript' >"; //js += "\t\n function SaveDtl(dtl) { "; //js += "\t\n document.getElementById('F' + dtl ).contentWindow.SaveDtlData();"; //js += "\t\n } "; //js += "\t\n</script>"; //this.UCEn1.Add(js); #endregion 处理iFrom SaveDtlData。 }
public void BindAttrs() { MapDtl dtlFrom = new MapDtl(this.Dtl); MapDtl dtl = new MapDtl(this.MyPK); MapAttrs attrsFrom = new MapAttrs(this.Dtl); MapAttrs attrs = new MapAttrs(dtl.No); this.AddTable(); this.AddCaptionLeft("<A href='CopyDtlField.aspx?MyPK=" + this.MyPK + "'>返回</A> - 选择要复制的字段"); this.AddTR(); this.AddTDTitle("IDX"); this.AddTDTitle("名称"); this.AddTDTitle("字段"); this.AddTDTitle("类型"); this.AddTDTitle("默认值"); this.AddTREnd(); bool isHave = false; int idx = 0; foreach (MapAttr attr in attrsFrom) { switch (attr.KeyOfEn) { case "OID": case "FID": case "WorkID": case "Rec": case "RDT": continue; default: break; } idx++; this.AddTR(); this.AddTDIdx(idx); CheckBox cb = new CheckBox(); cb.ID = "CB_" + attr.MyPK; cb.Text = attr.Name; if (attrs.Contains(MapAttrAttr.KeyOfEn, attr.KeyOfEn)) { cb.Enabled = false; } this.AddTD("nowarp=true", cb); this.AddTD(attr.KeyOfEn); this.AddTD(attr.MyDataTypeStr); this.AddTD(attr.DefValReal); isHave = true; this.AddTREnd(); } idx++; this.AddTRSum(); this.AddTDIdx(idx); this.AddTD(); Button btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_Copy"; btn.Text = "复制"; btn.Click += new EventHandler(btn_Click); btn.Enabled = isHave; this.AddTD("colspan=3", btn); this.AddTREnd(); this.AddTableEnd(); }
protected void Page_Load(object sender, EventArgs e) { if (this.DoType == "Del") { FrmEvent delFE = new FrmEvent(); delFE.MyPK = this.FK_MapData + "_" + this.Request.QueryString["RefXml"]; delFE.Delete(); } MapDtl dtl = new MapDtl(this.FK_MapData); this.Pub3.AddCaptionLeft("从表:" + dtl.Name); this.Title = "设置:从表事件"; FrmEvents ndevs = new FrmEvents(); ndevs.Retrieve(FrmEventAttr.FK_MapData, this.FK_MapData); EventListDtls xmls = new EventListDtls(); xmls.RetrieveAll(); string myEvent = this.Event; BP.WF.XML.EventListDtl myEnentXml = null; this.Pub1.Add("<a href='http://ccflow.org' target=_blank ><img src='/DataUser/ICON/" + SystemConfig.CompanyID + "/LogBiger.png' /></a>"); this.Pub1.AddUL(); foreach (BP.WF.XML.EventListDtl xml in xmls) { FrmEvent nde = ndevs.GetEntityByKey(FrmEventAttr.FK_Event, xml.No) as FrmEvent; if (nde == null) { if (myEvent == xml.No) { myEnentXml = xml; this.Pub1.AddLi("<font color=green><b>" + xml.Name + "</b></font>"); } else { this.Pub1.AddLi("Action.aspx?FK_MapData=" + this.FK_MapData + "&Event=" + xml.No, xml.Name); } } else { if (myEvent == xml.No) { myEnentXml = xml; this.Pub1.AddLi("<font color=green><b>" + xml.Name + "</b></font>"); } else { this.Pub1.AddLi("Action.aspx?FK_MapData=" + this.FK_MapData + "&Event=" + xml.No + "&MyPK=" + nde.MyPK, "<b>" + xml.Name + "</b>"); } } } this.Pub1.AddULEnd(); if (myEnentXml == null) { this.Pub2.AddFieldSet("帮助"); this.Pub2.AddH2("事件是ccflow与您的应用程序接口,"); this.Pub2.AddFieldSetEnd(); return; } FrmEvent mynde = ndevs.GetEntityByKey(FrmEventAttr.FK_Event, myEvent) as FrmEvent; if (mynde == null) { mynde = new FrmEvent(); } this.Pub2.AddFieldSet(myEnentXml.Name); this.Pub2.Add("要执行的内容<br>"); TextBox tb = new TextBox(); tb.ID = "TB_Doc"; tb.Columns = 70; tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 5; tb.Text = mynde.DoDoc; this.Pub2.Add(tb); this.Pub2.AddHR(); this.Pub2.Add("内容类型:"); DDL ddl = new DDL(); ddl.BindSysEnum("EventDoType"); ddl.ID = "DDL_EventDoType"; ddl.SetSelectItem((int)mynde.HisDoType); this.Pub2.Add(ddl); this.Pub2.AddHR(); tb = new TextBox(); tb.ID = "TB_MsgOK"; tb.Columns = 70; tb.Text = mynde.MsgOKString; tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 3; this.Pub2.Add("执行成功信息提示<br>"); this.Pub2.Add(tb); this.Pub2.AddHR(); this.Pub2.Add("执行失败信息提示<br>"); tb = new TextBox(); tb.ID = "TB_MsgErr"; tb.Columns = 70; tb.Text = mynde.MsgErrorString; tb.TextMode = TextBoxMode.MultiLine; tb.Rows = 3; this.Pub2.Add(tb); this.Pub2.AddFieldSetEnd(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = " Save "; btn.Click += new EventHandler(btn_Click); this.Pub2.Add(btn); if (this.MyPK != null) { this.Pub2.Add(" <a href=\"javascript:DoDel('" + this.FK_MapData + "','" + this.Event + "')\"><img src='/WF/Img/Btn/Delete.gif' />删除</a>"); } }
void btn_Click(object sender, EventArgs e) { MapDtls dtl2s = new MapDtls(); dtl2s.Delete(MapDtlAttr.FK_MapData, this.MyPK); Nodes nds = new Nodes(BP.WF.Glo.GenerFlowNo(this.MyPK)); foreach (BP.WF.Node nd in nds) { if (nd.IsEndNode == false) { continue; } MapDtls dtls = new MapDtls("ND" + nd.NodeID); int i = 0; foreach (MapDtl dtl in dtls) { if (this.Pub1.GetCBByID("CB_" + dtl.No).Checked == false) { continue; } i++; // 生成从表让其可以在单个数据里显示他们。 MapDtl dtlNew = new MapDtl(); dtlNew.Copy(dtl); dtlNew.No = this.MyPK + i; dtlNew.FK_MapData = this.MyPK; dtlNew.GroupID = this.Pub1.GetDDLByID("DDL_" + dtl.No).SelectedItemIntVal; dtlNew.Insert(); // 删除原来的数据。 MapAttrs attrsDtl = new MapAttrs(); attrsDtl.Delete(MapAttrAttr.FK_MapData, dtlNew.No); // 复制到新的数据表里。 MapAttrs attrs = new MapAttrs(dtl.No); foreach (MapAttr attr in attrs) { MapAttr attrN = new MapAttr(); attrN.Copy(attr); attrN.FK_MapData = dtlNew.No; attrN.Insert(); } Cash.Map_Cash.Remove(dtlNew.No); #region 制成 主表.让其可以查询。 // 处理主表。 MapData md = new MapData(); md.Copy(dtlNew); md.No = "ND" + int.Parse(this.FK_Flow) + "RptDtl" + i.ToString(); md.Save(); // 删除原来的属性。 attrs.Delete(MapAttrAttr.FK_MapData, md.No); // 删除分组。 GroupField gfBase = new GroupField(); gfBase.Delete(GroupFieldAttr.EnName, md.No); // 增加基本信息分组。 gfBase.EnName = md.No; gfBase.Lab = md.Name; gfBase.Idx = 99; gfBase.Insert(); //生成基本信息属性。 foreach (MapAttr attr in attrs) { MapAttr attrN = new MapAttr(); attrN.Copy(attr); attrN.FK_MapData = md.No; attrN.GroupID = gfBase.OID; attrN.Insert(); } MapAttrs attrNs = new MapAttrs(md.No); // 对个别字段进行处理。 foreach (MapAttr attr in attrNs) { switch (attr.KeyOfEn) { case StartWorkAttr.FK_Dept: continue; //if (attr.UIContralType != UIContralType.DDL) //{ //attr.UIBindKey = "BP.Port.Depts"; //attr.UIContralType = UIContralType.DDL; //attr.LGType = FieldTypeS.FK; //attr.UIVisible = true; //// if (gfs.Contains(attr.GroupID) == false) //attr.GroupID = gfBase.OID;// gfs[0].GetValIntByKey("OID"); //attr.Update(); //// } break; case "FK_NY": //attr.Delete(); ////if (attr.UIContralType != UIContralType.DDL) ////{ //attr.UIBindKey = "BP.Pub.NYs"; //attr.UIContralType = UIContralType.DDL; //attr.LGType = FieldTypeS.FK; //attr.UIVisible = true; //// if (gfs.Contains(attr.GroupID) == false) //attr.GroupID = gfBase.OID; // gfs[0].GetValIntByKey("OID"); //attr.Update(); break; case "Rec": attr.UIBindKey = "BP.Port.Emps"; attr.UIContralType = UIContralType.DDL; attr.LGType = FieldTypeS.FK; attr.UIVisible = true; attr.Name = "最后处理人"; attr.GroupID = gfBase.OID; attr.Update(); break; default: break; } } // 生成流程基本信息属性。 GroupField gfFlow = new GroupField(); gfFlow.EnName = md.No; gfFlow.Idx = 0; gfFlow.Lab = "流程信息"; gfFlow.Insert(); MapAttr attrFlow = new BP.Sys.MapAttr(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "Title"; attrFlow.Name = "标题"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = true; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStarter"; attrFlow.Name = "发起人"; //"发起人"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Port.Emps"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.UIIsLine = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStarterDept"; attrFlow.Name = "发起人部门"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Port.Depts"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowEmps"; attrFlow.Name = "参与人"; // attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = false; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowStartRDT"; attrFlow.Name = "发起时间"; // attrFlow.MyDataType = BP.DA.DataType.AppDateTime; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = true; attrFlow.UIIsEnable = true; attrFlow.UIIsLine = false; attrFlow.MinLen = 0; attrFlow.MaxLen = 1000; attrFlow.IDX = -100; attrFlow.GroupID = gfFlow.OID; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "FlowNY"; attrFlow.Name = "隶属年月"; attrFlow.MyDataType = BP.DA.DataType.AppString; attrFlow.UIContralType = UIContralType.DDL; attrFlow.UIBindKey = "BP.Pub.NYs"; attrFlow.LGType = FieldTypeS.FK; attrFlow.UIVisible = true; attrFlow.UIIsEnable = false; attrFlow.MaxLen = 20; attrFlow.MinLen = 0; attrFlow.Insert(); attrFlow = new BP.Sys.MapAttr(); attrFlow.FK_MapData = md.No; attrFlow.HisEditType = EditType.UnDel; attrFlow.KeyOfEn = "MyNum"; attrFlow.Name = "条"; // attrFlow.MyDataType = BP.DA.DataType.AppInt; attrFlow.DefVal = "1"; attrFlow.UIContralType = UIContralType.TB; attrFlow.LGType = FieldTypeS.Normal; attrFlow.UIVisible = false; attrFlow.UIIsEnable = false; attrFlow.UIIsLine = false; attrFlow.IDX = -101; attrFlow.GroupID = gfFlow.OID; if (attrFlow.IsExits == false) { attrFlow.Insert(); } // 清除缓存的map. Cash.Map_Cash.Remove(md.No); //检查主表的正确性。 GEEntity ge = new GEEntity(md.No); ge.CheckPhysicsTable(); #endregion 制成 主表.让其可以查询。 } } this.WinClose(); }
public void BindEdit(MapData md, MapDtl dtl) { this.Pub1.AddTable(); this.Pub1.AddCaptionLeft("从表属性"); 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_No"; tb.Text = dtl.No; if (this.DoType == "Edit") { tb.Enabled = false; } this.Pub1.AddTD(tb); this.Pub1.AddTD(); //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; this.Pub1.AddTD(tb); this.Pub1.AddTD("XX 从表"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("物理表名"); tb = new TB(); tb.ID = "TB_PTable"; tb.Text = dtl.PTable; this.Pub1.AddTD(tb); this.Pub1.AddTD(); //this.Pub1.AddTD("存储数据的物理表名称"); // this.Pub1.AddTD("存储数据的物理表名称"); this.Pub1.AddTREnd(); this.Pub1.AddTR1(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("操作权限"); DDL ddl = new DDL(); ddl.BindSysEnum(MapDtlAttr.DtlOpenType, (int)dtl.DtlOpenType); ddl.ID = "DDL_DtlOpenType"; this.Pub1.AddTD(ddl); this.Pub1.AddTD(); // this.Pub1.AddTD("用于从表的权限控制"); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); CheckBox cb = new CheckBox(); cb.ID = "CB_IsView"; cb.Text = "是否可见"; cb.Checked = dtl.IsView; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsUpdate"; cb.Text = "是否可以修改行"; // "是否可以修改行"; cb.Checked = dtl.IsUpdate; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsInsert"; cb.Text = "是否可以新增行"; // "是否可以新增行"; cb.Checked = dtl.IsInsert; this.Pub1.AddTD(cb); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); cb = new CheckBox(); cb.ID = "CB_IsDelete"; cb.Text = "是否可以删除行"; // "是否可以删除行"; cb.Checked = dtl.IsDelete; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsShowIdx"; cb.Text = "是否显示序号列"; //"是否显示序号列"; cb.Checked = dtl.IsShowIdx; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsShowSum"; cb.Text = "是否合计行";// "是否合计行"; cb.Checked = dtl.IsShowSum; this.Pub1.AddTD(cb); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); cb = new CheckBox(); cb.ID = "CB_IsShowTitle"; cb.Text = "是否显示标头";// "是否显示标头"; cb.Checked = dtl.IsShowTitle; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsExp"; cb.Text = "是否可以导出?";// "是否可以导出"; cb.Checked = dtl.IsShowTitle; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsImp"; cb.Text = "是否可以导入?";// "是否可以导出"; cb.Checked = dtl.IsShowTitle; this.Pub1.AddTD(cb); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); cb = new CheckBox(); cb.ID = "CB_IsCopyNDData"; cb.Text = "是允许从上一个节点Copy数据"; cb.Checked = dtl.IsCopyNDData; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_IsHLDtl"; cb.Text = "是否是合流汇总从表(当前节点是合流节点有效)"; cb.Checked = dtl.IsHLDtl; this.Pub1.AddTD("colspan=2", cb); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); cb = new CheckBox(); cb.ID = "CB_IsEnableAthM"; cb.Text = "是否启用多附件"; cb.Checked = dtl.IsEnableAthM; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_" + MapDtlAttr.IsEnableM2M; cb.Text = "是否启用一对多"; cb.Checked = dtl.IsEnableM2M; this.Pub1.AddTD(cb); cb = new CheckBox(); cb.ID = "CB_" + MapDtlAttr.IsEnableM2MM; cb.Text = "是否启用一对多多"; cb.Checked = dtl.IsEnableM2MM; this.Pub1.AddTD(cb); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); cb = new CheckBox(); cb.ID = "CB_IsEnablePass"; cb.Text = "是否起用审核字段?";// "是否合计行"; cb.Checked = dtl.IsEnablePass; this.Pub1.AddTD(cb); this.Pub1.AddTD(); this.Pub1.AddTD(); this.Pub1.AddTREnd(); //cb = new CheckBox(); //cb.ID = "CB_IsEnableAth"; //cb.Text = "是否启用单附件"; //cb.Checked = dtl.IsEnablePass; //this.Pub1.AddTD(cb); //this.Pub1.AddTREnd(); this.Pub1.AddTR1(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("初始化行数"); tb = new TB(); tb.ID = "TB_RowsOfList"; tb.Attributes["class"] = "TBNum"; tb.TextExtInt = dtl.RowsOfList; this.Pub1.AddTD(tb); this.Pub1.AddTD(""); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("显示格式"); ddl = new DDL(); ddl.ID = "DDL_DtlShowModel"; ddl.BindSysEnum(MapDtlAttr.DtlShowModel, (int)dtl.HisDtlShowModel); this.Pub1.AddTD(ddl); this.Pub1.AddTD(); this.Pub1.AddTREnd(); this.Pub1.AddTR(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("越出处理"); ddl = new DDL(); ddl.ID = "DDL_WhenOverSize"; ddl.BindSysEnum(MapDtlAttr.WhenOverSize, (int)dtl.HisWhenOverSize); this.Pub1.AddTD(ddl); this.Pub1.AddTD(); this.Pub1.AddTREnd(); GroupFields gfs = new GroupFields(md.No); if (gfs.Count > 1) { this.Pub1.AddTR1(); this.Pub1.AddTDIdx(idx++); this.Pub1.AddTD("显示在分组"); 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(); } if (gfs.Count > 1) { this.Pub1.AddTR(); } else { this.Pub1.AddTR1(); } this.Pub1.AddTRSum(); this.Pub1.AddTD(""); this.Pub1.AddTDBegin("colspan=3 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_MapDtl != null) { //btn = new Button(); //btn.ID = "Btn_D"; //btn.Text = this.ToE("DesignSheet", "设计表单"); // "设计表单"; //btn.Click += new EventHandler(btn_Go_Click); //this.Pub1.Add(btn); 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); btn = new Button(); btn.ID = "Btn_MapExt"; btn.CssClass = "Btn"; btn.Text = "扩展设置"; // "删除"; btn.Click += new EventHandler(btn_MapExt_Click); this.Pub1.Add(btn); if (dtl.IsEnableAthM) { btn = new Button(); btn.CssClass = "Btn"; btn.ID = "Btn_IsEnableAthM"; btn.Text = "附件属性"; // "删除"; btn.Click += new EventHandler(btn_MapAth_Click); this.Pub1.Add(btn); } // btn = new Button(); // btn.ID = "Btn_DtlTR"; // btn.Text = "多表头"; // btn.Attributes["onclick"] = "javascript:WinOpen('')"; //// btn.Click += new EventHandler(btn_DtlTR_Click); // this.Pub1.Add(btn); } this.Pub1.AddTDEnd(); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); }
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;"; } }
void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; try { switch (this.DoType) { case "New": default: MapDtl dtlN = new MapDtl(); dtlN = (MapDtl)this.Pub1.Copy(dtlN); if (this.DoType == "New") { if (dtlN.IsExits) { this.Alert("已存在编号:" + dtlN.No); return; } } dtlN.FK_MapData = this.FK_MapData; dtlN.GroupID = 0; dtlN.RowIdx = 0; GroupFields gfs1 = new GroupFields(this.FK_MapData); if (gfs1.Count == 1) { GroupField gf = (GroupField)gfs1[0]; dtlN.GroupID = gf.OID; } else { dtlN.GroupID = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemIntVal; } dtlN.Insert(); if (btn.ID.Contains("AndClose")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtlN.No + "&FK_MapData=" + this.FK_MapData, true); break; case "Edit": MapDtl dtl = new MapDtl(this.FK_MapDtl); dtl = (MapDtl)this.Pub1.Copy(dtl); if (this.DoType == "New") { if (dtl.IsExits) { this.Alert("已存在编号:" + dtl.No); return; } } dtl.FK_MapData = this.FK_MapData; GroupFields gfs = new GroupFields(dtl.FK_MapData); if (gfs.Count > 1) { dtl.GroupID = this.Pub1.GetDDLByID("DDL_GroupField").SelectedItemIntVal; } if (this.DoType == "New") { dtl.Insert(); } else { dtl.Update(); } if (btn.ID.Contains("AndC")) { this.WinClose(); return; } this.Response.Redirect("MapDtl.aspx?DoType=Edit&FK_MapDtl=" + dtl.No + "&FK_MapData=" + this.FK_MapData, true); break; } } catch (Exception ex) { this.Alert(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { this.Title = "从表设计"; MapData.IsEditDtlModel = true; MapData md = new MapData(this.FK_MapData); MapDtl dtl = new MapDtl(this.FK_MapDtl); if (dtl.IsView == false) { return; } MapAttrs attrs = new MapAttrs(this.MyPK); MapAttrs attrs2 = new MapAttrs(); MapExts mes = new MapExts(this.MyPK); string LinkFields = ","; if (mes.Count != 0) { foreach (MapExt me in mes) { switch (me.ExtType) { case MapExtXmlList.Link: LinkFields += me.AttrOfOper + ","; break; default: break; } } this.Page.RegisterClientScriptBlock("s8", "<script language='JavaScript' src='../Scripts/jquery-1.4.1.min.js' ></script>"); this.Page.RegisterClientScriptBlock("b8", "<script language='JavaScript' src='../CCForm/MapExt.js' ></script>"); this.Page.RegisterClientScriptBlock("dCd", "<script language='JavaScript' src='/DataUser/JSLibData/" + this.FK_MapDtl + ".js' ></script>"); this.Pub1.Add("<div id='divinfo' style='width: 155px; position: absolute; color: Lime; display: none;cursor: pointer;align:left'></div>"); } string t = DateTime.Now.ToString("MM-dd-hh:mm:ss"); if (attrs.Count == 0) { dtl.IntMapAttrs(); } this.Title = md.Name + " - 设计明细"; this.Pub1.AddTable("class='Table' border='0' ID='Tab' cellspacing='0' cellpadding='0' "); // this.Pub1.AddCaptionLeftTX("<a href='MapDef.aspx?MyPK=" + md.No + "' ><img src='../Img/Btn/Back.gif' border=0/>" + this.ToE("Back","返回") + ":" + md.Name + "</a> - <img src='../Img/Btn/Table.gif' border=0/>" + dtl.Name + " - <a href=\"javascript:AddF('" + this.MyPK + "');\" ><img src='../Img/Btn/New.gif' border=0/>" + "新建字段" + "</a> "); this.Pub1.Add(dtl.MTR); #region 输出标题. this.Pub1.AddTR(); if (dtl.IsShowIdx) { this.Pub1.AddTDTitle(""); } foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } this.Pub1.Add("<TH style='width:" + attr.UIWidthInt + "px'>"); this.Pub1.Add("<a href=\"javascript:Up('" + this.MyPK + "','" + attr.MyPK + "','" + t + "');\" ><img src='../Img/Btn/Left.gif' class=Arrow alt='向左移动' border=0/></a>"); if (attr.HisEditType == EditType.UnDel || attr.HisEditType == EditType.Edit) { switch (attr.LGType) { case FieldTypeS.Normal: this.Pub1.Add("<a href=\"javascript:Edit('" + this.MyPK + "','" + attr.MyPK + "','" + attr.MyDataType + "');\" alt='" + attr.KeyOfEn + "'>" + attr.Name + "</a>"); break; case FieldTypeS.Enum: this.Pub1.Add("<a href=\"javascript:EditEnum('" + this.MyPK + "','" + attr.MyPK + "');\" alt='" + attr.KeyOfEn + "' >" + attr.Name + "</a>"); break; case FieldTypeS.FK: this.Pub1.Add("<a href=\"javascript:EditTable('" + this.MyPK + "','" + attr.MyPK + "','" + attr.MyDataTypeS + "');\" alt='" + attr.KeyOfEn + "'>" + attr.Name + "</a>"); break; default: break; } } else { this.Pub1.Add(attr.Name); } // this.Pub1.Add("[<a href=\"javascript:Insert('" + this.MyPK + "','" + attr.Idx + "');\" ><img src='../Img/Btn/Insert.gif' border=0/>插入</a>]"); this.Pub1.Add("<a href=\"javascript:Down('" + this.MyPK + "','" + attr.MyPK + "','" + t + "');\" ><img src='../Img/Btn/Right.gif' class=Arrow alt='向右移动' border=0/></a>"); this.Pub1.Add("</TH>"); } if (dtl.IsEnableAthM) { this.Pub1.AddTDTitle("<a href=\"javascript:Attachment('" + dtl.No + "');\"><img src='./../Img/set.gif' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2M) { this.Pub1.AddTDTitle("<a href=\"javascript:MapM2M('" + dtl.No + "');\"><img src='./../Img/set.gif' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2MM) { this.Pub1.AddTDTitle("<a href=\"javascript:window.showModalDialog('MapM2MM.aspx?NoOfObj=M2MM&FK_MapData=" + this.FK_MapDtl + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='./../Img/set.gif' border=0 width='16px' /></a>"); } if (dtl.IsEnableLink) { this.Pub1.AddTDTitle(dtl.LinkLabel); } //Pub1.AddTDTitle(" "); this.Pub1.AddTREnd(); #endregion 输出标题. #region 输出行. for (int i = 1; i <= dtl.RowsOfList; i++) { this.Pub1.AddTR(); if (dtl.IsShowIdx) { this.Pub1.AddTDIdx(i); } foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } #region 是否输出超连接. if (attr.UIIsEnable == false && LinkFields.Contains("," + attr.KeyOfEn + ",")) { MapExt meLink = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.Link) as MapExt; string url = meLink.Tag; if (url.Contains("?") == false) { url = url + "?a3=2"; } url = url + "&WebUserNo=" + WebUser.No + "&SID=" + WebUser.SID + "&EnName=" + this.FK_MapDtl; if (url.Contains("@AppPath")) { url = url.Replace("@AppPath", "http://" + this.Request.Url.Host + this.Request.ApplicationPath); } if (url.Contains("@")) { if (attrs2.Count == 0) { attrs2 = new MapAttrs(this.FK_MapDtl); } foreach (MapAttr item in attrs2) { url = url.Replace("@" + item.KeyOfEn, item.DefVal); if (url.Contains("@") == false) { break; } } } this.Pub1.AddTD("<a href='" + url + "' target='" + meLink.Tag1 + "' >" + attr.DefVal + "</a>"); continue; } #endregion 是否输出超连接. #region 输出字段. switch (attr.LGType) { case FieldTypeS.Normal: if (attr.MyDataType == BP.DA.DataType.AppBoolean) { CheckBox cb = new CheckBox(); cb.Checked = attr.DefValOfBool; cb.Enabled = attr.UIIsEnable; cb.Text = attr.Name; this.Pub1.AddTD(cb); break; } TextBox tb = new TextBox(); tb.ID = "TB_" + attr.KeyOfEn + "_" + i; tb.Text = attr.DefVal; tb.ReadOnly = !attr.UIIsEnable; this.Pub1.AddTD(tb); switch (attr.MyDataType) { case BP.DA.DataType.AppString: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (attr.UIHeight > 25) { tb.TextMode = TextBoxMode.MultiLine; tb.Attributes["Height"] = attr.UIHeight + "px"; tb.Rows = attr.UIHeightInt / 25; } break; case BP.DA.DataType.AppDateTime: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});"; //tb.Attributes["class"] = "TBcalendar"; } break; case BP.DA.DataType.AppDate: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (attr.UIIsEnable) { tb.Attributes["onfocus"] = "WdatePicker();"; // tb.Attributes["class"] = "TBcalendar"; } break; default: tb.Attributes["style"] = "width:" + attr.UIWidth + "px;border: none;"; if (tb.ReadOnly == false) { // OnKeyPress="javascript:return VirtyNum(this);" //tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);"; if (attr.MyDataType == DataType.AppInt) { tb.Attributes["OnKeyDown"] = "javascript:return VirtyInt(this);"; } else { tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);"; } tb.Attributes["onkeyup"] += "javascript:C" + i + "();C" + attr.KeyOfEn + "();"; tb.Attributes["class"] = "TBNum"; } else { // tb.Attributes["onpropertychange"] += "C" + attr.KeyOfEn + "();"; tb.Attributes["class"] = "TBNumReadonly"; } break; } break; case FieldTypeS.Enum: DDL ddl = new DDL(); ddl.ID = "DDL_" + attr.KeyOfEn + "_" + i; try { ddl.BindSysEnum(attr.KeyOfEn); ddl.SetSelectItem(attr.DefVal); } catch (Exception ex) { BP.Sys.PubClass.Alert(ex.Message); } ddl.Enabled = attr.UIIsEnable; this.Pub1.AddTDCenter(ddl); break; case FieldTypeS.FK: DDL ddl1 = new DDL(); ddl1.ID = "DDL_" + attr.KeyOfEn + "_" + i; try { EntitiesNoName ens = attr.HisEntitiesNoName; ens.RetrieveAll(); ddl1.BindEntities(ens); if (ddl1.SetSelectItem(attr.DefVal) == false) { ddl1.Items.Insert(0, new ListItem("请选择", attr.DefVal)); ddl1.SelectedIndex = 0; } } catch { } ddl1.Enabled = attr.UIIsEnable; this.Pub1.AddTDCenter(ddl1); break; default: break; } #endregion s输出字段. } #region 输出附件,m2m if (dtl.IsEnableAthM) { this.Pub1.AddTD("<a href=\"javascript:EnableAthM('" + this.FK_MapDtl + "');\" ><img src='../Img/AttachmentM.png' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2M) { this.Pub1.AddTD("<a href=\"javascript:window.showModalDialog('../CCForm/M2M.aspx?NoOfObj=M2M&IsTest=1&OID=0&FK_MapData=" + this.FK_MapDtl + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='./../Img/M2M.png' border=0 width='16px' /></a>"); } if (dtl.IsEnableM2MM) { this.Pub1.AddTD("<a href=\"javascript:window.showModalDialog('../CCForm/M2MM.aspx?NoOfObj=M2MM&IsTest=1&OID=0&FK_MapData=" + this.FK_MapDtl + "','m2m','dialogHeight: 500px; dialogWidth: 600px;center: yes; help: no')\"><img src='./../Img/M2MM.png' border=0 width='16px' /></a>"); } if (dtl.IsEnableLink) { this.Pub1.AddTD("<a href='" + dtl.LinkUrl + "' target='" + dtl.LinkTarget + "' >" + dtl.LinkLabel + "</a>"); } #endregion 输出附件,m2m //Pub1.AddTD(" "); this.Pub1.AddTREnd(); } #endregion 输出行. #region 合计. if (dtl.IsShowSum) { this.Pub1.AddTRSum(); if (dtl.IsShowIdx) { this.Pub1.AddTD("合计"); } foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.IsNum && attr.LGType == FieldTypeS.Normal) { TB tb = new TB(); tb.ID = "TB_" + attr.KeyOfEn; tb.Text = attr.DefVal; tb.ShowType = attr.HisTBType; tb.ReadOnly = true; tb.Font.Bold = true; tb.BackColor = System.Drawing.Color.FromName("#FFFFFF"); tb.Attributes["class"] = "TBNumReadonly"; this.Pub1.AddTD(tb); } else { this.Pub1.AddTD(); } } if (dtl.IsEnableAthM) { this.Pub1.AddTD(); } if (dtl.IsEnableM2M) { this.Pub1.AddTD(); } if (dtl.IsEnableM2MM) { this.Pub1.AddTD(); } if (dtl.IsEnableLink) { this.Pub1.AddTD(); } // Pub1.AddTD(" "); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); #endregion 合计. #region 处理设计时自动填充从表. if (this.Key != null) { MapExt me = new MapExt(this.FK_MapExt); string[] strs = me.Tag1.Split('$'); foreach (string str in strs) { if (str.Contains(this.FK_MapDtl) == false) { continue; } string[] ss = str.Split(':'); string sql = ss[1]; sql = sql.Replace("@Key", this.Key); sql = sql.Replace("@key", this.Key); sql = sql.Replace("@val", this.Key); sql = sql.Replace("@Val", this.Key); DataTable dt = DBAccess.RunSQLReturnTable(sql); int idx = 0; foreach (DataRow dr in dt.Rows) { idx++; foreach (DataColumn dc in dt.Columns) { string val = dr[dc.ColumnName].ToString(); try { this.Pub1.GetTextBoxByID("TB_" + dc.ColumnName + "_" + idx).Text = val; } catch { } try { this.Pub1.GetDDLByID("DDL_" + dc.ColumnName + "_" + idx).SetSelectItem(val); } catch { } } } } } #endregion 处理设计时自动填充从表. #region 处理拓展属性. for (int i = 1; i <= dtl.RowsOfList; i++) { foreach (MapExt me in mes) { switch (me.ExtType) { case MapExtXmlList.DDLFullCtrl: // 自动填充. DDL ddlOper = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper); if (ddlOper == null) { continue; } ddlOper.Attributes["onchange"] = "DDLFullCtrl(this.value,\'" + ddlOper.ClientID + "\', \'" + me.MyPK + "\')"; break; case MapExtXmlList.ActiveDDL: DDL ddlPerant = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + i); if (ddlPerant == null) { me.Delete(); continue; } DDL ddlChild = this.Pub1.GetDDLByID("DDL_" + me.AttrsOfActive + "_" + i); if (ddlChild == null) { me.Delete(); continue; } ddlPerant.Attributes["onchange"] = "DDLAnsc(this.value,\'" + ddlChild.ClientID + "\', \'" + me.MyPK + "\')"; if (ddlPerant.Items.Count == 0) { continue; } string val = ddlPerant.SelectedItemStringVal; string valC1 = ddlChild.SelectedItemStringVal; DataTable dt = DBAccess.RunSQLReturnTable(me.Doc.Replace("@Key", val)); ddlChild.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlChild.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString())); } ddlChild.SetSelectItem(valC1); break; case MapExtXmlList.AutoFullDLL: //自动填充下拉框的范围. DDL ddlFull = this.Pub1.GetDDLByID("DDL_" + me.AttrOfOper + "_" + i); if (ddlFull == null) { me.Delete(); continue; } string valOld = ddlFull.SelectedItemStringVal; ddlFull.Items.Clear(); string fullSQL = me.Doc.Replace("@WebUser.No", WebUser.No); fullSQL = fullSQL.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); fullSQL = fullSQL.Replace("@WebUser.Name", WebUser.Name); if (fullSQL.Contains("@")) { //Attrs attrsFull = mydtl.EnMap.Attrs; //foreach (Attr attr in attrsFull) //{ // if (fullSQL.Contains("@") == false) // break; // fullSQL = fullSQL.Replace("@" + attr.Key, mydtl.GetValStrByKey(attr.Key)); //} } ddlFull.Bind(DBAccess.RunSQLReturnTable(fullSQL), "No", "Name"); ddlFull.SetSelectItem(valOld); break; case MapExtXmlList.TBFullCtrl: // 自动填充. TextBox tbAuto = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tbAuto == null) { me.Delete(); continue; } tbAuto.Attributes["onkeyup"] = "DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; tbAuto.Attributes["AUTOCOMPLETE"] = "OFF"; if (me.Tag != "") { /* 处理下拉框的选择范围的问题 */ string[] strs = me.Tag.Split('$'); foreach (string str in strs) { string[] myCtl = str.Split(':'); string ctlID = myCtl[0]; DDL ddlC = this.Pub1.GetDDLByID("DDL_" + ctlID + "_" + i); if (ddlC == null) { continue; } string sql = myCtl[1].Replace("~", "'"); sql = sql.Replace("@WebUser.No", WebUser.No); sql = sql.Replace("@WebUser.Name", WebUser.Name); sql = sql.Replace("@WebUser.FK_Dept", WebUser.FK_Dept); sql = sql.Replace("@Key", tbAuto.Text.Trim()); dt = DBAccess.RunSQLReturnTable(sql); string valC = ddlC.SelectedItemStringVal; ddlC.Items.Clear(); foreach (DataRow dr in dt.Rows) { ddlC.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString())); } ddlC.SetSelectItem(valC); } } // tbAuto.Attributes["onkeyup"] = "DoAnscToFillDiv(this,this.value);"; // tbAuto.Attributes["onkeyup"] = "DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + me.MyPK + "\');"; break; case MapExtXmlList.InputCheck: TextBox tbCheck = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tbCheck != null) { tbCheck.Attributes[me.Tag2] += " rowPK=" + i + ";" + me.Tag1 + "(this);"; } else { me.Delete(); } break; case MapExtXmlList.PopVal: //弹出窗. TextBox tb = this.Pub1.GetTextBoxByID("TB_" + me.AttrOfOper + "_" + i); if (tb == null) { continue; } //tb.Attributes["ondblclick"] = "return ReturnValCCFormPopVal(this,'" + me.MyPK + "','33');"; tb.Attributes["ondblclick"] = "ReturnValCCFormPopVal(this,'" + me.MyPK + "','33');"; // throw new Exception("ssssrrrss"); break; default: break; } } } #endregion 处理拓展属性. #region 输出自动计算公式 this.Pub1.Add("\n <script language='JavaScript'>"); MapExts exts = new MapExts(dtl.No); foreach (MapExt ext in exts) { if (ext.ExtType != MapExtXmlList.AutoFull) { continue; } for (int i = 1; i <= dtl.RowsOfList; i++) { string top = "\n function C" + i + "() { \n "; string script = ""; foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.IsNum == false) { continue; } if (attr.LGType != FieldTypeS.Normal) { continue; } if (ext.Tag == "1" && ext.Doc != "") { script += this.GenerAutoFull(i.ToString(), attrs, ext); } } string end = " \n } "; this.Pub1.Add(top + script + end); } } this.Pub1.Add("\n</script>"); // 输出合计算计公式 foreach (MapAttr attr in attrs) { if (attr.UIVisible == false) { continue; } if (attr.LGType != FieldTypeS.Normal) { continue; } if (attr.IsNum == false) { continue; } if (attr.MyDataType == DataType.AppBoolean) { continue; } string top = "\n<script language='JavaScript'> function C" + attr.KeyOfEn + "() { \n "; string end = "\n } </script>"; this.Pub1.Add(top + this.GenerSum(attr, dtl) + " ; \t\n" + end); } #endregion 输出自动计算公式 }