Beispiel #1
0
        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.ddlProperty.SelectedValue = this.property;
            this.txtKeywords.Text          = this.keywords;
            if (this.brand_id > 0)
            {
                this.ddlBrandId.SelectedValue = this.brand_id.ToString();
            }
            if (sort > 0)
            {
                this.ddlSort.SelectedValue = this.sort.ToString();

                if (sort == 1)
                {
                    _orderby = "begin_time";
                }
                if (sort == 2)
                {
                    _orderby = "add_time";
                }
                if (sort == 3)
                {
                    _orderby = "id";
                }
            }
            //圖表或清單顯示

            Tea.Web.UI.ShopPage bll = new UI.ShopPage();

            switch (this.prolistview)
            {
            case "Txt":
                this.rptList2.Visible    = false;
                this.rptList1.DataSource = bll.GetViewList("view_article_product", "", this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
                this.rptList1.DataBind();
                break;

            default:
                this.rptList1.Visible    = false;
                this.rptList2.DataSource = bll.GetViewList("view_article_product", "", this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
                this.rptList2.DataBind();
                break;
            }
            //綁定頁碼
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("tuan_list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&brand_id={4}&page={5}&status={6}", _channel_id.ToString(), _category_id.ToString(), this.keywords, this.property, this.brand_id.ToString(), "__id__", status.ToString());

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #2
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = TWRequest.GetQueryInt("page", 1);
            if (this.status > 0)
            {
                this.ddlStatus.SelectedValue = this.status.ToString();
            }
            if (this.payment_status > 0)
            {
                this.ddlPaymentStatus.SelectedValue = this.payment_status.ToString();
            }
            if (this.express_status > 0)
            {
                this.ddlExpressStatus.SelectedValue = this.express_status.ToString();
            }
            txtKeywords.Text      = this.keywords;
            txtdate.SelectedValue = data;
            txtbegin.Text         = begin;
            txtend.Text           = end;
            Tea.Web.UI.ShopPage bll = new UI.ShopPage();

            this.rptList.DataSource = bll.GetViewList("shop_orders", "", this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //綁定頁碼
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("order_list.aspx", "status={0}&payment_status={1}&express_status={2}&keywords={3}&page={4}&cid={5}&data={6}&begin={7}&end={8}", this.status.ToString(), this.payment_status.ToString(), this.express_status.ToString(), this.keywords, "__id__", cid.ToString(), data, begin, end);

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #3
0
        private void RptBind(int _channel_id, int _category_id, string _strWhere, string _orderby)
        {
            string _sql = "";

            this.page = TWRequest.GetQueryInt("page", 1);
            if (this.category_id > 0)
            {
                this.ddlCategoryId.SelectedValue = _category_id.ToString();
                _sql = _sql + " and category_id in(select id from shop_article_category where class_list like '%," + _category_id + ",%')";
            }
            this.txtKeywords.Text = this.keywords;
            //圖表或列表顯示
            UI.ShopPage bll_view = new UI.ShopPage();
            this.rptList1.DataSource = bll_view.GetViewList("view_goods", "", this.pageSize, this.page, _strWhere + _sql, _orderby, out this.totalCount);
            this.rptList1.DataBind();
            //綁定頁碼
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("dialog_time.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}&goods_ids={5}", _channel_id.ToString(), _category_id.ToString(), this.keywords, this.property, "__id__", this.goods_ids);

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #4
0
        //匯出CSV
        protected void btnExportTwo_Click(object sender, EventArgs e)
        {
            string fileName = "訂單資料" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xls";

            Tea.Web.UI.ShopPage bll = new UI.ShopPage();

            string strurl = "0";

            for (int ai = 0; ai < rptList.Items.Count; ai++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[ai].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[ai].FindControl("chkId");
                if (cb.Checked)
                {
                    strurl = strurl + "," + id.ToString();;
                }
            }


            DataTable dt = new DataTable();

            if (strurl.Length > 1)
            {
                dt = bll.GetViewList("shop_orders", "", 0, "id in(" + strurl + ")" + CombSqlTxt(this.status, this.payment_status, this.express_status, this.keywords, data, begin, end), "add_time desc,id desc").Tables[0];
            }
            else
            {
                dt = bll.GetViewList("shop_orders", "", 0, "id>0" + CombSqlTxt(this.status, this.payment_status, this.express_status, this.keywords, data, begin, end), "add_time desc,id desc").Tables[0];
            }

            //
            string[] titleCol = new string[] { "order", "訂單編號", "會員編號", "訂單金額", "購買時間", "收貨人", "收貨地", "產品代號", "產品名稱", "數量", "單價", "小計", "產品類別" };

            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 d_r in dt.Rows)
            {
                DataSet ddss   = Tea.DBUtility.DbHelperSQL.Query("select * from view_order_goods where id=" + d_r["id"].ToString() + "");
                DataSet ddssds = Tea.DBUtility.DbHelperSQL.Query("select * from view_order_gift where order_id=" + d_r["id"].ToString() + "");


                foreach (DataRow dr in ddss.Tables[0].Rows)
                {
                    sb.Append("<tr>");
                    for (i = 0; i < titleCol.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            sb.Append("<td>" + getno(a.ToString()) + "</td>");
                            break;

                        case 1:
                            sb.Append("<td>" + dr["order_no"].ToString() + "</td>");
                            break;

                        case 2:
                            sb.Append("<td>" + dr["user_name"].ToString() + "</td>");
                            break;

                        case 3:
                            sb.Append("<td>" + (Utils.StrToInt(dr["order_amount"].ToString(), 0) - Utils.StrToInt(dr["express_fee"].ToString(), 0)).ToString() + "</td>");
                            break;

                        case 4:
                            sb.Append("<td>" + dr["add_time"].ToString() + "</td>");
                            break;

                        case 5:
                            sb.Append("<td>" + getuseradd(dr["user_add"].ToString(), 0) + "</td>");
                            break;

                        case 6:
                            sb.Append("<td>" + getuseradd(dr["user_add"].ToString(), 9) + getuseradd(dr["user_add"].ToString(), 5) + getuseradd(dr["user_add"].ToString(), 6) + getuseradd(dr["user_add"].ToString(), 7) + getuseradd(dr["user_add"].ToString(), 8) + "</td>");
                            break;

                        case 7:
                            sb.Append("<td>" + dr["goods_no"].ToString() + "</td>");
                            break;

                        case 8:
                            sb.Append("<td>" + dr["goods_title"].ToString() + "</td>");
                            break;

                        case 9:
                            sb.Append("<td>" + dr["quantity"].ToString() + "</td>");
                            break;

                        case 10:
                            sb.Append("<td>" + dr["real_price"].ToString() + "</td>");
                            break;

                        case 11:
                            sb.Append("<td>" + Utils.StrToInt(dr["quantity"].ToString(), 0) * Utils.StrToInt(dr["real_price"].ToString(), 0) + "</td>");
                            break;

                        case 12:
                            sb.Append("<td>" + gettype(Utils.StrToInt(dr["article_id"].ToString(), 0)) + "</td>");
                            break;
                        }
                    }
                    sb.Append("</tr>");
                    a = a + 1;
                }
                foreach (DataRow dr in ddssds.Tables[0].Rows)
                {
                    sb.Append("<tr>");
                    for (i = 0; i < titleCol.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                            sb.Append("<td>" + getno(a.ToString()) + "</td>");
                            break;

                        case 1:
                            sb.Append("<td>" + d_r["order_no"].ToString() + "</td>");
                            break;

                        case 2:
                            sb.Append("<td>" + d_r["user_name"].ToString() + "</td>");
                            break;

                        case 3:
                            sb.Append("<td>" + (Utils.StrToInt(d_r["order_amount"].ToString(), 0) - Utils.StrToInt(d_r["express_fee"].ToString(), 0)).ToString() + "</td>");
                            break;

                        case 4:
                            sb.Append("<td>" + d_r["add_time"].ToString() + "</td>");
                            break;

                        case 5:
                            sb.Append("<td>" + getuseradd(d_r["user_add"].ToString(), 0) + "</td>");
                            break;

                        case 6:
                            sb.Append("<td>" + getuseradd(d_r["user_add"].ToString(), 9) + getuseradd(d_r["user_add"].ToString(), 5) + getuseradd(d_r["user_add"].ToString(), 6) + getuseradd(d_r["user_add"].ToString(), 7) + getuseradd(d_r["user_add"].ToString(), 8) + "</td>");
                            break;

                        case 7:
                            sb.Append("<td>" + dr["gift_code"].ToString() + "</td>");
                            break;

                        case 8:
                            sb.Append("<td>" + dr["title"].ToString() + "</td>");
                            break;

                        case 9:
                            sb.Append("<td>" + dr["ocompany"].ToString() + "</td>");
                            break;

                        case 10:
                            sb.Append("<td>0</td>");
                            break;

                        case 11:
                            sb.Append("<td>0</td>");
                            break;

                        case 12:
                            sb.Append("<td></td>");
                            break;
                        }
                    }
                    sb.Append("</tr>");
                    a = a + 1;
                }
            }
            sb.Append("</tbody></table>");
            Response.Write(sb.ToString());
            Response.End();
        }
Beispiel #5
0
        //匯出CSV

        protected void btnExport_Click(object sender, EventArgs e)
        {
            string fileName = "訂單資料" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xls";

            Tea.Web.UI.ShopPage bll = new UI.ShopPage();

            string strurl = "0";

            for (int ai = 0; ai < rptList.Items.Count; ai++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[ai].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[ai].FindControl("chkId");
                if (cb.Checked)
                {
                    strurl = strurl + "," + id.ToString();;
                }
            }


            DataTable dt = new DataTable();

            if (strurl.Length > 1)
            {
                dt = bll.GetViewList("shop_orders", "", 0, "id in(" + strurl + ")" + CombSqlTxt(this.status, this.payment_status, this.express_status, this.keywords, data, begin, end), "add_time desc,id desc").Tables[0];
            }
            else
            {
                dt = bll.GetViewList("shop_orders", "", 0, "id>0" + CombSqlTxt(this.status, this.payment_status, this.express_status, this.keywords, data, begin, end), "add_time desc,id desc").Tables[0];
            }



            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();

            //向HTTP输出流中写入取得的数据信息
            //逐行处理数据
            int a = 1;

            foreach (DataRow dr in dt.Rows)
            {
                sb.Append("<table borderColor='black' border='1' >");

                sb.Append("<tbody>");
                sb.Append("<tr>");
                sb.Append("<td>");
                sb.Append("<table borderColor='black' border='1' >");
                string  strtable = "";
                DataSet ddss     = Tea.DBUtility.DbHelperSQL.Query("select * from shop_order_goods where order_id=" + dr["id"].ToString() + "");
                DataSet ddssds   = Tea.DBUtility.DbHelperSQL.Query("select * from view_order_gift where order_id=" + dr["id"].ToString() + "");
                if (ddss.Tables[0].Rows.Count > 0)
                {
                    strtable = strtable + "<table borderColor='black' border='1' >";
                    strtable = strtable + "<tr><td>序號</td><td>商品編號</td><td>商品名稱</td><td>數量</td><td>金額</td><td>備註</td></tr>";
                    int ab = 1;
                    foreach (DataRow ddrr in ddss.Tables[0].Rows)
                    {
                        strtable = strtable + "<tr><td>" + ab + "</td><td>" + ddrr["goods_no"].ToString() + "</td><td>" + ddrr["goods_title"].ToString() + "</td><td>" + ddrr["quantity"].ToString() + "</td><td>" + ddrr["real_price"].ToString().Replace(".00", "") + "</td><td></td></tr>";
                        ab       = ab + 1;
                    }
                    foreach (DataRow ddrr in ddssds.Tables[0].Rows)
                    {
                        strtable = strtable + "<tr><td>" + ab + "</td><td>" + ddrr["gift_code"].ToString() + "</td><td>" + ddrr["title"].ToString() + "</td><td>" + ddrr["ocompany"].ToString() + "</td><td>0</td><td></td></tr>";
                        ab       = ab + 1;
                    }
                    strtable = strtable + "<tr><td>--</td><td>DPT-8990</td><td>運費</td><td></td><td>" + dr["express_fee"].ToString().Replace(".00", "") + "</td><td></td></tr>";
                    strtable = strtable + "<tr><td>--</td><td>總計</td><td></td><td></td><td>" + dr["order_amount"].ToString().Replace(".00", "") + "</td><td></td></tr>";
                    strtable = strtable + "<tr><td>--</td><td>" + dr["zhe_else"].ToString() + "</td><td></td><td></td><td>" + dr["zhe"].ToString().Replace(".00", "") + "</td><td></td></tr>";
                    strtable = strtable + "<tr><td>--</td><td>優惠券</td><td></td><td></td><td>" + dr["payment_fee"].ToString().Replace(".00", "") + "</td><td></td></tr>";
                    strtable = strtable + "<tr><td>--</td><td>紅利</td><td></td><td></td><td>" + dr["tuid"].ToString().Replace(".00", "") + "</td><td></td></tr>";
                    strtable = strtable + "</table>";
                }
                sb.Append("<tr>");
                sb.Append("<td>訂單編號:</td>");
                sb.Append("<td>" + dr["order_no"].ToString() + "</td>");
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td>購買商品清單:</td>");
                sb.Append("<td>" + strtable + "</td>");
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td>備註事項:</td>");
                sb.Append("<td>" + dr["message"].ToString() + "</td>");
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td>購買人:</td>");
                sb.Append("<td>寄送發票:" + getinvoice(dr["is_invoice"].ToString()) + "<br>發票資料:" + dr["invoice_title"].ToString().Replace("|", ",").Replace(",", " ") + "</td>");
                sb.Append("</tr>");
                sb.Append("<tr>");
                sb.Append("<td>收貨人:</td>");
                sb.Append("<td>姓名:" + getuseradd(dr["user_add"].ToString(), 0) + "<br>聯絡電話:" + getuseradd(dr["user_add"].ToString(), 2) + "<br>郵遞區號:" + getuseradd(dr["user_add"].ToString(), 9) + "<br>地址:" + getuseradd(dr["user_add"].ToString(), 5) + getuseradd(dr["user_add"].ToString(), 6) + getuseradd(dr["user_add"].ToString(), 7) + getuseradd(dr["user_add"].ToString(), 8) + "</td>");
                sb.Append("</tr>");
                sb.Append("</tbody></table>");
                sb.Append("</td>");
                sb.Append("</tr>");

                sb.Append("</tbody></table>");
                sb.Append("<br>");

                sb.Append("<br>");
            }


            Response.Write(sb.ToString());
            Response.End();
        }