public string SF2_Save() { SFTable sf = new SFTable(); sf.No = this.GetValFromFrmByKey("No"); if (sf.IsExits) { return("err@标记:" + sf.No + "已经存在."); } sf.Name = this.GetValFromFrmByKey("Name"); sf.FK_SFDBSrc = this.GetValFromFrmByKey("FK_DBSrc"); sf.SrcTable = this.GetValFromFrmByKey("SrcTable"); sf.CodeStruct = (CodeStruct)this.GetValIntFromFrmByKey("CodeStruct"); sf.ColumnValue = this.GetValFromFrmByKey("ColumnValue"); sf.ColumnText = this.GetValFromFrmByKey("ColumnText"); if (sf.CodeStruct == CodeStruct.Tree) { sf.ParentValue = this.GetValFromFrmByKey("ParentValue"); sf.DefVal = this.GetValFromFrmByKey("RootValue"); } sf.SelectStatement = this.GetValFromFrmByKey("Selectstatement"); sf.SrcType = SrcType.TableOrView; sf.FK_Val = "FK_" + sf.No; sf.Save(); return("保存成功!"); }
void btn_Del_Click(object sender, EventArgs e) { try { // 检查这个类型是否被使用? MapAttrs attrs = new MapAttrs(); QueryObject qo = new QueryObject(attrs); qo.AddWhere(MapAttrAttr.MyDataType, (int)FieldTypeS.FK); qo.addAnd(); qo.AddWhere(MapAttrAttr.KeyOfEn, this.RefNo); int i = qo.DoQuery(); if (i == 0) { BP.Sys.SFTable m = new SFTable(); m.No = this.RefNo; m.Delete(); this.ToMsgPage("外键删除成功"); return; } string msg = "错误:下列数据已经引用了外键您不能删除它。"; foreach (MapAttr attr in attrs) { msg += "\t\n" + attr.Field + "" + attr.Name + " 表" + attr.FK_MapData; } throw new Exception(msg); } catch (Exception ex) { this.ToErrorPage(ex.Message); } }
void btn_Save_Click(object sender, EventArgs e) { try { SFTable main = new SFTable(); main.No = this.RefNo; main.RetrieveFromDBSources(); main = (SFTable)this.Ucsys1.Copy(main); if (this.RefNo == null) { if (main.IsExits == true) { throw new Exception("编号[" + main.No + "]已经存在"); } } //设置它的数据源类型. main.SrcType = SrcType.SQL; #region 检查必填项. if (main.No.Length == 0) { throw new Exception("编号不能为空"); } if (main.Name.Length == 0) { throw new Exception("名称不能为空"); } if (main.SelectStatement == "") { throw new Exception("查询的数据源不能为空."); } if (main.CashMinute <= 0) { main.CashMinute = 0; } #endregion 检查必填项. if (this.RefNo == null) { main.FK_Val = main.No; } main.Save(); //重新生成 this.Response.Redirect("SFSQL.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "&FromApp=" + this.FromApp, true); } catch (Exception ex) { this.Alert(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { SFTable main = new SFTable(); if (this.RefNo != null) { main.No = this.RefNo; main.Retrieve(); } this.BindSFTable(main); }
public void BindIt() { SFTable sem = new SFTable(this.RefNo); this.UCSys1.AddTable("width=500px class=Table"); this.UCSys1.AddCaptionLeft("<a href=SFTableList.aspx ><img src='./../../Img/Btn/Home.gif' border=0>列表</a> -<a href='SFTableList.aspx?DoType=New' ><img src='./../../Img/Btn/New.gif' border=0/>新建</a>- <img src='./../../Img/Btn/Edit.gif' border />编辑:" + sem.No + " " + sem.Name); this.UCSys1.AddTR(); this.UCSys1.AddTDTitle("项目"); this.UCSys1.AddTDTitle("采集"); this.UCSys1.AddTDTitle("说明"); this.UCSys1.AddTREnd(); this.UCSys1.AddTRSum(); this.UCSys1.AddTD("编号"); TextBox tb = new TextBox(); tb.ID = "TB_No"; tb.Text = this.RefNo; tb.Enabled = false; this.UCSys1.AddTD(tb); this.UCSys1.AddTD("不可修改"); this.UCSys1.AddTREnd(); this.UCSys1.AddTRSum(); this.UCSys1.AddTD("名称"); tb = new TextBox(); tb.ID = "TB_Name"; tb.Text = sem.Name; this.UCSys1.AddTD(tb); this.UCSys1.AddTD(""); this.UCSys1.AddTREnd(); this.UCSys1.AddTR(); Button btn = new Button(); btn.ID = "Btn_Save"; btn.CssClass = "Btn"; btn.Text = " Save "; btn.Click += new EventHandler(btn_Click); this.UCSys1.AddTD("colspan=2", btn); if (this.RefNo.Contains(".") == false) { this.UCSys1.AddTD("<a href='./../../MapDef/SFTableEditData.aspx?RefNo=" + this.RefNo + "' >编辑数据</a>"); } else { this.UCSys1.AddTD("<a href='./../Ens.aspx?EnsName=" + this.RefNo + "' >编辑数据</a>"); } this.UCSys1.AddTREnd(); this.UCSys1.AddTableEnd(); }
void btn_Add_Click(object sender, EventArgs e) { SFTable table = new SFTable(this.RefNo); if (table.HisEns.Count == 0) { this.Alert("该表里[" + this.RefNo + "]中没有数据,您需要维护数据才能"); return; } this.Response.Redirect("Do.aspx?DoType=AddSFTableAttr&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "&RefNo=" + this.RefNo, true); this.WinClose(); return; }
protected void Page_Load(object sender, EventArgs e) { SFTable main = new SFTable { FK_SFDBSrc = string.Empty }; //此处FK_SFDBSrc的默认值为local,需要将其设为空,否则下方报错 if (this.RefNo != null) { main.No = this.RefNo; main.Retrieve(); } this.BindSFTable(main); }
void btn_Click(object sender, EventArgs e) { string no = this.UCSys1.GetTextBoxByID("TB_No").Text; string name = this.UCSys1.GetTextBoxByID("TB_Name").Text; SFTable m = new SFTable(); m.No = no; m.RetrieveFromDBSources(); m.Name = name; if (string.IsNullOrEmpty(name)) { this.Alert("编码表名称不能为空"); return; } // m.HisSFTableType = SFTableType.SFTable; m.Save(); this.Response.Redirect("SFTableList.aspx?RefNo=" + m.No, true); }
protected void Page_Load(object sender, EventArgs e) { this.Title = "编辑外键类型"; MapAttr attr = null; if (this.RefNo == null) { attr = new MapAttr(); string sfKey = this.Request.QueryString["SFKey"]; SFTable sf = new SFTable(sfKey); attr.KeyOfEn = sf.FK_Val; attr.UIBindKey = sfKey; attr.Name = sf.Name; } else { attr = new MapAttr(this.RefNo); } BindTable(attr); }
void btn_Create_Click(object sender, EventArgs e) { SFTable table = new SFTable(); table = this.Pub1.Copy(table) as SFTable; table.FK_SFDBSrc = Request.QueryString["FK_SFDBSrc"]; table.SrcTable = this.Request.QueryString["LB_Table"]; table.FK_Val = "FK_" + table.SrcTable; table.ColumnText = this.Request.QueryString["DDL_ColText"]; table.ColumnValue = this.Request.QueryString["DDL_ColValue"]; table.ParentValue = this.Request.QueryString["DDL_ColParentNo"]; table.SelectStatement = Uri.UnescapeDataString(Request.QueryString["TB_SelectStatement"]); table.SFTableType = int.Parse(Request.QueryString["DDL_SFTableType"]); if (table.SFTableType == 1) { table.IsTree = true; } else { table.IsTree = false; table.ParentValue = null; } if (BP.DA.DBAccess.IsExitsObject(table.No)) { EasyUiHelper.AddEasyUiMessagerAndBack(this, "@对象(" + table.No + ")已经存在.", "错误", "error"); return; } var sql = "CREATE VIEW " + table.No + "" + " AS " + table.SelectStatement; BP.DA.DBAccess.RunSQL(sql); table.Save(); EasyUiHelper.AddEasyUiMessagerAndGo(this, "创建成功!查看数据……", "提示", "info", "../../MapDef/SFTableEditData.aspx?RefNo=" + table.No); }
void btn_Create_WebService_Click(object sender, EventArgs e) { SFTable table = new SFTable(); table = this.Pub1.Copy(table) as SFTable; table.SrcType = SrcType.WebServices; //9表示WebService数据源表类型,added by liuxc,2015-9-12 if (string.IsNullOrWhiteSpace(table.No) || string.IsNullOrWhiteSpace(table.Name) || string.IsNullOrWhiteSpace(table.TableDesc) || string.IsNullOrWhiteSpace(table.SrcTable)) { EasyUiHelper.AddEasyUiMessagerAndBack(this, "@编号、名称、Url、接口名称必须填写.", "错误", "error"); return; } if (table.IsExit(SFTableAttr.No, table.No)) { EasyUiHelper.AddEasyUiMessagerAndBack(this, "@对象(" + table.No + ")已经存在.", "错误", "error"); return; } table.Save(); EasyUiHelper.AddEasyUiMessagerAndGo(this, "创建成功!", "提示", "info", "SFGuide.aspx?Step=1"); }
protected void Page_Load(object sender, EventArgs e) { try { switch (this.DoType) { case "DownTempFrm": MapData md = new MapData(this.FK_MapData); DataSet ds = md.GenerHisDataSet(); string name = "ccflow表单模板." + md.Name + "." + md.No + ".xml"; string file = this.Request.PhysicalApplicationPath + "\\Temp\\" + this.FK_MapData + ".xml"; ds.WriteXml(file); this.Response.Redirect("../../Temp/" + this.FK_MapData + ".xml", true); this.WinClose(); break; case "CCForm": this.Application.Clear(); if (WebUser.NoOfRel != "admin") { BP.Port.Emp emp = new BP.Port.Emp("admin"); BP.Web.WebUser.SignInOfGener(emp); } MapAttr mattr = new MapAttr(); mattr.MyPK = this.Request.QueryString["MyPK"]; int i = mattr.RetrieveFromDBSources(); mattr.KeyOfEn = this.Request.QueryString["KeyOfEn"]; mattr.FK_MapData = this.Request.QueryString["FK_MapData"]; mattr.MyDataType = int.Parse(this.Request.QueryString["DataType"]); if (!string.IsNullOrEmpty(this.Request.QueryString["UIBindKey"] + "")) { mattr.UIBindKey = this.Request.QueryString["UIBindKey"]; } mattr.UIContralType = (UIContralType)int.Parse(this.Request.QueryString["UIContralType"]); mattr.LGType = (BP.En.FieldTypeS) int.Parse(this.Request.QueryString["LGType"]); if (i == 0) { mattr.Name = System.Web.HttpUtility.UrlDecode(this.Request.QueryString["KeyName"], System.Text.Encoding.GetEncoding("GB2312")); mattr.UIIsEnable = true; mattr.UIVisible = true; if (mattr.LGType == FieldTypeS.Enum) { mattr.DefVal = "0"; } mattr.Insert(); } else { mattr.Update(); } switch (mattr.LGType) { case BP.En.FieldTypeS.Enum: this.Response.Redirect("EditEnum.aspx?MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK, true); return; case BP.En.FieldTypeS.Normal: this.Response.Redirect("EditF.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true); return; case BP.En.FieldTypeS.FK: this.Response.Redirect("EditTable.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true); return; default: break; } break; case "DobackToF": MapAttr ma = new MapAttr(this.RefNo); switch (ma.LGType) { case FieldTypeS.Normal: this.Response.Redirect("EditF.aspx?RefNo=" + this.RefNo, true); return; case FieldTypeS.FK: this.Response.Redirect("EditTable.aspx?RefNo=" + this.RefNo, true); return; case FieldTypeS.Enum: this.Response.Redirect("EditEnum.aspx?RefNo=" + this.RefNo, true); return; default: return; } break; case "AddEnum": SysEnumMain sem1 = new SysEnumMain(this.Request.QueryString["EnumKey"]); MapAttr attrAdd = new MapAttr(); attrAdd.KeyOfEn = sem1.No; if (attrAdd.IsExit(MapAttrAttr.FK_MapData, this.MyPK, MapAttrAttr.KeyOfEn, sem1.No)) { BP.Sys.PubClass.Alert("字段已经存在 [" + sem1.No + "]。"); BP.Sys.PubClass.WinClose(); return; } attrAdd.FK_MapData = this.MyPK; attrAdd.Name = sem1.Name; attrAdd.UIContralType = UIContralType.DDL; attrAdd.UIBindKey = sem1.No; attrAdd.MyDataType = BP.DA.DataType.AppInt; attrAdd.LGType = FieldTypeS.Enum; attrAdd.DefVal = "0"; attrAdd.UIIsEnable = true; if (this.Idx == null || this.Idx == "") { MapAttrs attrs1 = new MapAttrs(this.MyPK); attrAdd.Idx = 0; } else { attrAdd.Idx = int.Parse(this.Idx); } attrAdd.Insert(); this.Response.Redirect("EditEnum.aspx?MyPK=" + this.MyPK + "&RefNo=" + attrAdd.MyPK, true); this.WinClose(); return; case "DelEnum": string eKey = this.Request.QueryString["EnumKey"]; SysEnumMain sem = new SysEnumMain(); sem.No = eKey; sem.Delete(); this.WinClose(); return; case "AddSysEnum": this.AddFEnum(); break; case "AddSFTable": this.AddSFTable(); break; case "AddSFTableAttr": SFTable sf = new SFTable(this.Request.QueryString["RefNo"]); this.Response.Redirect("EditTable.aspx?MyPK=" + this.MyPK + "&SFKey=" + sf.No, true); this.WinClose(); return; case "AddFG": /*执行一个插入列组的命令.*/ switch (this.RefNo) { case "IsPass": MapDtl dtl = new MapDtl(this.FK_MapData); dtl.IsEnablePass = true; /*更新是否启动审核分组字段.*/ MapAttr attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "Check_Note"; attr.Name = "审核意见"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.DefVal = "同意"; attr.UIIsEnable = true; attr.UIIsLine = true; attr.MaxLen = 4000; attr.ColSpan = 4; // 默认为4列。 attr.Idx = 1; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "Checker"; attr.Name = "审核人";// "审核人"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.DefVal = "@WebUser.Name"; attr.UIIsEnable = false; attr.IsSigan = true; attr.Idx = 2; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "IsPass"; attr.Name = "通过否?";// "审核人"; attr.MyDataType = DataType.AppBoolean; attr.UIContralType = UIContralType.CheckBok; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = false; attr.IsSigan = true; attr.DefVal = "1"; attr.Idx = 2; attr.DefVal = "0"; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "Check_RDT"; attr.Name = "审核日期"; // "审核日期"; attr.MyDataType = DataType.AppDateTime; attr.UIContralType = UIContralType.TB; attr.UIIsEnable = true; attr.UIIsLine = false; attr.DefVal = "@RDT"; attr.UIIsEnable = false; attr.Idx = 3; attr.Insert(); /* 处理批次ID*/ attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "BatchID"; attr.Name = "BatchID"; // this.ToE("IsPass", "是否通过");// "审核人"; attr.MyDataType = DataType.AppInt; attr.UIIsEnable = false; attr.UIIsLine = false; attr.UIIsEnable = false; attr.UIVisible = false; attr.Idx = 2; attr.DefVal = "0"; attr.Insert(); dtl.Update(); this.WinClose(); return; case "Eval": /* 质量评价 */ attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalEmpNo"; attr.Name = "被评价人员编号"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = false; attr.IsSigan = true; attr.Idx = 1; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalEmpName"; attr.Name = "被评价人员名称"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = false; attr.IsSigan = true; attr.Idx = 2; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalCent"; attr.Name = "工作得分"; attr.MyDataType = DataType.AppFloat; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsLine = false; attr.UIIsEnable = true; attr.Idx = 3; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = this.FK_MapData; attr.KeyOfEn = "EvalNote"; attr.Name = "评价信息"; attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.MaxLen = 50; attr.MinLen = 0; attr.UIIsEnable = true; attr.UIIsEnable = true; attr.Idx = 4; attr.Insert(); this.WinClose(); return; default: break; } break; case "AddFGroup": this.AddFGroup(); return; case "AddF": case "ChoseFType": this.AddF(); break; case "Up": MapAttr attrU = new MapAttr(this.RefNo); if (this.Request.QueryString["IsDtl"] != null) { attrU.DoDtlUp(); } else { attrU.DoUp(); } this.WinClose(); break; case "Down": //让一个字段下移动. MapAttr attrD = new MapAttr(this.RefNo); attrD.DoDown(); this.WinClose(); break; case "DownAttr": //让一个字段下移动. MapAttr attrAttr = new MapAttr(this.RefNo); attrAttr.DoDtlDown(); this.WinClose(); break; case "Jump": MapAttr attrFrom = new MapAttr(this.Request.QueryString["FromID"]); MapAttr attrTo = new MapAttr(this.Request.QueryString["ToID"]); attrFrom.DoJump(attrTo); this.WinClose(); break; case "MoveTo": string toID = this.Request.QueryString["ToID"]; int toGFID = int.Parse(this.Request.QueryString["ToGID"]); int fromGID = int.Parse(this.Request.QueryString["FromGID"]); string fromID = this.Request.QueryString["FromID"]; MapAttr fromAttr = new MapAttr(); fromAttr.MyPK = fromID; fromAttr.Retrieve(); if (toGFID == fromAttr.GroupID && fromAttr.MyPK == toID) { /* 如果没有移动. */ this.WinClose(); return; } if (toGFID != fromAttr.GroupID && fromAttr.MyPK == toID) { MapAttr toAttr = new MapAttr(toID); fromAttr.Update(MapAttrAttr.GroupID, toAttr.GroupID, MapAttrAttr.Idx, toAttr.Idx); this.WinClose(); return; } this.Response.Redirect(this.Request.RawUrl.Replace("MoveTo", "Jump"), true); return; case "Edit": Edit(); break; case "Del": MapAttr attrDel = new MapAttr(); attrDel.MyPK = this.RefNo; attrDel.Delete(); this.WinClose(); break; case "GFDoUp": GroupField gf = new GroupField(this.RefOID); gf.DoUp(); gf.Retrieve(); if (gf.Idx == 0) { this.WinClose(); return; } int oidIdx = gf.Idx; gf.Idx = gf.Idx - 1; GroupField gfUp = new GroupField(); if (gfUp.Retrieve(GroupFieldAttr.EnName, gf.EnName, GroupFieldAttr.Idx, gf.Idx) == 1) { gfUp.Idx = oidIdx; gfUp.Update(); } gf.Update(); this.WinClose(); break; case "GFDoDown": GroupField mygf = new GroupField(this.RefOID); mygf.DoDown(); mygf.Retrieve(); int oidIdx1 = mygf.Idx; mygf.Idx = mygf.Idx + 1; GroupField gfDown = new GroupField(); if (gfDown.Retrieve(GroupFieldAttr.EnName, mygf.EnName, GroupFieldAttr.Idx, mygf.Idx) == 1) { gfDown.Idx = oidIdx1; gfDown.Update(); } mygf.Update(); this.WinClose(); break; case "AthDoUp": FrmAttachment frmAth = new FrmAttachment(this.MyPK); if (frmAth.RowIdx > 0) { frmAth.RowIdx = frmAth.RowIdx - 1; frmAth.Update(); } this.WinClose(); break; case "AthDoDown": FrmAttachment frmAthD = new FrmAttachment(this.MyPK); if (frmAthD.RowIdx < 10) { frmAthD.RowIdx = frmAthD.RowIdx + 1; frmAthD.Update(); } this.WinClose(); break; case "DtlDoUp": MapDtl dtl1 = new MapDtl(this.MyPK); if (dtl1.RowIdx > 0) { dtl1.RowIdx = dtl1.RowIdx - 1; dtl1.Update(); } this.WinClose(); break; case "DtlDoDown": MapDtl dtl2 = new MapDtl(this.MyPK); if (dtl2.RowIdx < 10) { dtl2.RowIdx = dtl2.RowIdx + 1; dtl2.Update(); } this.WinClose(); break; case "M2MDoUp": MapM2M ddtl1 = new MapM2M(this.MyPK); if (ddtl1.RowIdx > 0) { ddtl1.RowIdx = ddtl1.RowIdx - 1; ddtl1.Update(); } this.WinClose(); break; case "M2MDoDown": MapM2M ddtl2 = new MapM2M(this.MyPK); if (ddtl2.RowIdx < 10) { ddtl2.RowIdx = ddtl2.RowIdx + 1; ddtl2.Update(); } this.WinClose(); break; case "FrameDoUp": MapFrame frame1 = new MapFrame(this.MyPK); if (frame1.RowIdx > 0) { frame1.RowIdx = frame1.RowIdx - 1; frame1.Update(); } this.WinClose(); break; case "FrameDoDown": MapFrame frame2 = new MapFrame(this.MyPK); if (frame2.RowIdx < 10) { frame2.RowIdx = frame2.RowIdx + 1; frame2.Update(); } this.WinClose(); break; default: break; } } catch (Exception ex) { this.Pub1.AddMsgOfWarning("错误:", ex.Message + " <br>" + this.Request.RawUrl); } }
/// <summary> /// 获取从表数据,用于显示dtl.htm /// </summary> /// <param name="frmID">表单ID</param> /// <param name="pkval">主键</param> /// <param name="atParas">参数</param> /// <param name="specDtlFrmID">指定明细表的参数,如果为空就标识主表数据,否则就是从表数据.</param> /// <returns>数据</returns> public static DataSet GenerDBForCCFormDtl(string frmID, MapDtl dtl, int pkval, string atParas) { //数据容器,就是要返回的对象. DataSet myds = new DataSet(); //映射实体. MapData md = new MapData(frmID); //实体. GEEntity wk = new GEEntity(frmID); wk.OID = pkval; if (wk.RetrieveFromDBSources() == 0) { wk.Insert(); } //把参数放入到 En 的 Row 里面。 if (DataType.IsNullOrEmpty(atParas) == false) { AtPara ap = new AtPara(atParas); foreach (string key in ap.HisHT.Keys) { try { if (wk.Row.ContainsKey(key) == true) //有就该变. { wk.Row[key] = ap.GetValStrByKey(key); } else { wk.Row.Add(key, ap.GetValStrByKey(key)); //增加他. } } catch (Exception ex) { throw new Exception(key); } } } #region 加载从表表单模版信息. DataTable Sys_MapDtl = dtl.ToDataTableField("Sys_MapDtl"); myds.Tables.Add(Sys_MapDtl); //明细表的表单描述 DataTable Sys_MapAttr = dtl.MapAttrs.ToDataTableField("Sys_MapAttr"); myds.Tables.Add(Sys_MapAttr); //明细表的配置信息. DataTable Sys_MapExt = dtl.MapExts.ToDataTableField("Sys_MapExt"); myds.Tables.Add(Sys_MapExt); #region 把从表的- 外键表/枚举 加入 DataSet. MapExts mes = dtl.MapExts; MapExt me = null; foreach (DataRow dr in Sys_MapAttr.Rows) { string lgType = dr["LGType"].ToString(); //不是枚举/外键字段 if (lgType.Equals("0")) { continue; } string uiBindKey = dr["UIBindKey"].ToString(); var mypk = dr["MyPK"].ToString(); #region 枚举字段 if (lgType.Equals("1")) { // 如果是枚举值, 判断是否存在. if (myds.Tables.Contains(uiBindKey) == true) { continue; } string mysql = "SELECT IntKey AS No, Lab as Name FROM Sys_Enum WHERE EnumKey='" + uiBindKey + "' ORDER BY IntKey "; DataTable dtEnum = DBAccess.RunSQLReturnTable(mysql); dtEnum.TableName = uiBindKey; dtEnum.Columns[0].ColumnName = "No"; dtEnum.Columns[1].ColumnName = "Name"; myds.Tables.Add(dtEnum); continue; } #endregion #region 外键字段 string UIIsEnable = dr["UIIsEnable"].ToString(); if (UIIsEnable.Equals("0")) //字段未启用 { continue; } // 检查是否有下拉框自动填充。 string keyOfEn = dr["KeyOfEn"].ToString(); #region 处理下拉框数据范围. for 小杨. me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt; if (me != null) //有范围限制时 { string fullSQL = me.Doc.Clone() as string; fullSQL = fullSQL.Replace("~", ","); fullSQL = BP.WF.Glo.DealExp(fullSQL, wk, null); DataTable dt = DBAccess.RunSQLReturnTable(fullSQL); dt.TableName = uiBindKey; dt.Columns[0].ColumnName = "No"; dt.Columns[1].ColumnName = "Name"; myds.Tables.Add(dt); continue; } #endregion 处理下拉框数据范围. // 判断是否存在. if (myds.Tables.Contains(uiBindKey) == true) { continue; } myds.Tables.Add(BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey)); #endregion 外键字段 } #endregion 把从表的- 外键表/枚举 加入 DataSet. #endregion 加载从表表单模版信息. #region 把主表数据放入. if (BP.Sys.SystemConfig.IsBSsystem == true) { // 处理传递过来的参数。 foreach (string k in System.Web.HttpContext.Current.Request.QueryString.AllKeys) { wk.SetValByKey(k, System.Web.HttpContext.Current.Request.QueryString[k]); } } //重设默认值. wk.ResetDefaultVal(); //增加主表数据. DataTable mainTable = wk.ToDataTableField(md.No); mainTable.TableName = "MainTable"; myds.Tables.Add(mainTable); #endregion 把主表数据放入. #region 把从表的数据放入. GEDtls dtls = new GEDtls(dtl.No); QueryObject qo = null; try { qo = new QueryObject(dtls); switch (dtl.DtlOpenType) { case DtlOpenType.ForEmp: // 按人员来控制. qo.AddWhere(GEDtlAttr.RefPK, pkval); qo.addAnd(); qo.AddWhere(GEDtlAttr.Rec, WebUser.No); break; case DtlOpenType.ForWorkID: // 按工作ID来控制 qo.AddWhere(GEDtlAttr.RefPK, pkval); break; case DtlOpenType.ForFID: // 按流程ID来控制. qo.AddWhere(GEDtlAttr.FID, pkval); break; } } catch (Exception ex) { dtls.GetNewEntity.CheckPhysicsTable(); throw ex; } //条件过滤. if (dtl.FilterSQLExp != "") { string[] strs = dtl.FilterSQLExp.Split('='); qo.addAnd(); qo.AddWhere(strs[0], strs[1]); } //增加排序. // qo.addOrderByDesc( dtls.GetNewEntity.PKField ); //从表 DataTable dtDtl = qo.DoQueryToTable(); //查询所有动态SQL查询类型的字典表记录 SFTable sftable = null; DataTable dtsftable = null; DataRow[] drs = null; SFTables sftables = new SFTables(); sftables.Retrieve(SFTableAttr.SrcType, (int)SrcType.SQL); // 为明细表设置默认值. MapAttrs dtlAttrs = new MapAttrs(dtl.No); foreach (MapAttr attr in dtlAttrs) { #region 修改区分大小写. if (BP.DA.DBType.Oracle == SystemConfig.AppCenterDBType) { foreach (DataColumn dr in dtDtl.Columns) { var a = attr.KeyOfEn; var b = dr.ColumnName; if (attr.KeyOfEn.ToUpper().Equals(dr.ColumnName)) { dr.ColumnName = attr.KeyOfEn; continue; } if (attr.LGType == FieldTypeS.Enum || attr.LGType == FieldTypeS.FK) { if (dr.ColumnName.Equals(attr.KeyOfEn.ToUpper() + "TEXT")) { dr.ColumnName = attr.KeyOfEn + "Text"; } } } foreach (DataRow dr in dtDtl.Rows) { //本身是大写的不进行修改 if (DataType.IsNullOrEmpty(dr[attr.KeyOfEn] + "")) { dr[attr.KeyOfEn] = dr[attr.KeyOfEn.ToUpper()]; dr[attr.KeyOfEn.ToUpper()] = null; } } } #endregion 修改区分大小写. //处理增加动态SQL查询类型的下拉框选中值Text值,added by liuxc,2017-9-22 if (attr.LGType == FieldTypeS.FK && attr.UIIsEnable == false) { sftable = sftables.GetEntityByKey(attr.UIBindKey) as SFTable; if (sftable != null) { dtsftable = sftable.GenerHisDataTable; //为Text赋值 foreach (DataRow dr in dtDtl.Rows) { drs = dtsftable.Select("No='" + dr[attr.KeyOfEn] + "'"); if (drs.Length == 0) { continue; } dr[attr.KeyOfEn + "Text"] = drs[0]["Name"]; } } } //处理它的默认值. if (attr.DefValReal.Contains("@") == false) { continue; } foreach (DataRow dr in dtDtl.Rows) { dr[attr.KeyOfEn] = attr.DefVal; } } dtDtl.TableName = "DBDtl"; //修改明细表的名称. myds.Tables.Add(dtDtl); //加入这个明细表, 如果没有数据,xml体现为空. #endregion 把从表的数据放入. //放入一个空白的实体,用与获取默认值. GEDtl dtlBlank = dtls.GetNewEntity as GEDtl; dtlBlank.ResetDefaultVal(); myds.Tables.Add(dtlBlank.ToDataTableField("Blank")); return(myds); }
public string Imp_Src_Step3_Save() { string hidImpFields = this.GetRequestVal("hidImpFields"); string[] fields = hidImpFields.TrimEnd(',').Split(','); MapData md = new MapData(); md.No = this.FK_MapData; md.RetrieveFromDBSources(); string msg = "导入字段信息:"; bool isLeft = true; float maxEnd = md.MaxEnd; //底部. for (int i = 0; i < fields.Length; i++) { string colname = fields[i]; MapAttr ma = new MapAttr(); ma.KeyOfEn = colname; ma.Name = this.GetRequestVal("TB_Desc_" + colname); ma.FK_MapData = this.FK_MapData; ma.MyDataType = int.Parse(this.GetRequestVal("DDL_DBType_" + colname)); ma.MaxLen = int.Parse(this.GetRequestVal("TB_Len_" + colname)); ma.UIBindKey = this.GetRequestVal("TB_BindKey_" + colname); ma.MyPK = this.FK_MapData + "_" + ma.KeyOfEn; ma.LGType = BP.En.FieldTypeS.Normal; if (ma.UIBindKey != "") { SysEnums se = new SysEnums(); se.Retrieve(SysEnumAttr.EnumKey, ma.UIBindKey); if (se.Count > 0) { ma.MyDataType = BP.DA.DataType.AppInt; ma.LGType = BP.En.FieldTypeS.Enum; ma.UIContralType = BP.En.UIContralType.DDL; } SFTable tb = new SFTable(); tb.No = ma.UIBindKey; if (tb.IsExits == true) { ma.MyDataType = BP.DA.DataType.AppString; ma.LGType = BP.En.FieldTypeS.FK; ma.UIContralType = BP.En.UIContralType.DDL; } } if (ma.MyDataType == BP.DA.DataType.AppBoolean) { ma.UIContralType = BP.En.UIContralType.CheckBok; } if (ma.IsExits) { continue; } ma.Insert(); msg += "\t\n字段:" + ma.KeyOfEn + "" + ma.Name + "加入成功."; FrmLab lab = null; if (isLeft == true) { maxEnd = maxEnd + 40; /* 是否是左边 */ lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 40; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } else { lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 350; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } isLeft = !isLeft; } //重新设置. md.ResetMaxMinXY(); return(msg); }
public void BindSFTable() { SFTable sf = new SFTable(this.RefNo); var canEdit = sf.FK_SFDBSrc == "local"; //todo:此处判断不准确,需更加精确的判断?? this.Title = (canEdit ? "编辑:" : "查看:") + sf.Name; this.Pub1.AddTable("class='table' cellpadding='1' cellspacing='1' border='1' style='width:100%'"); this.Pub1.AddTR(); this.Pub1.AddTDGroupTitle("style='width:80px;text-align:center'", "编号"); this.Pub1.AddTDGroupTitle("名称"); if (canEdit) { this.Pub1.AddTDGroupTitle("style='width:80px'", "操作"); } this.Pub1.AddTREnd(); GENoNames ens = new GENoNames(sf.No, sf.Name); QueryObject qo = new QueryObject(ens); try { this.Pub2.BindPageIdxEasyUi(qo.GetCount(), "SFTableEditData.aspx?RefNo=" + this.RefNo, this.PageIdx); } catch { sf.CheckPhysicsTable(); this.Pub2.BindPageIdxEasyUi(qo.GetCount(), "SFTableEditData.aspx?RefNo=" + this.RefNo, this.PageIdx); } qo.DoQuery("No", 10, this.PageIdx, false); foreach (GENoName en in ens) { this.Pub1.AddTR(); this.Pub1.AddTDIdx(en.No); TextBox tb = new TextBox(); tb.ID = "TB_" + en.No; tb.Text = en.Name; tb.Style.Add("width", "99%"); tb.ReadOnly = !canEdit; this.Pub1.AddTD(tb); if (canEdit) { this.Pub1.AddTD("<a href=\"javascript:Del('" + this.RefNo + "','" + this.PageIdx + "','" + en.No + "')\" class='easyui-linkbutton' data-options=\"iconCls:'icon-delete'\" >删除</a>"); } this.Pub1.AddTREnd(); } if (canEdit) { GENoName newen = new GENoName(sf.No, sf.Name); this.Pub1.AddTR(); this.Pub1.AddTDIdx("新记录"); TextBox tb1 = new TextBox(); tb1.ID = "TB_Name"; tb1.Text = newen.Name; tb1.Style.Add("width", "99%"); this.Pub1.AddTD(tb1); var btn = new LinkBtn(false, NamesOfBtn.Save, "保存"); btn.Click += new EventHandler(btn_Click); this.Pub1.AddTD(btn); this.Pub1.AddTREnd(); } this.Pub1.AddTableEnd(); //this.Pub3.AddTable(); //this.Pub3.AddTRSum(); //this.Pub3.AddTD("编号"); //this.Pub3.AddTD("名称"); //this.Pub3.AddTD(""); //this.Pub3.AddTREnd(); //GENoName newen = new GENoName(sf.No, sf.Name); //this.Pub3.AddTRSum(); //this.Pub3.AddTD(newen.GenerNewNo); //TextBox tbn = new TextBox(); //tbn.ID = "TB_Name"; //this.Pub3.AddTD(tbn); //Button btn = new Button(); //btn.Text = "增加"; //btn.Click += new EventHandler(btn_Click); //this.Pub3.AddTD(btn); //this.Pub3.AddTREnd(); //this.Pub3.AddTableEnd(); }
/// <summary> /// Initializes a new instance of the GridStyleInfoCache class. /// </summary> public GridStyleInfoCache() { sfTable = new GridRowCollection(); sfTable.RowCount = delta + 1; sfTable.ColCount = delta + 1; }
void btn_Save_Click(object sender, EventArgs e) { try { SFTable main = new SFTable(); main = (SFTable)this.Ucsys1.Copy(main); if (main.No.Length == 0 || main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } try { main.HisEns.GetNewEntity.CheckPhysicsTable(); } catch { } if (this.RefNo == null) { main.No = this.Ucsys1.GetTBByID("TB_No").Text; if (main.IsExits) { string sql = "select No,Name from " + main.No + " WHERE 1=2"; try { BP.DA.DBAccess.RunSQLReturnTable(sql); } catch { this.Alert("错误:表或视图不存在No,Name列不符合约定规则 Key=" + main.No); return; } } } else { main.No = this.RefNo; main.Retrieve(); main = (SFTable)this.Ucsys1.Copy(main); if (main.No.Length == 0 || main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } } if (main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } if (main.TableDesc.Length == 0) { throw new Exception("描述不能为空"); } if (this.RefNo == null) { //if (main.No.Contains("SF_") == false) // throw new Exception("物理表不符合命名规则,必须以 SF_ 开头。"); // main.FK_Val = main.No.Replace("SF_", "FK_"); main.FK_Val = main.No; //.Replace("SF_", "FK_"); } //string cfgVal = ""; //int idx = -1; //while (idx < 19) //{ // idx++; // string t = this.Ucsys1.GetTBByID("TB_" + idx).Text.Trim(); // if (t.Length == 0) // continue; // cfgVal += "@" + idx + "=" + t; //} //main.CfgVal = cfgVal; //if (main.CfgVal == "") // throw new Exception("错误,您必须输入表,请参考帮助。"); // main.IsDel = true; main.Save(); //重新生成 this.Response.Redirect("SFTable.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX, true); } catch (Exception ex) { this.Alert(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { this.Title = "编码表编辑"; if (this.DoType == "Del") { MapAttrs attrs = new MapAttrs(); attrs.Retrieve(MapAttrAttr.UIBindKey, this.RefNo); if (attrs.Count != 0) { this.UCSys1.AddFieldSet("<a href='SFTableList.aspx' ><img src='./../../Img/Btn/Home.gif' border=0/>返回列表</a> - 删除确认"); this.UCSys1.Add("此编码表已经被其它的字段所引用,您不能删除它。"); this.UCSys1.AddH2("<a href='SFTableList.aspx' >返回列表</a>"); this.UCSys1.AddFieldSetEnd(); return; } this.UCSys1.AddFieldSet("<a href='SFTableList.aspx' ><img src='./../../Img/Btn/Home.gif' border=0/>返回列表</a> - 删除确认"); SFTable m = new SFTable(this.RefNo); this.UCSys1.AddH2("<a href='SFTableList.aspx?RefNo=" + this.RefNo + "&DoType=DelReal' >删除:" + m.Name + " 确认.</a>"); this.UCSys1.AddFieldSetEnd(); return; } if (this.DoType == "DelReal") { SFTable m = new SFTable(); m.No = this.RefNo; m.Delete(); SFTables ses = new SFTables(); // ses.Delete(SFTableAttr.SFTableKey, this.RefNo); this.Response.Redirect("SFTableList.aspx", true); return; } if (this.DoType == "New") { this.BindNew(); return; } if (this.RefNo != null) { this.BindIt(); return; } this.UCSys1.AddTable("class=Table width=500px"); this.UCSys1.AddCaption("<img src='./../../Img/Btn/Home.gif' border=0/>列表 - <a href='SFTableList.aspx?DoType=New' ><img border=0 src='./../../Img/Btn/New.gif' >新建</a>"); this.UCSys1.AddTR(); this.UCSys1.AddTDTitle("序"); this.UCSys1.AddTDTitle("编号"); this.UCSys1.AddTDTitle("名称"); //this.UCSys1.AddTDTitle("类型"); this.UCSys1.AddTDTitle("描述"); this.UCSys1.AddTDTitle("操作"); this.UCSys1.AddTREnd(); SFTables sems = new SFTables(); sems.RetrieveAll(); int i = 0; foreach (SFTable se in sems) { i++; this.UCSys1.AddTR(); this.UCSys1.AddTDIdx(i); this.UCSys1.AddTD(se.No); this.UCSys1.AddTDA("SFTableList.aspx?RefNo=" + se.No, se.Name); // this.UCSys1.AddTD(se.SFTableTypeT); this.UCSys1.AddTD(se.TableDesc); this.UCSys1.AddTDA("SFTableList.aspx?RefNo=" + se.No + "&DoType=Del", "<img src='./../../Img/Btn/Delete.gif' border=0 />删除"); //switch (se.HisSFTableType) //{ // case SFTableType.SFTable: // this.UCSys1.AddTDA("SFTableList.aspx?RefNo=" + se.No + "&DoType=Del", "<img src='./../../Img/Btn/Delete.gif' border=0 />删除"); // break; // case SFTableType.ClsLab: // case SFTableType.SysTable: // default: // this.UCSys1.AddTD(); // break; //} this.UCSys1.AddTREnd(); } this.UCSys1.AddTableEnd(); }
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(); }
void btn_Create_Local_Click(object sender, EventArgs e) { SFTable table = new SFTable(); table = this.Pub1.Copy(table) as SFTable; table.FK_SFDBSrc = Request.QueryString["FK_SFDBSrc"]; table.SrcTable = table.No; table.ColumnText = "Name"; table.ColumnValue = "No"; table.IsTree = false; if (BP.DA.DBAccess.IsExitsObject(table.No)) { //判断已经存在的表是否符合NoName规则,如果符合,则自动加入到SFTable中 var src = new SFDBSrc(this.FK_SFDBSrc); var columns = src.GetColumns(table.No); var cols = new List <string>(); foreach (DataRow dr in columns.Rows) { cols.Add(dr["name"].ToString()); } var regColValue = cols.FirstOrDefault(o => regs[0].Contains(o.ToLower())); var regColText = cols.FirstOrDefault(o => regs[1].Contains(o.ToLower())); var regColParentNo = cols.FirstOrDefault(o => regs[2].Contains(o.ToLower())); if (regColValue != null && regColText != null && regColParentNo != null) { table.SFTableType = 1; table.IsTree = true; table.ColumnValue = regColValue; table.ColumnText = regColText; table.ParentValue = regColParentNo; table.FK_SFDBSrc = "local"; table.Save(); EasyUiHelper.AddEasyUiMessagerAndGo(this, "您所创建的“" + table.No + "” 名称的字典表,本地库已经存在,已成功注册!编辑数据……", "提示", "info", "../../MapDef/SFTableEditData.aspx?RefNo=" + table.No); } else if (regColValue != null && regColText != null) { table.SFTableType = 0; table.IsTree = false; table.ColumnValue = regColValue; table.ColumnText = regColText; table.ParentValue = null; table.FK_SFDBSrc = "local"; table.Save(); EasyUiHelper.AddEasyUiMessagerAndGo(this, "您所创建的“" + table.No + "” 名称的字典表,本地库已经存在,已成功注册!编辑数据……", "提示", "info", "../../MapDef/SFTableEditData.aspx?RefNo=" + table.No); } else { EasyUiHelper.AddEasyUiMessagerAndBack(this, "@对象(" + table.No + ")已经存在.", "错误", "error"); } return; } var sql = new StringBuilder(); sql.AppendLine(string.Format("CREATE TABLE dbo.{0}", table.No)); sql.AppendLine("("); sql.AppendLine("No NVARCHAR(50) NOT NULL PRIMARY KEY,"); sql.AppendLine("Name NVARCHAR(100) NULL"); sql.AppendLine(") "); BP.DA.DBAccess.RunSQL(sql.ToString()); sql.Clear(); sql.Append("INSERT INTO [dbo].[{0}] ([No], [Name]) VALUES ('0{1}', 'Item{1}')"); for (var i = 1; i < 4; i++) { BP.DA.DBAccess.RunSQL(string.Format(sql.ToString(), table.No, i)); } sql.Clear(); sql.AppendFormat( "EXECUTE sp_addextendedproperty N'MS_Description', N'{0}', N'SCHEMA', N'dbo', N'TABLE', N'{1}', NULL, NULL", table.Name, table.No); BP.DA.DBAccess.RunSQL(sql.ToString()); table.Save(); EasyUiHelper.AddEasyUiMessagerAndGo(this, "创建成功!编辑数据……", "提示", "info", "../../MapDef/SFTableEditData.aspx?RefNo=" + table.No); }
public void BindSFTable() { SFTable sf = new SFTable(this.RefNo); this.Pub1.AddTable(); this.Pub1.AddCaptionLeft("编辑:" + sf.Name); this.Pub1.AddTR(); this.Pub1.AddTDTitle("编号"); this.Pub1.AddTDTitle("名称"); this.Pub1.AddTDTitle("操作"); this.Pub1.AddTREnd(); GENoNames ens = new GENoNames(sf.No, sf.Name); QueryObject qo = new QueryObject(ens); try { this.Pub2.BindPageIdx(qo.GetCount(), 10, this.PageIdx, "SFTableEditData.aspx?RefNo=" + this.RefNo); } catch { sf.CheckPhysicsTable(); this.Pub2.BindPageIdx(qo.GetCount(), 10, this.PageIdx, "SFTableEditData.aspx?RefNo=" + this.RefNo); } qo.DoQuery("No", 10, this.PageIdx, false); foreach (GENoName en in ens) { this.Pub1.AddTR(); this.Pub1.AddTDDesc(en.No); TextBox tb = new TextBox(); tb.ID = "TB_" + en.No; tb.Text = en.Name; tb.Attributes["width"] = "500px"; tb.Columns = 80; this.Pub1.AddTD(tb); this.Pub1.AddTD("<a href=\"javascript:Del('" + this.RefNo + "','" + this.PageIdx + "','" + en.No + "')\" >删除</a>"); this.Pub1.AddTREnd(); } GENoName newen = new GENoName(sf.No, sf.Name); this.Pub1.AddTR(); this.Pub1.AddTDDesc("新记录"); TextBox tb1 = new TextBox(); tb1.ID = "TB_Name"; tb1.Text = newen.Name; tb1.Columns = 80; this.Pub1.AddTD(tb1); Button btn = new Button(); btn.CssClass = "Btn"; btn.Text = "Save"; btn.Click += new EventHandler(btn_Click); this.Pub1.AddTD(btn); this.Pub1.AddTREnd(); this.Pub1.AddTableEnd(); //this.Pub3.AddTable(); //this.Pub3.AddTRSum(); //this.Pub3.AddTD("编号"); //this.Pub3.AddTD("名称"); //this.Pub3.AddTD(""); //this.Pub3.AddTREnd(); //GENoName newen = new GENoName(sf.No, sf.Name); //this.Pub3.AddTRSum(); //this.Pub3.AddTD(newen.GenerNewNo); //TextBox tbn = new TextBox(); //tbn.ID = "TB_Name"; //this.Pub3.AddTD(tbn); //Button btn = new Button(); //btn.Text = "增加"; //btn.Click += new EventHandler(btn_Click); //this.Pub3.AddTD(btn); //this.Pub3.AddTREnd(); //this.Pub3.AddTableEnd(); }
void btn_Save_Click(object sender, EventArgs e) { try { SFTable main = new SFTable(); main.No = this.RefNo; main.RetrieveFromDBSources(); main = (SFTable)this.Ucsys1.Copy(main); #region 检查必填项. if (main.FK_SFDBSrc.Length == 0) { throw new Exception("必须选择数据源"); } if (main.TableDesc.Length == 0) { throw new Exception("必须选择接口"); } if (main.No.Length == 0) { throw new Exception("接口英文名称不能为空"); } if (main.Name.Length == 0) { throw new Exception("接口中文名称不能为空"); } var restype = this.Ucsys1.GetDDLByID("DDL_ResultType").SelectedItemStringVal; if (restype.Length == 0) { throw new Exception("选择接口返回值类型"); } #endregion 检查必填项. if (this.RefNo == null) { if (main.IsExits == true) { throw new Exception("编号[" + main.No + "]已经存在"); } } //设置它的数据源类型. main.SrcType = SrcType.WebServices; main.TableDesc += "," + restype; if (this.RefNo == null) { main.FK_Val = main.No; } main.Save(); //重新生成 this.Response.Redirect("SFWS.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "&FromApp=" + this.FromApp + "&t=" + DateTime.Now.ToString("yyyyMMddHHmmssffffff"), true); } catch (Exception ex) { this.Alert(ex.Message); } }
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(); }
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); }
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; } #region 处理外部表,与WS表的方式. if (attr.UIContralType == UIContralType.DDL && attr.UIBindKey != "") { DDL ddl = new DDL(); ddl.ID = "DDL_" + attr.KeyOfEn + "_" + i; if (attr.UIIsEnable == false) { ddl.Enabled = false; if (attr.DefValReal == "") { ddl.Items.Add(new ListItem("无默认值", "无默认值")); } else { ddl.Items.Add(new ListItem(attr.DefVal, attr.DefVal)); } this.Pub1.AddTD(ddl); break; } SFTable sf = new SFTable(attr.UIBindKey); if (sf.SrcType == SrcType.SQL) { /*如果数据源是SQL*/ try { ddl.Bind(sf.GetTableSQL, "No", "Name"); if (ddl.SetSelectItem(attr.DefVal) == false) { ddl.Items.Insert(0, new ListItem("请选择", attr.DefVal)); ddl.SelectedIndex = 0; } } catch { } } this.Pub1.AddTD(ddl); break; } #endregion 处理外部表,与WS表的方式. 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 ddlEnum = new DDL(); ddlEnum.ID = "DDL_" + attr.KeyOfEn + "_" + i; try { ddlEnum.BindSysEnum(attr.KeyOfEn); ddlEnum.SetSelectItem(attr.DefVal); } catch (Exception ex) { BP.Sys.PubClass.Alert(ex.Message); } ddlEnum.Enabled = attr.UIIsEnable; this.Pub1.AddTDCenter(ddlEnum); 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 输出自动计算公式 }
void btn_Save_Click(object sender, EventArgs e) { try { SFTable main = new SFTable(); main.No = this.RefNo; if (this.RefNo != null) { main.RetrieveFromDBSources(); } main = (SFTable)this.Ucsys1.Copy(main); if (main.No.Length == 0 || main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } if (this.RefNo == null) { main.No = this.Ucsys1.GetTBByID("TB_No").Text; if (main.IsExits) { string sql = "select No,Name FROM " + main.No + " WHERE 1=2"; try { BP.DA.DBAccess.RunSQLReturnTable(sql); } catch { this.Alert("错误:表或视图不存在No,Name列不符合约定规则 Key=" + main.No); return; } } } else { main.No = this.RefNo; main.RetrieveFromDBSources(); main = (SFTable)this.Ucsys1.Copy(main); if (main.No.Length == 0 || main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } } if (main.Name.Length == 0) { throw new Exception("编号与名称不能为空"); } if (main.No.Length == 0) { throw new Exception("编号与名称不能为空"); } if (this.RefNo == null) { main.FK_Val = main.No; } main.Save(); //重新生成 this.Response.Redirect("SFTable.aspx?RefNo=" + main.No + "&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "&FromApp=" + this.FromApp, true); } catch (Exception ex) { this.Alert(ex.Message); } }
void btn_Save_Click(object sender, EventArgs e) { var ts = new List <Tuple <string, string, int, int, int, int> >(); var colname = string.Empty; Tuple <string, string, int, int, int, int> t = null; HiddenField hid = null; MapData md = new MapData(); md.No = this.FK_MapData; md.RetrieveFromDBSources(); string msg = "导入字段信息:"; bool isLeft = true; float maxEnd = md.MaxEnd; //底部. foreach (Control ctrl in Pub1.Controls) { if (ctrl.ID == null || !ctrl.ID.StartsWith("HID_Idx_")) { continue; } hid = ctrl as HiddenField; colname = hid.ID.Substring("HID_Idx_".Length); MapAttr ma = new MapAttr(); ma.KeyOfEn = colname; ma.Name = this.Pub1.GetTBByID("TB_Desc_" + colname).Text; ma.FK_MapData = this.FK_MapData; ma.MyDataType = this.Pub1.GetDDLByID("DDL_DBType_" + colname).SelectedItemIntVal; ma.MaxLen = int.Parse(this.Pub1.GetTBByID("TB_Len_" + colname).Text); //ma.LGType = (BP.En.FieldTypeS)this.Pub1.GetDDLByID("DDL_LogicType_" + colname).SelectedItemIntVal; ma.UIBindKey = this.Pub1.GetTBByID("TB_BindKey_" + colname).Text; ma.MyPK = this.FK_MapData + "_" + ma.KeyOfEn; ma.LGType = BP.En.FieldTypeS.Normal; if (ma.UIBindKey != "") { SysEnums se = new SysEnums(); se.Retrieve(SysEnumAttr.EnumKey, ma.UIBindKey); if (se.Count > 0) { ma.MyDataType = BP.DA.DataType.AppInt; ma.LGType = BP.En.FieldTypeS.Enum; ma.UIContralType = BP.En.UIContralType.DDL; } SFTable tb = new SFTable(); tb.No = ma.UIBindKey; if (tb.IsExits == true) { ma.MyDataType = BP.DA.DataType.AppString; ma.LGType = BP.En.FieldTypeS.FK; ma.UIContralType = BP.En.UIContralType.DDL; } } if (ma.MyDataType == BP.DA.DataType.AppBoolean) { ma.UIContralType = BP.En.UIContralType.CheckBok; } if (ma.IsExits) { continue; } ma.Insert(); msg += "\t\n字段:" + ma.KeyOfEn + "" + ma.Name + "加入成功."; FrmLab lab = null; if (isLeft == true) { maxEnd = maxEnd + 40; /* 是否是左边 */ lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 40; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } else { lab = new FrmLab(); lab.MyPK = BP.DA.DBAccess.GenerGUID(); lab.FK_MapData = this.FK_MapData; lab.Text = ma.Name; lab.X = 350; lab.Y = maxEnd; lab.Insert(); ma.X = lab.X + 80; ma.Y = maxEnd; ma.Update(); } isLeft = !isLeft; } //重新设置. md.ResetMaxMinXY(); BP.Sys.PubClass.WinClose("OK"); }
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> /// 检查enittyNoName类型的实体 /// </summary> public void CheckEnityTypeAttrsFor_EntityNoName() { //取出来全部的属性. MapAttrs attrs = new MapAttrs(this.No); #region 补充上流程字段到 NDxxxRpt. if (attrs.Contains(this.No + "_" + GERptAttr.OID) == false) { /* WorkID */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.KeyOfEn = "OID"; attr.Name = "主键ID"; attr.MyDataType = BP.DA.DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.DefVal = "0"; attr.HisEditType = BP.En.EditType.Readonly; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.BillNo) == false) { /* 单据编号 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.BillNo; attr.Name = "编号"; // 单据编号 attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = true; attr.UIIsEnable = false; attr.UIIsLine = false; attr.MinLen = 0; attr.MaxLen = 100; attr.Idx = -100; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.Title) == false) { /* 名称 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.Title; // "FlowEmps"; attr.Name = "名称"; // 单据模式, ccform的模式. attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = true; attr.UIIsEnable = true; attr.UIIsLine = true; attr.MinLen = 0; attr.MaxLen = 400; attr.Idx = -90; attr.Insert(); } if (attrs.Contains(this.No + "_BillState") == false) { /* 单据状态 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "BillState"; // "FlowEmps"; attr.Name = "单据状态"; // attr.MyDataType = DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = true; attr.MinLen = 0; attr.MaxLen = 10; attr.Idx = -98; attr.Insert(); } if (attrs.Contains(this.No + "_Starter") == false) { /* 发起人 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "Starter"; attr.Name = "创建人"; // attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.MinLen = 0; attr.MaxLen = 32; attr.Idx = -1; attr.Insert(); } if (attrs.Contains(this.No + "_StarterName") == false) { /* 创建人名称 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "StarterName"; attr.Name = "创建人名称"; // attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.MinLen = 0; attr.MaxLen = 32; attr.Idx = -1; attr.Insert(); } if (attrs.Contains(this.No + "_" + GERptAttr.AtPara) == false) { /* 参数 */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = GERptAttr.AtPara; attr.Name = "参数"; // 单据编号 attr.MyDataType = DataType.AppString; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = false; attr.MinLen = 0; attr.MaxLen = 4000; attr.Idx = -99; attr.Insert(); } if (attrs.Contains(this.No + "_RDT") == false) { /* MyNum */ MapAttr attr = new BP.Sys.MapAttr(); attr.FK_MapData = this.No; attr.HisEditType = EditType.UnDel; attr.KeyOfEn = "RDT"; // "FlowStartRDT"; attr.Name = "创建时间"; attr.MyDataType = DataType.AppDateTime; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.UIIsLine = false; attr.Idx = -97; attr.Insert(); } #endregion 补充上流程字段。 #region 注册到外键表. SFTable sf = new SFTable(); sf.No = this.No; if (sf.RetrieveFromDBSources() == 0) { sf.Name = this.Name; sf.SrcType = SrcType.SQL; sf.SrcTable = this.PTable; sf.ColumnValue = "BillNo"; sf.ColumnText = "Title"; sf.SelectStatement = "SELECT BillNo AS No, Title as Name FROM " + this.PTable; sf.Insert(); } #endregion 注册到外键表 }
public string DoType(string dotype, string v1, string v2, string v3, string v4, string v5) { string sql = ""; try { switch (dotype) { case "CreateCheckGroup": string gKey = v1; string gName = v2; string enName1 = v3; MapAttr attrN = new MapAttr(); int i = attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_Note"); i += attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_Checker"); i += attrN.Retrieve(MapAttrAttr.FK_MapData, enName1, MapAttrAttr.KeyOfEn, gKey + "_RDT"); if (i > 0) { return("前缀已经使用:" + gKey + " , 请确认您是否增加了这个审核分组或者,请您更换其他的前缀。"); } GroupField gf = new GroupField(); gf.Lab = gName; gf.EnName = enName1; gf.Insert(); attrN = new MapAttr(); attrN.FK_MapData = enName1; attrN.KeyOfEn = gKey + "_Note"; attrN.Name = "审核意见"; attrN.MyDataType = DataType.AppString; attrN.UIContralType = UIContralType.TB; attrN.UIIsEnable = true; attrN.UIIsLine = true; attrN.MaxLen = 4000; attrN.GroupID = gf.OID; attrN.UIHeight = 23 * 3; attrN.IDX = 1; attrN.Insert(); attrN = new MapAttr(); attrN.FK_MapData = enName1; attrN.KeyOfEn = gKey + "_Checker"; attrN.Name = "审核人";// "审核人"; attrN.MyDataType = DataType.AppString; attrN.UIContralType = UIContralType.TB; attrN.MaxLen = 50; attrN.MinLen = 0; attrN.UIIsEnable = true; attrN.UIIsLine = false; attrN.DefVal = "@WebUser.Name"; attrN.UIIsEnable = false; attrN.GroupID = gf.OID; attrN.IsSigan = true; attrN.IDX = 2; attrN.Insert(); attrN = new MapAttr(); attrN.FK_MapData = enName1; attrN.KeyOfEn = gKey + "_RDT"; attrN.Name = "审核日期"; // "审核日期"; attrN.MyDataType = DataType.AppDateTime; attrN.UIContralType = UIContralType.TB; attrN.UIIsEnable = true; attrN.UIIsLine = false; attrN.DefVal = "@RDT"; attrN.UIIsEnable = false; attrN.GroupID = gf.OID; attrN.IDX = 3; attrN.Insert(); return(null); case "NewDtl": MapDtl dtlN = new MapDtl(); dtlN.No = v1; if (dtlN.RetrieveFromDBSources() != 0) { return("从表已存在"); } dtlN.Name = v1; dtlN.FK_MapData = v2; dtlN.PTable = v1; dtlN.Insert(); dtlN.IntMapAttrs(); return(null); case "DelM2M": MapM2M m2mDel = new MapM2M(); m2mDel.MyPK = v1; m2mDel.Delete(); //M2M m2mData = new M2M(); //m2mData.Delete(M2MAttr.FK_MapData, v1); return(null); case "NewAthM": // 新建 NewAthM. string fk_mapdataAth = v1; string athName = v2; BP.Sys.FrmAttachment athM = new FrmAttachment(); athM.MyPK = athName; if (athM.IsExits) { return("多选名称:" + athName + ",已经存在。"); } athM.X = float.Parse(v3); athM.Y = float.Parse(v4); athM.Name = "多文件上传"; athM.FK_MapData = fk_mapdataAth; athM.Insert(); return(null); case "NewM2M": string fk_mapdataM2M = v1; string m2mName = v2; MapM2M m2m = new MapM2M(); m2m.FK_MapData = v1; m2m.NoOfObj = v2; if (v3 == "0") { m2m.HisM2MType = M2MType.M2M; m2m.Name = "新建一对多"; } else { m2m.HisM2MType = M2MType.M2MM; m2m.Name = "新建一对多多"; } m2m.X = float.Parse(v4); m2m.Y = float.Parse(v5); m2m.MyPK = m2m.FK_MapData + "_" + m2m.NoOfObj; if (m2m.IsExits) { return("多选名称:" + m2mName + ",已经存在。"); } m2m.Insert(); return(null); case "DelEnum": // 检查这个物理表是否被使用。 sql = "SELECT * FROM Sys_MapAttr WHERE UIBindKey='" + v1 + "'"; DataTable dtEnum = DBAccess.RunSQLReturnTable(sql); string msgDelEnum = ""; foreach (DataRow dr in dtEnum.Rows) { msgDelEnum += "\n 表单编号:" + dr["FK_MapData"] + " , 字段:" + dr["KeyOfEn"] + ", 名称:" + dr["Name"]; } if (msgDelEnum != "") { return("该枚举已经被如下字段所引用,您不能删除它。" + msgDelEnum); } sql = "DELETE FROM Sys_EnumMain WHERE No='" + v1 + "'"; sql += "@DELETE FROM Sys_Enum WHERE EnumKey='" + v1 + "' "; DBAccess.RunSQLs(sql); return(null); case "DelSFTable": /* 删除自定义的物理表. */ // 检查这个物理表是否被使用。 sql = "SELECT * FROM Sys_MapAttr WHERE UIBindKey='" + v1 + "'"; DataTable dt = DBAccess.RunSQLReturnTable(sql); string msgDel = ""; foreach (DataRow dr in dt.Rows) { msgDel += "\n 表单编号:" + dr["FK_MapData"] + " , 字段:" + dr["KeyOfEn"] + ", 名称:" + dr["Name"]; } if (msgDel != "") { return("该数据表已经被如下字段所引用,您不能删除它。" + msgDel); } SFTable sfDel = new SFTable(); sfDel.No = v1; sfDel.DirectDelete(); return(null); case "SaveSFTable": string enName = v2; string chName = v1; if (string.IsNullOrEmpty(v1) || string.IsNullOrEmpty(v2)) { return("视图中的中英文名称不能为空。"); } SFTable sf = new SFTable(); sf.No = enName; sf.Name = chName; sf.No = enName; sf.Name = chName; sf.FK_Val = enName; sf.Save(); if (DBAccess.IsExitsObject(enName) == true) { /*已经存在此对象,检查一下是否有No,Name列。*/ sql = "SELECT No,Name FROM " + enName; try { DBAccess.RunSQLReturnTable(sql); } catch (Exception ex) { return("您指定的表或视图(" + enName + "),不包含No,Name两列,不符合ccflow约定的规则。技术信息:" + ex.Message); } return(null); } else { /*创建这个表,并且插入基础数据。*/ try { // 如果没有该表或者视图,就要创建它。 sql = "CREATE TABLE " + enName + "(No varchar(30) NOT NULL,Name varchar(50) NULL)"; DBAccess.RunSQL(sql); DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('001','Item1')"); DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('002','Item2')"); DBAccess.RunSQL("INSERT INTO " + enName + " (No,Name) VALUES('003','Item3')"); } catch (Exception ex) { sf.DirectDelete(); return("创建物理表期间出现错误,可能是非法的物理表名.技术信息:" + ex.Message); } } return(null); /*创建成功后返回空值*/ case "FrmTempleteExp": //导出表单. MapData mdfrmtem = new MapData(); mdfrmtem.No = v1; if (mdfrmtem.RetrieveFromDBSources() == 0) { if (v1.Contains("ND")) { int nodeId = int.Parse(v1.Replace("ND", "")); Node nd = new Node(nodeId); mdfrmtem.Name = nd.Name; mdfrmtem.PTable = v1; mdfrmtem.EnPK = "OID"; mdfrmtem.Insert(); } } DataSet ds = mdfrmtem.GenerHisDataSet(); string file = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Temp\\" + v1 + ".xml"; if (System.IO.File.Exists(file)) { System.IO.File.Delete(file); } ds.WriteXml(file); // BP.PubClass.DownloadFile(file, mdfrmtem.Name + ".xml"); //this.DownLoadFile(System.Web.HttpContext.Current, file, mdfrmtem.Name); return(null); case "FrmTempleteImp": //导入表单. DataSet dsImp = new DataSet(); string fileImp = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Temp\\" + v1 + ".xml"; dsImp.ReadXml(fileImp); //读取文件. MapData.ImpMapData(v1, dsImp, true); return(null); case "NewHidF": string fk_mapdataHid = v1; string key = v2; string name = v3; int dataType = int.Parse(v4); MapAttr mdHid = new MapAttr(); mdHid.MyPK = fk_mapdataHid + "_" + key; mdHid.FK_MapData = fk_mapdataHid; mdHid.KeyOfEn = key; mdHid.Name = name; mdHid.MyDataType = dataType; mdHid.HisEditType = EditType.Edit; mdHid.MaxLen = 100; mdHid.MinLen = 0; mdHid.LGType = FieldTypeS.Normal; mdHid.UIVisible = false; mdHid.UIIsEnable = false; mdHid.Insert(); return(null); case "DelDtl": MapDtl dtl = new MapDtl(v1); dtl.Delete(); return(null); case "DeleteFrm": string delFK_Frm = v1; MapData mdDel = new MapData(delFK_Frm); mdDel.Delete(); sql = "@DELETE FROM Sys_MapData WHERE No='" + delFK_Frm + "'"; sql = "@DELETE FROM WF_FrmNode WHERE FK_Frm='" + delFK_Frm + "'"; DBAccess.RunSQLs(sql); return(null); case "FrmUp": case "FrmDown": FrmNode myfn = new FrmNode(); myfn.Retrieve(FrmNodeAttr.FK_Node, v1, FrmNodeAttr.FK_Frm, v2); if (dotype == "FrmUp") { myfn.DoUp(); } else { myfn.DoDown(); } return(null); case "SaveFlowFrm": // 转化参数意义. string vals = v1; string fk_Node = v2; string fk_flow = v3; bool isPrint = false; if (v5 == "1") { isPrint = true; } bool isReadonly = false; if (v4 == "1") { isReadonly = true; } string msg = this.SaveEn(vals); if (msg.Contains("Error")) { return(msg); } string fk_frm = msg; Frm fm = new Frm(); fm.No = fk_frm; fm.Retrieve(); FrmNode fn = new FrmNode(); if (fn.Retrieve(FrmNodeAttr.FK_Frm, fk_frm, FrmNodeAttr.FK_Node, fk_Node) == 1) { fn.IsEdit = !isReadonly; fn.IsPrint = isPrint; fn.FK_Flow = fk_flow; fn.Update(); BP.DA.DBAccess.RunSQL("UPDATE Sys_MapData SET FK_FrmSort='01',AppType=1 WHERE No='" + fk_frm + "'"); return(fk_frm); } fn.FK_Frm = fk_frm; fn.FK_Flow = fk_flow; fn.FK_Node = int.Parse(fk_Node); fn.IsEdit = !isReadonly; fn.IsPrint = isPrint; fn.Idx = 100; fn.FK_Flow = fk_flow; fn.Insert(); MapData md = new MapData(); md.No = fm.No; if (md.RetrieveFromDBSources() == 0) { md.Name = fm.Name; md.EnPK = "OID"; md.Insert(); } MapAttr attr = new MapAttr(); attr.FK_MapData = md.No; attr.KeyOfEn = "OID"; attr.Name = "WorkID"; attr.MyDataType = BP.DA.DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.DefVal = "0"; attr.HisEditType = BP.En.EditType.Readonly; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = md.No; attr.KeyOfEn = "FID"; attr.Name = "FID"; attr.MyDataType = BP.DA.DataType.AppInt; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.DefVal = "0"; attr.HisEditType = BP.En.EditType.Readonly; attr.Insert(); attr = new MapAttr(); attr.FK_MapData = md.No; attr.KeyOfEn = "RDT"; attr.Name = "记录日期"; attr.MyDataType = BP.DA.DataType.AppDateTime; attr.UIContralType = UIContralType.TB; attr.LGType = FieldTypeS.Normal; attr.UIVisible = false; attr.UIIsEnable = false; attr.DefVal = "@RDT"; attr.HisEditType = BP.En.EditType.Readonly; attr.Insert(); return(fk_frm); default: return("Error:" + dotype + " , 未设置此标记."); } } catch (Exception ex) { return("Error:" + ex.Message); } }