void EditPub(int id) { excelMod = excelBll.SelReturnModel(id); TableName_T.Text = excelMod.TableName; CNames_T.Text = excelMod.CNames; Fields_T.Text = excelMod.Fields; ID_Hid.Value = excelMod.ID.ToString(); function.Script(this, "ShowModel();"); }
protected void Add_Btn_Click(object sender, EventArgs e) { excelMod = FillMod(); if (!string.IsNullOrEmpty(ID_Hid.Value)) { excelBll.UpdateByID(excelMod); } else { excelBll.Insert(excelMod); } MyBind(); }
private M_Pub_Excel FillMod() { M_Pub_Excel model = new M_Pub_Excel(); if (!string.IsNullOrEmpty(ID_Hid.Value)) { model = excelBll.SelReturnModel(Convert.ToInt32(ID_Hid.Value)); } model.TableName = TableName_T.Text; model.CNames = CNames_T.Text; model.Fields = Fields_T.Text; model.UserID = badmin.GetAdminLogin().AdminId; model.CreateTime = DateTime.Now; return(model); }
protected void DownExcel_Btn_Click(object sender, EventArgs e) { M_Pub_Excel excelMod = new M_Pub_Excel(); B_Pub_Excel excelBll = new B_Pub_Excel(); M_Pub pubinfo = pub.GetSelect(PubID); excelMod = excelBll.SelByTbName(pubinfo.PubTableName); if (excelMod == null) { function.WriteErrMsg("尚未为表:" + pubinfo.PubTableName + "指定导出规则,请先<a href='PubExcel.aspx?mid=" + pubinfo.PubModelID + "'>点此设定导出规则</a>"); } OfficeHelper ofHelper = new OfficeHelper(); SafeC.DownStr(ofHelper.GetExcelByDT(GetDT(), excelMod.Fields, excelMod.CNames), DateTime.Now.ToString("yyyyMMdd") + "互动信息.xls", Encoding.Default); }
//Excel下载 protected void DownExcel_Btn_Click(object sender, EventArgs e) { M_Pub_Excel excelMod = new M_Pub_Excel(); B_Pub_Excel excelBll = new B_Pub_Excel(); int pubid = Convert.ToInt32(Request.QueryString["PubID"]); M_Pub pubinfo = pub.GetSelect(pubid); excelMod = excelBll.SelByTbName(pubinfo.PubTableName); if (excelMod == null) { function.WriteErrMsg("尚未为表:" + pubinfo.PubTableName + "指定导出规则,请先<a href='PubExcel.aspx'>点此设定导出规则</a>"); } OfficeHelper ofHelper = new OfficeHelper(); SafeSC.DownStr(ofHelper.GetExcelByDT(GetDT(), excelMod.Fields, excelMod.CNames), "互动回复.xls"); }