private void RptBind(string _strWhere, string _orderby)
    {
        this.page = AXRequest.GetQueryInt("page", 1);

        if (this.depot_category_id > 0)
        {
            this.ddldepot_category_id.SelectedValue = this.depot_category_id.ToString();
        }
        if (this.depot_id > 0)
        {
            this.ddldepot_id.SelectedValue = this.depot_id.ToString();
        }

        txtNote_no.Text = this.note_no;

        ps_orders bll = new ps_orders();

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

        //绑定页码
        txtPageNum.Text = this.pageSize.ToString();
        string pageUrl = Utils.CombUrlTxt("order_list.aspx", "depot_category_id={0}&depot_id={1}&status={2}&note_no={3}&page={4}", this.depot_category_id.ToString(), this.depot_id.ToString(), this.status.ToString(), txtNote_no.Text, "__id__");

        PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
    protected string CombSqlTxt(int _product_category_id, string _note_no)
    {
        StringBuilder strTemp = new StringBuilder();

        ps_orders bll = new ps_orders();
        DataTable dt  = bll.GetList("status=2").Tables[0];

        strTemp.Append(" and (1=2");
        foreach (DataRow dr in dt.Rows)
        {
            strTemp.Append(" or order_id=" + dr["id"].ToString());
        }
        strTemp.Append(")");

        if (_product_category_id > 0)
        {
            strTemp.Append(" and product_category_id=" + _product_category_id);
            Literal6.Text = new ps_product_category().GetTitle(_product_category_id);
        }
        else
        {
            Literal6.Text = "(所有)";
        }

        _note_no = _note_no.Replace("'", "");
        if (!string.IsNullOrEmpty(_note_no))
        {
            strTemp.Append(" and goods_title like  '%" + _note_no + "%' ");
        }
        return(strTemp.ToString());
    }
    private void RptBind(string _strWhere, string _orderby)
    {
        this.page = AXRequest.GetQueryInt("page", 1);

        if (this.status > 0)
        {
            this.ddlStatus.SelectedValue = this.status.ToString();
        }
        txtNote_no.Text     = this.note_no;
        txtstart_time.Value = this.start_time;
        txtstop_time.Value  = this.stop_time;

        ps_orders bll = new ps_orders();

        this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
        this.rptList.DataBind();
        this.Literal_pa.Text = MyConvert(bll.GetTitleSum(_strWhere + " and  status<>4", "sum(payable_amount)"));
        this.Literal_ra.Text = MyConvert(bll.GetTitleSum(_strWhere + " and  status<>4", "sum(real_amount)"));
        this.Literal_oa.Text = MyConvert(bll.GetTitleSum(_strWhere + " and  status<>4", "sum(order_amount)"));
        //绑定页码
        txtPageNum.Text = this.pageSize.ToString();
        string pageUrl = Utils.CombUrlTxt("my_order.aspx", "depot_category_id={0}&depot_id={1}&status={2}&start_time={3}&stop_time={4}&note_no={5}&page={6}", this.depot_category_id.ToString(), this.depot_id.ToString(), this.status.ToString(), this.txtstart_time.Value, this.txtstop_time.Value, txtNote_no.Text, "__id__");

        PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
    //绑定记录
    public void binddr()
    {
        ps_orders bll = new ps_orders();

        string sqlstr = "id>0 ";

        sqlstr = sqlstr + CombSqlTxt(this.depot_category_id, this.depot_id, this.status, this.note_no, this.start_time, this.stop_time);
        sqlstr = sqlstr + " order by add_time desc,id desc";
        DataView dv = bll.GetList(sqlstr).Tables[0].DefaultView;

        repCategory.DataSource = dv;
        repCategory.DataBind();
    }
    // 取消订单
    protected void lbtnDelCa_Click(object sender, EventArgs e)
    {
        this.page = AXRequest.GetQueryInt("page", 1);
        // 当前点击的按钮
        LinkButton lb   = (LinkButton)sender;
        int        caId = int.Parse(lb.CommandArgument);
        ps_orders  bll  = new ps_orders();

        bll.Delete(caId);
        ps_order_goods bllg = new ps_order_goods();

        bllg.DeleteOid(caId);

        mym.JscriptMsg(this.Page, " 取消订单成功!", Utils.CombUrlTxt("my_order.aspx", "depot_category_id={0}&depot_id={1}&status={2}&start_time={3}&stop_time={4}&note_no={5}&page={6}", this.depot_category_id.ToString(), this.depot_id.ToString(), this.status.ToString(), this.txtstart_time.Value, this.txtstop_time.Value, txtNote_no.Text, this.page.ToString()), "Success");
    }
    //绑定记录
    public void binddr()
    {
        ps_orders bll = new ps_orders();

        string sqlstr = "id>0 ";

        sqlstr = sqlstr + CombSqlTxt(this.depot_category_id, this.depot_id, this.status, this.note_no, this.start_time, this.stop_time);
        sqlstr = sqlstr + " order by add_time desc,id desc";
        DataView dv = bll.GetList(sqlstr).Tables[0].DefaultView;

        repCategory.DataSource = dv;
        repCategory.DataBind();

        this.Literal_pa.Text = MyConvert(bll.GetTitleSum(" status<>4" + CombSqlTxt(this.depot_category_id, this.depot_id, this.status, this.note_no, this.start_time, this.stop_time), "sum(payable_amount)"));
        this.Literal_ra.Text = MyConvert(bll.GetTitleSum(" status<>4" + CombSqlTxt(this.depot_category_id, this.depot_id, this.status, this.note_no, this.start_time, this.stop_time), "sum(real_amount)"));
        this.Literal_oa.Text = MyConvert(bll.GetTitleSum(" status<>4" + CombSqlTxt(this.depot_category_id, this.depot_id, this.status, this.note_no, this.start_time, this.stop_time), "sum(order_amount)"));
    }
Exemple #7
0
    //提交订单
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int    user_id           = 0;
        int    depot_category_id = 0;
        int    depot_id          = 0;
        string user_name         = string.Empty;

        user_id           = Convert.ToInt32(Session["AID"]);
        depot_category_id = Convert.ToInt32(Session["DepotCatID"]);
        depot_id          = Convert.ToInt32(Session["DepotID"]);
        user_name         = Session["AdminName"].ToString();

        //检查购物车商品
        IList <cart_items> iList = ShopCart.GetList();

        if (iList == null)
        {
            mym.JscriptMsg(this.Page, "对不起,购物车为空,无法结算!", "", "Error");
            return;
        }

        //统计购物车
        cart_total cartModel = ShopCart.GetTotal();

        //判断是否有商品
        if (cartModel.payable_amount == 0)
        {
            mym.JscriptMsg(this.Page, "对不起,购物车为空,无法结算!", "", "Error");
            return;
        }

        //保存订单=======================================================================
        ps_orders model = new ps_orders();

        model.order_no          = Utils.GetOrderNumber(); //订单号B开头为商品订单
        model.user_id           = user_id;
        model.depot_category_id = depot_category_id;
        model.depot_id          = depot_id;
        model.user_name         = user_name;
        model.payment_id        = 1;//未支付
        model.message           = message.Text;
        model.payable_amount    = cartModel.payable_amount;
        model.real_amount       = 0;

        //订单总金额=实付商品金额
        model.order_amount = cartModel.payable_amount;
        model.add_time     = DateTime.Now;


        if (model.Add() == 0)
        {
            mym.JscriptMsg(this.Page, "订单保存过程中发生错误,请重新提交!", "", "Error");
            return;
        }
        //商品详细列表
        ps_order_goods gls = new ps_order_goods();
        ps_here_depot  my  = new ps_here_depot();

        foreach (cart_items item in iList)
        {
            my.GetModel(item.id);
            gls.order_id            = model.GetMaxId();
            gls.goods_id            = item.id;
            gls.goods_title         = item.title;
            gls.goods_price         = my.go_price;
            gls.real_price          = item.price;
            gls.quantity            = item.quantity;
            gls.product_category_id = item.product_category_id;
            gls.dw = item.dw;
            gls.Add();
        }
        //清空购物车
        ShopCart.Clear("0");
        //提交成功,返回URL
        mym.JscriptMsg(this.Page, "恭喜您,订单已成功提交!", "my_order.aspx", "Success");
        return;
    }