protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["REID"] != null) { RegularExpressionDtls reDtls = new RegularExpressionDtls(); reDtls.RetrieveAll(); //删除现有的逻辑. BP.Sys.MapExts exts = new BP.Sys.MapExts(); exts.Delete(MapExtAttr.AttrOfOper, this.KeyOfEn, MapExtAttr.ExtType, BP.Sys.MapExtXmlList.RegularExpression); // 开始装载. foreach (RegularExpressionDtl dtl in reDtls) { if (dtl.ItemNo != this.Request.QueryString["REID"]) { continue; } BP.Sys.MapExt ext = new BP.Sys.MapExt(); ext.MyPK = this.FK_MapData + "_" + this.KeyOfEn + "_" + MapExtXmlList.RegularExpression + "_" + dtl.ForEvent; ext.FK_MapData = this.FK_MapData; ext.AttrOfOper = this.KeyOfEn; ext.Doc = dtl.Exp; //表达公式. ext.Tag = dtl.ForEvent; //时间. ext.Tag1 = dtl.Msg; //消息 ext.ExtType = MapExtXmlList.RegularExpression; // 表达公式 . ext.Insert(); } //this.WinClose("1"); //关闭并返回一个值。 return; } RegularExpressions res = new RegularExpressions(); res.RetrieveAll(); this.Pub1.AddH3("事件模版-点击名称选用它."); this.Pub1.AddHR(); this.Pub1.AddUL(); foreach (RegularExpression item in res) { this.Pub1.AddLi("<a href=\"javascript:DoIt('" + this.FK_MapData + "','" + this.KeyOfEn + "','" + this.ForCtrl + "','" + item.No + "','" + item.Name + "');\" >" + item.Name + "</a> - " + item.Note); } this.Pub1.AddULEnd(); }
/// <summary> /// 删除垃圾数据. /// </summary> public static void DeleteDB() { MapExts exts = new MapExts(); exts.RetrieveAll(); return; foreach (MapExt ext in exts) { if (ext.ExtType == MapExtXmlList.ActiveDDL) { if (ext.AttrOfOper.Trim().Length == 0) { ext.Delete(); continue; } MapAttr attr = new MapAttr(); attr.MyPK = ext.AttrOfOper; if (attr.IsExits == true) { ext.AttrOfOper = attr.KeyOfEn; ext.Delete(); ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); } if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.FK_MapData + "_" + ext.AttrOfOper) { ext.Delete(); //直接删除. ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive) { ext.Delete(); //直接删除. ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.FK_MapData + "_" + ext.AttrsOfActive + "_" + ext.AttrOfOper) { ext.Delete(); //直接删除. ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } //三个主键的情况. if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper) { ext.Delete(); ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } //三个主键的情况. if (ext.MyPK == ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrsOfActive) { ext.Delete(); ext.MyPK = ext.ExtType + "_" + ext.FK_MapData + "_" + ext.AttrOfOper + "_" + ext.AttrsOfActive; ext.Save(); continue; } } } }
public void btn_SaveReTemplete_Click(object sender, EventArgs e) { ListBox lb = this.Pub1.FindControl("LBReTemplete") as ListBox; if (lb == null && lb.SelectedItem.Value == null) { return; } string newMyPk = ""; RegularExpressionDtls reDtls = new RegularExpressionDtls(); reDtls.RetrieveAll(); //删除现有的逻辑. BP.Sys.MapExts exts = new BP.Sys.MapExts(); string[] strs = this.RefNo.Split(','); foreach (string field in strs) { if (string.IsNullOrEmpty(field) == true) { continue; } exts.Delete(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.AttrOfOper, field, MapExtAttr.ExtType, BP.Sys.MapExtXmlList.RegularExpression); } // 开始装载. foreach (RegularExpressionDtl dtl in reDtls) { if (dtl.ItemNo != lb.SelectedItem.Value) { continue; } foreach (string field in strs) { if (string.IsNullOrEmpty(field) == true) { continue; } BP.Sys.MapExt ext = new BP.Sys.MapExt(); ext.MyPK = this.FK_MapData + "_" + field + "_" + MapExtXmlList.RegularExpression + "_" + dtl.ForEvent; ext.FK_MapData = this.FK_MapData; ext.AttrOfOper = field; ext.Doc = dtl.Exp; //表达公式. ext.Tag = dtl.ForEvent; //时间. ext.Tag1 = dtl.Msg; //消息 ext.ExtType = MapExtXmlList.RegularExpression; // 表达公式 . ext.Insert(); newMyPk = ext.MyPK; } } if (this.RefNo != null && this.RefNo.Contains(",")) { this.WinCloseWithMsg("已经保存成功."); return; } else { this.Response.Redirect("RegularExpression.aspx?FK_MapData=" + this.FK_MapData + "&RefNo=" + this.RefNo + "&ExtType=" + this.ExtType + "&MyPK=" + newMyPk + "&OperAttrKey=" + this.OperAttrKey + "&DoType=New", true); } }