Exemple #1
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void DataBindGrid()
        {
            DepositReturnManager depositManager = new DepositReturnManager();
            int count = 0;
            KeyValuePair <StringBuilder, IList <SqlParam> > keyValue = InitCondition();
            DataTable dt = depositManager.GetPage(keyValue.Key, keyValue.Value, PageControl1.PageIndex, PageControl1.PageSize, ref count);

            ControlBindHelper.BindRepeaterList(dt, rp_Item);
            this.PageControl1.RecordCount = Convert.ToInt32(count);
            this.PageControl1.PageChecking();
        }
Exemple #2
0
        protected void lbtExport_Click(object sender, EventArgs e)
        {
            DepositReturnManager depositManager = new DepositReturnManager();
            int count = 0;
            KeyValuePair <StringBuilder, IList <SqlParam> > keyValue = InitCondition();
            DataTable dt = depositManager.GetPage(keyValue.Key, keyValue.Value, PageControl1.PageIndex, 1000000000, ref count);

            StringBuilder s = new StringBuilder();

            s.AppendLine("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
            s.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">");

            //写出列名
            s.AppendLine("<tr style=\"background-color: #FFE88C;font-weight: bold; white-space: nowrap;\">");
            s.AppendLine("<td>用户姓名/td><td>手机号</td><td>押金金额</td><td>押金支付方式</td><td>押金支付交易号</td><td>申请状态</td><td>创建时间</td>");
            s.AppendLine("</tr>");

            //写数据
            foreach (DataRow row in dt.Rows)
            {
                s.Append("<tr>");
                s.Append("<td>").Append(row["RealName"].ToString()).Append("</td>");
                s.Append("<td>").Append(row["BindPhone"].ToString()).Append("</td>");
                s.Append("<td>").Append(row["DepositMoney"].ToString()).Append("</td>");
                s.Append("<td>").Append(EnumHelper.GetEnumShowName(typeof(UserFinancialOperatorWay), Convert.ToInt32(row["DepositPayWay"].ToString()))).Append("</td>");
                s.Append("<td>'").Append(row["DepositTradeNo"].ToString()).Append("</td>");
                s.Append("<td>").Append(GetStateTxt(row["State"].ToString())).Append("</td>");
                s.Append("<td>").Append(row["CreateTime"].ToString()).Append("</td>");
                s.AppendLine("</tr>");
            }
            s.AppendLine("</table>");
            this.Page.Response.ContentType     = "application/vnd.ms-excel";
            this.Page.Response.ContentEncoding = System.Text.Encoding.UTF8;
            this.Page.Response.Charset         = "Utf-8";
            this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=押金退款列表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
            this.Page.Response.Write(s.ToString());
            this.Page.Response.End();
        }