private void btnCreateReport_Click(object sender, EventArgs e) { BalanceDetailQuery query = new BalanceDetailQuery(); query.UserName = this.userName; query.FromDate = this.dateStart; query.ToDate = this.dateEnd; query.SortBy = "TradeDate"; query.SortOrder = SortAction.Desc; query.TradeType = TradeTypes.DrawRequest; DbQueryResult distributorBalanceDetailsNoPage = DistributorHelper.GetDistributorBalanceDetailsNoPage(query); string s = ((string.Empty + "用户名") + ",交易时间" + ",业务摘要") + ",转出金额" + ",当前余额\r\n"; foreach (DataRow row in ((DataTable)distributorBalanceDetailsNoPage.Data).Rows) { s = s + row["UserName"]; s = s + "," + row["TradeDate"]; s = s + ",提现"; s = s + "," + row["Expenses"]; object obj2 = s; s = string.Concat(new object[] { obj2, ",", row["Balance"], "\r\n" }); } this.Page.Response.Clear(); this.Page.Response.Buffer = false; this.Page.Response.Charset = "GB2312"; this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributionBalanceDetailsStatistics.csv"); this.Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312"); this.Page.Response.ContentType = "application/octet-stream"; this.Page.EnableViewState = false; this.Page.Response.Write(s); this.Page.Response.End(); }
private void btnCreateReport_Click(object sender, System.EventArgs e) { DbQueryResult distributorBalanceDetailsNoPage = DistributorHelper.GetDistributorBalanceDetailsNoPage(new BalanceDetailQuery { UserName = this.userName, FromDate = this.dateStart, ToDate = this.dateEnd, SortBy = "TradeDate", SortOrder = SortAction.Desc, TradeType = TradeTypes.DrawRequest }); string text = string.Empty; text += "用户名"; text += ",交易时间"; text += ",业务摘要"; text += ",转出金额"; text += ",当前余额\r\n"; foreach (System.Data.DataRow dataRow in ((System.Data.DataTable)distributorBalanceDetailsNoPage.Data).Rows) { text += dataRow["UserName"]; text = text + "," + dataRow["TradeDate"]; text += ",提现"; text = text + "," + dataRow["Expenses"]; object obj = text; text = string.Concat(new object[] { obj, ",", dataRow["Balance"], "\r\n" }); } this.Page.Response.Clear(); this.Page.Response.Buffer = false; this.Page.Response.Charset = "GB2312"; this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributionBalanceDetailsStatistics.csv"); this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); this.Page.Response.ContentType = "application/octet-stream"; this.Page.EnableViewState = false; this.Page.Response.Write(text); this.Page.Response.End(); }
private void btnCreateReport_Click(object sender, System.EventArgs e) { DbQueryResult distributorBalanceDetailsNoPage = DistributorHelper.GetDistributorBalanceDetailsNoPage(new BalanceDetailQuery { FromDate = this.dateStart, ToDate = this.dateEnd, SortBy = "TradeDate", SortOrder = SortAction.Desc, UserName = this.userName }); string text = string.Empty; text += "用户名"; text += ",交易时间"; text += ",业务摘要"; text += ",转入金额"; text += ",转出金额"; text += ",当前余额\r\n"; foreach (System.Data.DataRow dataRow in ((System.Data.DataTable)distributorBalanceDetailsNoPage.Data).Rows) { string str = string.Empty; switch (System.Convert.ToInt32(dataRow["TradeType"])) { case 1: str = "自助充值"; break; case 2: str = "后台加款"; break; case 3: str = "消费"; break; case 4: str = "提现"; break; case 5: str = "订单退款"; break; default: str = "其他"; break; } text += dataRow["UserName"]; text = text + "," + dataRow["TradeDate"]; text = text + "," + str; text = text + "," + dataRow["Income"]; text = text + "," + dataRow["Expenses"]; object obj = text; text = string.Concat(new object[] { obj, ",", dataRow["Balance"], "\r\n" }); } this.Page.Response.Clear(); this.Page.Response.Buffer = false; this.Page.Response.Charset = "GB2312"; this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributionBalanceDetailsStatistics.csv"); this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); this.Page.Response.ContentType = "application/octet-stream"; this.Page.EnableViewState = false; this.Page.Response.Write(text); this.Page.Response.End(); }