//保存 protected void Btn_Save_Click(object sender, EventArgs e) { FrmReportFields reportFields = new FrmReportFields(); reportFields.Delete(FrmReportFieldAttr.FK_MapData, this.FK_MapData); //OID默认必须有 FrmReportField reportFieldPK = new FrmReportField(); reportFieldPK.MyPK = this.FK_MapData + "_OID"; reportFieldPK.FK_MapData = this.FK_MapData; reportFieldPK.KeyOfEn = "OID"; reportFieldPK.Name = "编号"; reportFieldPK.UIWidth = "100"; reportFieldPK.Idx = 0; reportFieldPK.Insert(); //查询表单所有属性 MapAttrs mattrs = new MapAttrs(this.FK_MapData); foreach (MapAttr attr in mattrs) { CheckBox cb = this.Pub1.GetCBByID("CB_" + attr.KeyOfEn); if (cb == null || attr.KeyOfEn == "OID") { continue; } if (cb.Checked == false) { continue; } FrmReportField reportField = new FrmReportField(); reportField.MyPK = this.FK_MapData + "_" + attr.KeyOfEn; reportField.FK_MapData = this.FK_MapData; reportField.KeyOfEn = attr.KeyOfEn; reportField.Name = attr.Name; reportField.UIWidth = attr.UIWidth.ToString(); reportField.Idx = attr.Idx; reportField.Insert(); } this.Alert("保存成功。"); }
void cbAll_CheckedChanged(object sender, EventArgs e) { CheckBox cbAll = (CheckBox)sender; if (cbAll != null) { FrmReportFields reportFields = new FrmReportFields(); reportFields.Delete(FrmReportFieldAttr.FK_MapData, this.FK_MapData); if (cbAll.Checked) { //查询表单所有属性 MapAttrs mattrs = new MapAttrs(this.FK_MapData); //OID默认必须有 FrmReportField reportFieldPK = new FrmReportField(); reportFieldPK.MyPK = this.FK_MapData + "_OID"; reportFieldPK.FK_MapData = this.FK_MapData; reportFieldPK.KeyOfEn = "OID"; reportFieldPK.Name = "编号"; reportFieldPK.UIWidth = "100"; reportFieldPK.Idx = 0; reportFieldPK.Insert(); foreach (MapAttr attr in mattrs) { if (attr.KeyOfEn == "OID") { continue; } FrmReportField reportField = new FrmReportField(); reportField.MyPK = this.FK_MapData + "_" + attr.KeyOfEn; reportField.FK_MapData = this.FK_MapData; reportField.KeyOfEn = attr.KeyOfEn; reportField.Name = attr.Name; reportField.UIWidth = attr.UIWidth.ToString(); reportField.Idx = attr.Idx; reportField.Insert(); } this.Response.Redirect("Frm_ColsChose.aspx?IsChecked=true&FK_MapData=" + this.FK_MapData, true); } this.Response.Redirect("Frm_ColsChose.aspx?IsChecked=false&FK_MapData=" + this.FK_MapData, true); } }