Example #1
0
    private void InitExcelData()
    {
        try
        {
            DataSet   ds;
            DataTable dt = new DataTable();

            string startime = Request.Form["startime"]; // this.startime.Text;
            string endtime  = Request.Form["endtime"];  //this.endtime.Text;
            string str      = "";
            if (startime != "" || endtime != "")
            {
                str = "updateTime between '" + startime + "' and '" + endtime + "'  order by id desc";
            }
            else
            {
                str = "";
            }

            ds = bllorder.GetList(str);
            dt = ds.Tables[0];
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    excel.RowStart();
                    excel.CellWithoutFormula("String", dt.Rows[i]["order_num"].ToString());
                    excel.CellWithoutFormula("String", getUserName(Convert.ToInt32(dt.Rows[i]["user_id"].ToString())));
                    excel.CellWithoutFormula("String", dt.Rows[i]["quantity_sum"].ToString());
                    excel.CellWithoutFormula("String", Convert.ToDecimal(dt.Rows[i]["price_sum"]).ToString("0.00"));
                    excel.CellWithoutFormula("String", dt.Rows[i]["integral_sum"].ToString());
                    excel.CellWithoutFormula("String", getOrderStaute(dt.Rows[i]["order_status"].ToString()));
                    excel.CellWithoutFormula("String", dt.Rows[i]["note"].ToString());
                    excel.CellWithoutFormula("String", dt.Rows[i]["updateTime"].ToString());
                    excel.RowEnd();
                    excelRows++;
                }
                excel.CreateExcelWithMode(excelRows, excelColumns, DateTime.Now.ToShortDateString() + "-DBE积分兑换订单报表");
            }
            else
            {
                JscriptMsg("没有符合的数据信息!", "orderlist.aspx", "Error");
            }
        }
        catch
        {
        }
    }