Esempio n. 1
0
    /// <summary>
    /// 代理商选择商品
    /// </summary>
    /// <returns></returns>
    public string disBing(string compid, string disid)
    {
        StringBuilder strwhere = new StringBuilder();

        //商品是否启用库存
        IsInve = OrderInfoType.rdoOrderAudit("商品是否启用库存", compid.ToInt(0)).ToInt(0);
        if (IsInve == 0)
        {
            strwhere.AppendFormat("and info.Inventory>0");
        }
        DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, SelectGoodsInfo.Returnsql(compid, disid, strwhere.ToString(), "2")).Tables[0];

        List <int> infoidl = new List <int>();

        if (dt != null && dt.Rows.Count > 0)
        {
            foreach (DataRow item in dt.Rows)
            {
                int id = item["ID"].ToString().ToInt(0);//BD_goodsInfo表的ID
                infoidl.Add(id);
            }
        }

        //获取商品价格
        List <BLL.gDprice> l = BLL.Common.GetPrice(Convert.ToInt32(compid), Convert.ToInt32(disid), infoidl);

        if (l != null && l.Count > 0)
        {
            foreach (var item in l)
            {
                DataRow[] dr = dt.Select(" ID=" + item.goodsInfoId);
                if (dr.Length > 0)
                {
                    //获取的价格大于促销价时、取促销价
                    dr[0]["pr"] = item.FinalPrice;
                    dr[0]["typeTinkerPrice"] = item.typePrice;
                    dr[0]["disTinkerPrice"]  = item.disPrice;
                    dr[0]["disProPr"]        = item.bpPrice;
                }
            }
        }


        return(ConvertJson.ToJson2(dt));
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.hidType2.Value = Request.QueryString["type"] + "";
            this.hidDisID.Value = this.DisID.ToString();
            this.hidKeyId.Value = KeyID.ToString();

            StringBuilder strwhere = new StringBuilder();
            Fanli = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", CompID).ToInt(0);
            this.hidFanl.Value = Fanli.ToString();
            LoginModel logUser = Session["UserModel"] as LoginModel;
            Common.ListComps(this.ddrComp, this.UserID.ToString(), this.CompID.ToString());
            this.hidCompId.Value = this.ddrComp.Value.ToString();

            decimal CreditAmount = 0;
            if (BLL.Common.GetCredit(this.hidCompId.Value.ToString().ToInt(0), logUser.DisID, out CreditAmount))
            {
                decimal GetSumAmount = OrderInfoType.GetSumAmount(logUser.DisID.ToString(), this.hidCompId.Value.ToString(), KeyID);
                if (GetSumAmount >= CreditAmount)
                {
                    this.Msg.InnerHtml = "您的授信额度(" + CreditAmount + ")已用完或超出!无法下单";
                    this.Btn.InnerHtml = "<a href=\"javascript:; \" class=\"gray-btn2\">取消</a>";
                }
                else
                {
                    this.Msg.InnerHtml = "";
                }
            }
            else
            {
                this.Msg.InnerHtml = "";
            }
            // isbate = OrderInfoType.rdoOrderAudit("订单支付返利是否启用", CompID).ToInt(0);
            //if (Fanli == 0)
            //{
            //    this.trbate.Visible = false;
            //    this.rebate.Visible = false;
            //}
            //商品是否启用库存
            IsInve = OrderInfoType.rdoOrderAudit("商品是否启用库存", this.CompID).ToInt(0);
            if (IsInve == 0)
            {
                strwhere.AppendFormat("and info.Inventory>0");
            }
            DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, SelectGoodsInfo.Returnsql(CompID.ToString(), DisID.ToString(), strwhere.ToString(), "1")).Tables[0];

            List <int> infoidl = new List <int>();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow item in dt.Rows)
                {
                    int id = item["ID"].ToString().ToInt(0);//BD_goodsInfo表的ID
                    infoidl.Add(id);
                }
            }

            //获取商品价格
            List <BLL.gDprice> l = BLL.Common.GetPrice(CompID, DisID, infoidl);

            if (l != null && l.Count > 0)
            {
                foreach (var item in l)
                {
                    DataRow[] dr = dt.Select(" ID=" + item.goodsInfoId);
                    if (dr.Length > 0)
                    {
                        //获取的价格大于促销价时、取促销价
                        dr[0]["pr"] = item.FinalPrice;
                        dr[0]["typeTinkerPrice"] = item.typePrice;
                        dr[0]["disTinkerPrice"]  = item.disPrice;
                        dr[0]["disProPr"]        = item.bpPrice;
                    }
                }
            }
            this.divGoodsName.InnerText = ConvertJson.ToJson2(dt);
            //代理商列表
            List <Hi.Model.BD_Distributor> list = new Hi.BLL.BD_Distributor().GetList("ID,DisName", "isnull(dr,0)=0 and compid=" + this.CompID, "");
            this.divDisList.InnerText = ConvertJson.ToJson(Common.FillDataTable(list));
            if (KeyID != 0)
            {
                if (Request.QueryString["type"] + "" != "2")
                {
                    Hi.Model.DIS_Order model = new Hi.BLL.DIS_Order().GetModel(KeyID);
                    //判断订单是否可以修改  企业下单订单已审未支付,代理商下单企业不能修改
                    if (model.OState > (int)Enums.OrderState.待审核)
                    {
                        JScript.AlertAndRedirect("订单已被其他人修改,请刷新后再重新操作!", "orderdetail.aspx?top=1&KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey));
                        return;
                    }
                }
                else
                {
                    this.hidType.Value = Request.QueryString["type"] + "";
                }
                Bind();
            }
            else
            {
                if ((Request.QueryString["type"] + "") == "1")
                {
                    this.hidType.Value = Request.QueryString["type"] + "";
                    ShopCart();
                }
            }
        }
    }