Exemplo n.º 1
0
 private void GridViewBind()
 {
     if (!base.IsPostBack)
     {
         if (this.ShowOptions != 0)
         {
             this.EgvBankroll.Columns[0].Visible    = false;
             this.EgvBankroll.Columns[8].Visible    = false;
             this.EgvBankroll.Columns[1].HeaderText = "付款人";
             this.EgvInvoice.Columns[6].Visible     = false;
             this.EgvInvoice.Columns[7].HeaderText  = "开票时间";
             this.EgvDeliverItem.Columns[8].Visible = true;
         }
         if (this.OrderId != "0")
         {
             this.EgvBankroll.DataSource    = BankrollItem.GetList(0, 0, 10, 5, this.OrderId);
             this.EgvInvoice.DataSource     = Invoice.GetList(0, 0, 5, this.OrderId, 0);
             this.EgvDeliverItem.DataSource = DeliverItem.GetList(0, 0, 8, this.OrderId, 0);
             this.EgvTransferLog.DataSource = TransferLog.GetList(0, 0, "10", "OrderID", this.OrderId);
             this.EgvBankroll.DataBind();
             this.EgvInvoice.DataBind();
             this.EgvDeliverItem.DataBind();
             this.EgvTransferLog.DataBind();
             if (string.IsNullOrEmpty(this.ClientName))
             {
                 this.EgvService.DataSource  = null;
                 this.EgvComplain.DataSource = null;
             }
             else
             {
                 this.EgvService.DataSource  = Service.GetListByClientName(0, 0x7fffffff, this.ClientName);
                 this.EgvComplain.DataSource = Complain.GetListByClientName(0, 0x7fffffff, this.ClientName);
             }
             this.EgvService.DataBind();
             this.EgvComplain.DataBind();
             this.FeedbackDataBind();
             this.GdvPaymentLogList.DataSource = PaymentLog.GetListByOrderId(DataConverter.CLng(this.OrderId));
             this.GdvPaymentLogList.DataBind();
         }
     }
 }
        protected void BtnExportExcel_Click(object sender, EventArgs e)
        {
            IList <BankrollItemInfo> list    = BankrollItem.GetList(0, 0x7fffffff, 11, 0, this.GetKeywords());
            StringBuilder            builder = new StringBuilder();

            base.Response.Clear();
            base.Response.AppendHeader("content-disposition", "attachment;filename=BankrollItemList.xls");
            base.Response.ContentEncoding = Encoding.GetEncoding("GB2312");
            base.Response.ContentType     = "application/vnd.xls";
            builder.Append("<table border='1' cellspacing='1' style='border-collapse: collapse;table-layout:fixed' id='AutoNumber1' height='32'><tr>");
            builder.Append("<td align='center'><b>交易时间</b></td>");
            builder.Append("<td align='center'><b>客户名称</b></td>");
            builder.Append("<td align='center'><b>用户名</b></td>");
            builder.Append("<td align='center'><b>交易方式</b></td>");
            builder.Append("<td align='center'><b>币种</b></td>");
            builder.Append("<td align='center'><b>收入金额</b></td>");
            builder.Append("<td align='center'><b>支出金额</b></td>");
            builder.Append("<td align='center'><b>摘要</b></td>");
            builder.Append("<td align='center'><b>银行名称</b></td>");
            builder.Append("<td align='center'><b>备注/说明</b></td></tr>");
            foreach (BankrollItemInfo info in list)
            {
                builder.Append("<tr>");
                builder.Append("<td align='center'>" + info.DateAndTime.ToString() + "</td>");
                builder.Append("<td align='center'>" + DataSecurity.HtmlEncode(info.ClientName) + "</td>");
                builder.Append("<td align='center'>" + DataSecurity.HtmlEncode(info.UserName) + "</td>");
                builder.Append("<td align='center'>" + this.GetMoneyType(info.MoneyType) + "</td>");
                builder.Append("<td align='center'>" + this.GetCurrencyType(info.CurrencyType) + "</td>");
                builder.Append("<td align='center'>" + ((info.Money > 0M) ? info.Money.ToString() : "") + "</td>");
                builder.Append("<td align='center'>" + ((info.Money < 0M) ? Math.Abs(info.Money).ToString() : "") + "</td>");
                builder.Append("<td align='center'>" + ((info.Money > 0M) ? "收入" : "支出") + "</td>");
                builder.Append("<td align='center'>" + ((info.MoneyType == 3) ? DataSecurity.HtmlEncode(PayPlatform.GetPayPlatformById(info.EBankId).PayPlatformName) : DataSecurity.HtmlEncode(info.Bank)) + "</td>");
                builder.Append("<td align='center'>" + DataSecurity.HtmlEncode(info.Remark) + "</td>");
                builder.Append("</tr>");
            }
            base.Response.Write(builder.ToString());
            base.Response.End();
        }