protected void btn_save_Click(object sender, ImageClickEventArgs e) { ReportTableModel report = new ReportTableModel(); string tablestr = string.Empty; for (int i = 0; i < this.tablelist.Items.Count; i++) { if (tablelist.Items[i].Selected) { tablestr += "," + tablelist.Items[i].Value; } } report.Tablelist = tablestr.TrimStart(','); string id = "0"; if (Request.QueryString["getid"] != null) { id = Request.QueryString["getid"].ToString(); } else { id = HidControl.Value; } report.Menuname = this.txt_menu.Text; report.SqlStr = this.txt_sql.Text; report.timeFlag = Convert.ToInt32(this.ddl_timeflag.SelectedValue); report.Excelhead = ""; HidControl.Value = TableReportBus.InsertReport(report, UserInfo, id, hiduserid.Value).ToString(); }
private void BindTableList() { tablelist.DataSource = TableReportBus.GetTableList(); tablelist.DataTextField = "buildTableName"; tablelist.DataValueField = "ID"; tablelist.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindTableList(); if (Request.QueryString["getid"] != null) { DataSet ds = TableReportBus.GetRePortByID(Request.QueryString["getid"].ToString()); this.txt_menu.Text = ds.Tables[0].Rows[0]["Menuname"].ToString(); this.ddl_timeflag.SelectedValue = ds.Tables[0].Rows[0]["timeFlag"].ToString(); this.txt_sql.Text = ds.Tables[0].Rows[0]["SqlStr"].ToString(); if (ds.Tables[1].Rows.Count > 0) { hiduserid.Value = ds.Tables[1].Rows[0]["userdUserList"].ToString(); Hidname.Value = TableReportBus.GetUserNameList(hiduserid.Value); } for (int i = 0; i < this.tablelist.Items.Count; i++) { foreach (string ii in ds.Tables[0].Rows[0]["tablelist"].ToString().Split(',')) { if (this.tablelist.Items[i].Value == ii) { this.tablelist.Items[i].Selected = true; } } } } } }
protected void btn_excel_Click(object sender, ImageClickEventArgs e) { DataTable dt = TableReportBus.GetReportTableByID(Request.QueryString["reportid"].ToString(), txtBeginDate.Value, this.txtEndDate.Value); DataSet ds = TableReportBus.GetRePortByID(Request.QueryString["reportid"].ToString()); if (dt != null && dt.Rows.Count > 0) { string headstr = string.Empty; foreach (DataColumn c in dt.Columns) { headstr = headstr + "," + c.ColumnName; } headstr = headstr.TrimStart(','); try { ExportExcelReport(dt, headstr, "", ds.Tables[0].Rows[0]["Menuname"].ToString()); } catch { } } }
/// <summary> /// 界面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //绑定时间 this.txtBeginDate.Value = System.DateTime.Now.ToString("yyyy-MM-01"); this.txtEndDate.Value = System.DateTime.Now.ToString("yyyy-MM-dd"); if (Request.QueryString["reportid"] != null) { //获取报表头 DataSet ds = TableReportBus.GetRePortByID(Request.QueryString["reportid"].ToString()); report_title.Text = ds.Tables[0].Rows[0]["Menuname"].ToString(); this.Reportlist.DataSource = TableReportBus.GetReportTableByID(Request.QueryString["reportid"].ToString(), txtBeginDate.Value, this.txtEndDate.Value); this.Reportlist.DataBind(); } } lbl_time.Text = System.DateTime.Now.ToShortDateString(); lbl_person.Text = UserInfo.EmployeeName.ToString(); }
protected void btn_query_Click(object sender, ImageClickEventArgs e) { this.Reportlist.DataSource = TableReportBus.GetReportTableByID(Request.QueryString["reportid"].ToString(), txtBeginDate.Value, this.txtEndDate.Value); this.Reportlist.DataBind(); }