void ddlType_SelectedIndexChanged(object sender, EventArgs e) { MapAttr attr = new MapAttr(this.RefNo); attr.MyDataTypeS = this.Pub1.GetDDLByID("DDL_DTType").SelectedItemStringVal; attr.Update(); this.Response.Redirect("EditF.aspx?DoType=" + this.DoType + "&MyPK=" + this.MyPK + "&RefNo=" + this.RefNo + "&FType=" + attr.MyDataType + "&GroupField=" + this.GroupField, true); // this.Response.Redirect(this.Request.RawUrl, true); }
protected override void afterInsertUpdateAction() { MapAttr mapAttr = new MapAttr(); mapAttr.MyPK = this.MyPK; mapAttr.RetrieveFromDBSources(); mapAttr.Update(); //调用frmEditAction, 完成其他的操作. BP.Sys.CCFormAPI.AfterFrmEditAction(this.FK_MapData); base.afterInsertUpdateAction(); }
void btn_Click(object sender, EventArgs e) { MapDatas mds = this.GetMDs; MapAttr mattrOld = new MapAttr(this.FK_MapData, this.KeyOfEn); MapAttr mattr = new MapAttr(this.FK_MapData, this.KeyOfEn); foreach (MapData md in mds) { CheckBox cb = this.Pub1.GetCBByID("CB_" + md.No); if (cb == null) { continue; } if (cb.Checked == false) { continue; } if (this.DoType == "Copy") { /*执行批量Copy*/ mattr.FK_MapData = md.No; mattr.Insert(); mattr.Idx = mattrOld.Idx; } if (this.DoType == "Update") { /*执行批量Update*/ MapAttr mattrUpdate = new MapAttr(md.No, this.KeyOfEn); int gID = mattrUpdate.GroupID; mattrUpdate.Copy(mattrOld); mattrUpdate.FK_MapData = md.No; mattrUpdate.GroupID = gID; mattrUpdate.Update(); } if (this.DoType == "Delete") { /*执行批量 Delete */ MapAttr mattrDelete = new MapAttr(md.No, this.KeyOfEn); mattrDelete.Delete(); } } // 转向. this.Response.Redirect(this.Request.RawUrl, true); }
/// <summary> /// 保存列的顺序名称. /// </summary> /// <returns></returns> public string S3ColsLabel_Save() { string orders = this.GetRequestVal("Orders"); //格式为 @KeyOfEn,Lable,idx 比如: @DianHua,电话,1@Addr,地址,2 string rptNo = this.GetRequestVal("RptNo"); string[] strs = orders.Split('@'); foreach (string item in strs) { if (DataType.IsNullOrEmpty(item) == true) { continue; } string[] vals = item.Split(','); string mypk = rptNo + "_" + vals[0]; MapAttr attr = new MapAttr(); attr.MyPK = mypk; attr.Retrieve(); attr.Name = vals[1]; attr.Idx = int.Parse(vals[2]); attr.Update(); //执行更新. } MapAttr myattr = new MapAttr(); myattr.MyPK = rptNo + "_OID"; myattr.RetrieveFromDBSources(); myattr.Idx = 200; myattr.Name = "工作ID"; myattr.Update(); myattr = new MapAttr(); myattr.MyPK = rptNo + "_Title"; myattr.RetrieveFromDBSources(); myattr.Idx = -100; myattr.Name = "标题"; myattr.Update(); return("保存成功.."); }
protected override bool beforeUpdateInsertAction() { //如果没默认值. if (this.DefVal == "") { this.DefVal = "0"; } MapAttr attr = new MapAttr(); attr.MyPK = this.MyPK; attr.RetrieveFromDBSources(); //是否显示合计 attr.IsSum = this.GetValBooleanByKey("ExtIsSum"); //增加保留小数位数. attr.SetPara("DecimalDigits", this.GetValIntByKey("DecimalDigits")); attr.Update(); return(base.beforeUpdateInsertAction()); }
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"); }
void btn_Save_Click(object sender, EventArgs e) { try { Button btn = sender as Button; switch (btn.ID) { case "Btn_Del": MapAttr attrDel = new MapAttr(); attrDel.MyPK = this.RefNo; attrDel.Delete(); this.WinClose(); return; default: break; } MapAttr attr = new MapAttr(); if (this.RefNo == null || this.RefNo == "") { attr.MyPK = this.MyPK + "_" + this.Pub1.GetTBByID("TB_KeyOfEn").Text; attr.UIContralType = UIContralType.DDL; attr.MyDataType = BP.DA.DataType.AppString; attr.LGType = FieldTypeS.FK; attr.DefVal = ""; attr.UIBindKey = this.Request.QueryString["SFKey"]; attr.UIIsEnable = true; } else { attr.MyPK = this.RefNo; attr.Retrieve(); } attr = (MapAttr)this.Pub1.Copy(attr); attr.FK_MapData = this.MyPK; attr.GroupID = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal; attr.DefVal = this.Pub1.GetTBByID("TB_DefVal").Text; attr.UIBindKey = this.Pub1.GetTBByID("TB_UIBindKey").Text; //if (this.Pub1.IsExit("CB_IsDefValNull")) //{ // if (this.Pub1.GetCBByID("CB_IsDefValNull").Checked == false) // attr.DefVal = this.Pub1.GetDDLByID("DDL").SelectedItemStringVal; // else // attr.DefVal = ""; //} //else //{ // string s = this.Pub1.GetDDLByID("DDL_DefVal").SelectedItemStringVal; // if (s == "@Select") // { // attr.DefVal = this.Pub1.GetDDLByID("DDL").SelectedItemStringVal; // } // else // { // attr.DefVal = s; // } //} if (this.RefNo == null || this.RefNo == "") { attr.Insert(); } else { attr.Update(); } switch (btn.ID) { case "Btn_SaveAndClose": this.WinClose(); return; case "Btn_SaveAndNew": this.Response.Redirect("Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + attr.Idx + "&GroupField=" + this.GroupField, true); return; default: break; } this.Response.Redirect("EditTable.aspx?DoType=Edit&MyPK=" + this.MyPK + "&RefNo=" + attr.MyPK + "&GroupField=" + this.GroupField, true); } catch (Exception ex) { this.Alert(ex.Message); } }
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> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btn_Click(object sender, EventArgs e) { MapAttr mattr = new MapAttr(this.RefNo); if (this.Pub1.GetRadioButtonByID("RB_Way_0").Checked) { mattr.HisAutoFull = AutoFullWay.Way0; } // JS 方式。 if (this.Pub1.GetRadioButtonByID("RB_Way_1").Checked) { mattr.HisAutoFull = AutoFullWay.Way1_JS; mattr.AutoFullDoc = this.Pub1.GetTextBoxByID("TB_JS").Text; /*检查字段是否填写正确.*/ MapAttrs attrsofCheck = new MapAttrs(mattr.FK_MapData); string docC = mattr.AutoFullDoc; foreach (MapAttr attrC in attrsofCheck) { if (attrC.IsNum == false) { continue; } docC = docC.Replace("@" + attrC.KeyOfEn, ""); docC = docC.Replace("@" + attrC.Name, ""); } if (docC.Contains("@")) { this.Alert("您填写的表达公式不正确,导致一些数值类型的字段没有被正确的替换。" + docC); return; } } // 外键方式。 if (this.Pub1.GetRadioButtonByID("RB_Way_2").Checked) { mattr.HisAutoFull = AutoFullWay.Way2_SQL; mattr.AutoFullDoc = this.Pub1.GetTextBoxByID("TB_SQL").Text; } // 本表单中外键列。 string doc = ""; if (this.Pub1.GetRadioButtonByID("RB_Way_3").Checked) { mattr.HisAutoFull = AutoFullWay.Way3_FK; MapData md = new MapData(mattr.FK_MapData); Attrs attrs = md.GenerHisMap().HisFKAttrs; foreach (Attr attr in attrs) { if (attr.IsRefAttr) { continue; } if (this.Pub1.GetRadioButtonByID("RB_FK_" + attr.Key).Checked == false) { continue; } // doc = " SELECT " + this.Pub1.GetDDLByID("DDL_" + attr.Key).SelectedValue + " FROM " + attr.HisFKEn.EnMap.PhysicsTable + " WHERE NO=@" + attr.Key; doc = "@AttrKey=" + attr.Key + "@Field=" + this.Pub1.GetDDLByID("DDL_" + attr.Key).SelectedValue + "@Table=" + attr.HisFKEn.EnMap.PhysicsTable; } mattr.AutoFullDoc = doc; } // 本表单中从表列。 if (this.Pub1.GetRadioButtonByID("RB_Way_4").Checked) { MapDtls dtls = new MapDtls(mattr.FK_MapData); mattr.HisAutoFull = AutoFullWay.Way4_Dtl; foreach (MapDtl dtl in dtls) { try { if (this.Pub1.GetRadioButtonByID("RB_" + dtl.No).Checked == false) { continue; } } catch { continue; } // doc = "SELECT " + this.Pub1.GetDDLByID( "DDL_"+dtl.No + "_Way").SelectedValue + "(" + this.Pub1.GetDDLByID("DDL_"+dtl.No+"_F").SelectedValue + ") FROM " + dtl.No + " WHERE REFOID=@OID"; doc = "@Table=" + dtl.No + "@Field=" + this.Pub1.GetDDLByID("DDL_" + dtl.No + "_F").SelectedValue + "@Way=" + this.Pub1.GetDDLByID("DDL_" + dtl.No + "_Way").SelectedValue; } mattr.AutoFullDoc = doc; } try { mattr.DoCheckFullWay(); mattr.Update(); } catch (Exception ex) { this.ResponseWriteRedMsg(ex); return; } this.Alert("保存成功"); this.Pub1.Clear(); Button btn = sender as Button; if (btn.ID.Contains("Close")) { this.WinClose(); return; } else { this.Response.Redirect(this.Request.RawUrl, true); } }
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); }
void btn_Save_Click(object sender, EventArgs e) { try { Button btn = sender as Button; switch (btn.ID) { case "Btn_Del": this.Response.Redirect("Do.aspx?DoType=Del&MyPK=" + this.MyPK + "&RefNo=" + this.RefNo, true); return; default: break; } MapAttr attr = new MapAttr(); attr.MyPK = this.RefNo; if (this.RefNo != null) { attr.Retrieve(); } attr = (MapAttr)this.Pub1.Copy(attr); attr.FK_MapData = this.MyPK; attr.DefVal = this.Pub1.GetDDLByID("DDL").SelectedItemStringVal; attr.GroupID = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal; if (this.Pub1.GetRadioButtonByID("RB_Ctrl_0").Checked) { attr.UIContralType = UIContralType.DDL; } else { attr.UIContralType = UIContralType.RadioBtn; } if (this.RefNo == null) { attr.MyPK = this.MyPK + "_" + this.Pub1.GetTBByID("TB_KeyOfEn").Text; string idx = this.Request.QueryString["IDX"]; if (idx == null || idx == "") { } else { attr.IDX = int.Parse(this.Request.QueryString["IDX"]); } string enumKey = this.Request.QueryString["EnumKey"]; attr.UIBindKey = enumKey; attr.MyDataType = BP.DA.DataType.AppInt; attr.HisEditType = EditType.Edit; attr.UIContralType = UIContralType.DDL; attr.LGType = FieldTypeS.Enum; attr.Insert(); } else { attr.Update(); } switch (btn.ID) { case "Btn_SaveAndClose": this.WinClose(); return; case "Btn_SaveAndNew": this.Response.Redirect("Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + attr.IDX + "&GroupField=" + this.GroupField, true); return; default: break; } if (this.RefNo == null) { this.Response.Redirect("EditEnum.aspx?DoType=Edit&MyPK=" + this.MyPK + "&RefNo=" + attr.MyPK + "&GroupField=" + this.GroupField, true); } } catch (Exception ex) { this.Alert(ex.Message); } }
void btn_Save_Click(object sender, EventArgs e) { try { Button btn = sender as Button; switch (btn.ID) { case "Btn_Del": MapAttr attrDel = new MapAttr(); attrDel.MyPK = this.RefNo; attrDel.Delete(); this.WinClose(); return; default: break; } MapAttr attr = new MapAttr(); if (this.RefNo == null || this.RefNo == "") { attr.MyPK = this.MyPK + "_" + this.Pub1.GetTBByID("TB_KeyOfEn").Text; attr.KeyOfEn = this.Pub1.GetTBByID("TB_KeyOfEn").Text; attr.UIContralType = UIContralType.DDL; attr.MyDataType = BP.DA.DataType.AppString; attr.LGType = FieldTypeS.Normal; attr.DefVal = ""; attr.UIBindKey = this.Request.QueryString["SFKey"]; attr.UIIsEnable = true; if (attr.IsExits == true) { throw new Exception("@字段名[" + attr.KeyOfEn + "]已经存在,保存失败。"); } attr = (MapAttr)this.Pub1.Copy(attr); } else { attr.MyPK = this.RefNo; attr.Retrieve(); attr = (MapAttr)this.Pub1.Copy(attr); } attr.FK_MapData = this.MyPK; attr.GroupID = this.Pub1.GetDDLByID("DDL_GroupID").SelectedItemIntVal; attr.ColSpan = this.Pub1.GetDDLByID("DDL_ColSpan").SelectedItemIntVal; attr.DefVal = this.Pub1.GetTBByID("TB_DefVal").Text; attr.UIBindKey = this.Pub1.GetTBByID("TB_UIBindKey").Text; string field = attr.KeyOfEn; if (this.RefNo == null || this.RefNo == "") { attr.Insert(); //首先插入数据表现数据. //插入隐藏数据. attr.KeyOfEn = field + "T"; attr.UIVisible = false; attr.UIIsEnable = false; //让其不是隐藏字段. attr.Insert(); //还原以前的值. attr.KeyOfEn = field; attr.MyPK = this.MyPK + "_" + field; attr.UIVisible = true; } else { attr.Update(); } switch (btn.ID) { case "Btn_SaveAndClose": this.WinClose(); return; case "Btn_SaveAndNew": this.Response.Redirect("Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + attr.Idx + "&GroupField=" + this.GroupField, true); return; default: break; } this.Response.Redirect("EditSQL.aspx?DoType=Edit&MyPK=" + this.MyPK + "&RefNo=" + attr.MyPK + "&GroupField=" + this.GroupField, true); } catch (Exception ex) { this.Alert(ex.Message); } }