private void RptBind(string _strWhere, string _orderby) { this.page = TWRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; Tea.Web.UI.ShopPage bll_view = new Tea.Web.UI.ShopPage(); rptList.DataSource = bll_view.GetViewList("shop_quan", "", this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); rptList.DataBind(); //綁定頁碼 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("user_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void RptBind(int _channel_id, int _category_id, string _strWhere, string _orderby) { this.page = TWRequest.GetQueryInt("page", 1); if (this.category_id > 0) { this.ddlCategoryId.SelectedValue = _category_id.ToString(); } this.txtKeywords.Text = this.keywords; //圖表或列表顯示 Tea.Web.UI.ShopPage bll_view = new Tea.Web.UI.ShopPage(); this.rptList1.DataSource = bll_view.GetViewList("view_goods", "", this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList1.DataBind(); //綁定頁碼 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("dialog_group.aspx", "channel_id={0}&category_id={1}&keywords={2}&page={3}&goods_ids={4}", _channel_id.ToString(), _category_id.ToString(), this.keywords, "__id__", this.goods_ids); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void RptBind(string _strWhere, string _orderby) { this.page = TWRequest.GetQueryInt("page", 1); txtKeywords.Text = this.keywords; txtbegin.Text = begin; txtend.Text = end; Tea.Web.UI.ShopPage bll_view = new Tea.Web.UI.ShopPage(); this.rptList.DataSource = bll_view.GetViewList("shop_orders", "", this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //綁定頁碼 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("chu.aspx", "status={0}&payment_status={1}&express_status={2}&keywords={3}&page={4}", this.status.ToString(), this.payment_status.ToString(), this.express_status.ToString(), this.keywords, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//匯出CSV protected void btnExport_Click(object sender, EventArgs e) { ChkAdminLevelEdit("baobiao_3", "Edit"); string fileName = "訂單" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xls"; Tea.Web.UI.ShopPage bll_view = new Tea.Web.UI.ShopPage(); DataTable dt = bll_view.GetViewList("shop_orders", "", 10000, this.page, "1=1 " + CombSqlTxt(this.status, this.payment_status, this.express_status, this.keywords, data, begin, end, peisong), "id desc", out this.totalCount).Tables[0]; string[] titleCol = new string[] { "訂單號", "下單時間", "收貨人", "出貨時間", "出貨單狀態" }; Response.Clear(); Response.Buffer = true; Response.Charset = "UTF-8"; Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); Response.Write("<metahttp-equiv=Content-Type content=application/ms-excel;charset=UTF-8>"); Response.ContentType = "application/ms-excel;charset=UTF-8"; ////定义表对象与行对象,同时用DataSet对其值进行初始化 //DataTable dt = ds.Tables[0]; DataRow[] myRow = dt.Select();//可以类似dt.Select("id>10")之形式达到数据筛选目的 int i = 0; int j = 0; StringBuilder sb = new StringBuilder(); sb.Append("<table borderColor='black' border='1' >"); sb.Append("<thead>"); sb.Append("<tr>"); //取得数据表各列标题,各标题之间以t分割,最后一个列标题后加回车符 for (i = 0; i < titleCol.Length; i++) { sb.Append("<th>" + titleCol[i].ToString() + "</th>"); } sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); //向HTTP输出流中写入取得的数据信息 //逐行处理数据 int a = 1; foreach (DataRow dr in dt.Rows) { sb.Append("<tr>"); for (i = 0; i < titleCol.Length; i++) { switch (i) { case 0: sb.Append("<td>" + dr["order_no"].ToString() + "</td>"); break; case 1: sb.Append("<td>" + dr["add_time"].ToString() + "</td>"); break; case 2: sb.Append("<td>" + dr["accept_name"].ToString() + "</td>"); break; case 3: sb.Append("<td>" + dr["express_time"].ToString() + "</td>"); break; case 4: sb.Append("<td>" + getstate(dr["express_status"].ToString()) + "</td>"); break; } } sb.Append("</tr>"); a = a + 1; } sb.Append("</tbody></table>"); Response.Write(sb.ToString()); Response.End(); }