Exemplo n.º 1
0
 protected void btn_Add_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(select_Client.SelectValue))
     {
         MessageBox.Show(this, "请先选择要添加价表的客户!");
     }
     else
     {
         if (ddl_StandardPrice.SelectedValue == "0")
         {
             MessageBox.Show(this, "请先选择标准价表!");
             return;
         }
         #region 判断当前是否已有有效的价表
         string condition = " PDT_ProductPrice.Client = " + select_Client.SelectValue + " AND GETDATE() BETWEEN PDT_ProductPrice.BeginDate AND PDT_ProductPrice.EndDate ";
         if (PDT_ProductPriceBLL.GetModelList(condition).Count > 0)
         {
             MessageBox.Show(this, "对不起,当前客户在当前有效期内已有一个价表,您可以在原价表基础上修改,而不要重复添加价表!");
             return;
         }
         #endregion
         Response.Redirect("PDT_ProductPriceDetail2.aspx?ClientID=" + select_Client.SelectValue + "&ClientType=" + ViewState["ClientType"].ToString() + "&StandardPrice=" + ddl_StandardPrice.SelectedValue);
     }
 }
Exemplo n.º 2
0
    private void BindData()
    {
        ORD_OrderCartBLL    cart    = (ORD_OrderCartBLL)Session["LogisticsOrderApplyDetail"];
        ORD_ApplyPublishBLL publish = new ORD_ApplyPublishBLL(cart.Publish);

        if (publish == null)
        {
            Response.Redirect("OrderApplyDetail0.aspx");
        }

        ViewState["Publish"] = cart.Publish;
        pl_ApplyPublish.BindData(publish.Model);

        IList <ORD_ApplyPublishDetail> productlists;

        if (cart.Type == 1)
        {
            #region 成品取客户价表
            productlists = new List <ORD_ApplyPublishDetail>();
            IList <PDT_ProductPrice> pricelists = PDT_ProductPriceBLL.GetModelList
                                                      ("GETDATE() BETWEEN BeginDate AND EndDate AND Client=" + cart.Client.ToString());
            if (pricelists.Count == 0)
            {
                MessageBox.ShowAndRedirect(this, "对不起,该客户没有生效的价表,不可申请产品!", "OrderApplyDetail0.aspx");
                return;
            }

            PDT_ProductPriceBLL pricebll = new PDT_ProductPriceBLL(pricelists[0].ID);

            foreach (ORD_ApplyPublishDetail item in publish.Items)
            {
                PDT_ProductBLL _bll = new PDT_ProductBLL(item.Product);

                if (new PDT_BrandBLL(_bll.Model.Brand).Model.IsOpponent == "1")
                {
                    PDT_ProductPrice_Detail priceitem = pricebll.Items.FirstOrDefault(p => p.Product == item.Product);
                    if (priceitem == null)
                    {
                        continue;
                    }
                    item.Price = priceitem.BuyingPrice;
                }
                else
                {
                    item.Price = _bll.Model.FactoryPrice;
                }

                productlists.Add(item);
            }
            #endregion
        }
        else
        {
            #region 绑定赠品申请预算信息
            BindBudgetInfo(cart.OrganizeCity, cart.AccountMonth, cart.Client, cart.GiftFeeType, cart.Brand, cart.GiftClassify, cart.Receiver);
            tb_GiftBudgetInfo.Visible = true;
            #endregion


            productlists = publish.Items;
        }

        ViewState["PublishDetails"] = productlists;
        gv_List.PageIndex           = 0;
        BindGrid();

        lb_CartCount.Text = cart.Items.Count.ToString();
    }