コード例 #1
0
    protected void odsApplyDetails_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        UserControls_SKUControl UCSKU = (UserControls_SKUControl)this.fvApplyDetails.FindControl("UCSKU");

        if (UCSKU.SKUID == string.Empty)
        {
            PageUtility.ShowModelDlg(this.Page, "请选择产品");
            e.Cancel = true;
            return;
        }
        else
        {
            e.InputParameters["SKUID"] = UCSKU.SKUID;
        }
        DropDownList newExpenseItemDDL = (DropDownList)this.fvApplyDetails.FindControl("newExpenseItemDDL");

        if (ExpenseItemRemainTimes.ContainsKey(int.Parse(newExpenseItemDDL.SelectedValue)))
        {
            object[] array = ExpenseItemRemainTimes[int.Parse(newExpenseItemDDL.SelectedValue)];
            if (array != null)
            {
                if (!(bool)array[0])
                {
                    PageUtility.ShowModelDlg(this.Page, string.Format("您当前选择的客户的该费用项超出限制次数(已使用{0}次)", array[1].ToString()));
                    e.Cancel = true;
                    return;
                }
            }
        }
        if (this.ViewState["ObjectId"] != null)
        {
            e.InputParameters["FormApplyID"] = int.Parse(this.ViewState["ObjectId"].ToString());
        }
    }
コード例 #2
0
    protected void NewSKUDDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        UserControls_SKUControl UCSKU = (UserControls_SKUControl)this.SKUListView.InsertItem.FindControl("UCSKU");
        TextBox NewSupplyPriceCtl     = (TextBox)this.SKUListView.InsertItem.FindControl("NewSupplyPriceCtl");

        if (UCSKU.SKUID != string.Empty)
        {
            NewSupplyPriceCtl.Text = new MasterDataBLL().GetSKUPriceByCustomerID(int.Parse(UCSKU.SKUID), int.Parse(this.ViewState["CustomerID"].ToString())).ToString();
        }
        else
        {
            NewSupplyPriceCtl.Text = "";
        }
    }
コード例 #3
0
    protected void odsSKU_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
    {
        //验证是否选中产品
        UserControls_SKUControl UCSKU = (UserControls_SKUControl)this.SKUListView.InsertItem.FindControl("UCSKU");

        e.InputParameters["SKUID"] = UCSKU.SKUID;
        decimal supplyPrice = decimal.Parse(e.InputParameters["SupplyPrice"].ToString());

        if (supplyPrice <= 0)
        {
            PageUtility.ShowModelDlg(this.Page, "正常供货价不能为零,请联系管理员");
            e.Cancel = true;
            return;
        }
        //如果是填促销价格的话,换算成买多少送多少,反之,换算促销价
        if (!this.IsPromotionReadOnly)
        {
            TextBox NewPromotionPriceCtl = (TextBox)this.SKUListView.InsertItem.FindControl("NewPromotionPriceCtl");
            if (NewPromotionPriceCtl.Text == string.Empty)
            {
                PageUtility.ShowModelDlg(this.Page, "请录入促销供货价");
                e.Cancel = true;
                return;
            }
            else
            {
                try {
                    decimal promotionPrice = decimal.Parse(NewPromotionPriceCtl.Text);
                    e.InputParameters["PromotionPrice"] = promotionPrice;
                    if (promotionPrice > supplyPrice)
                    {
                        PageUtility.ShowModelDlg(this.Page, "促销供货价必须小于正常供货价!");
                        e.Cancel = true;
                        return;
                    }
                    int buyQuantity  = (int)(((decimal)1.00) / ((supplyPrice - promotionPrice) / supplyPrice));
                    int giveQuantity = 1;
                    e.InputParameters["BuyQuantity"]  = buyQuantity;
                    e.InputParameters["GiveQuantity"] = giveQuantity;
                } catch (Exception ex) {
                    PageUtility.ShowModelDlg(this.Page, "促销供货价格式不正确");
                    e.Cancel = true;
                    return;
                }
            }
        }
        else
        {
            TextBox NewBuyQuantityCtl  = (TextBox)this.SKUListView.InsertItem.FindControl("NewBuyQuantityCtl");
            TextBox NewGiveQuantityCtl = (TextBox)this.SKUListView.InsertItem.FindControl("NewGiveQuantityCtl");
            if (NewBuyQuantityCtl.Text == string.Empty || NewGiveQuantityCtl.Text == string.Empty)
            {
                PageUtility.ShowModelDlg(this.Page, "请录入买或送的数量");
                e.Cancel = true;
                return;
            }
            else
            {
                try {
                    int buyQuantity  = int.Parse(NewBuyQuantityCtl.Text);
                    int giveQuantity = int.Parse(NewGiveQuantityCtl.Text);
                    e.InputParameters["BuyQuantity"]  = buyQuantity;
                    e.InputParameters["GiveQuantity"] = giveQuantity;
                    decimal promotionPrice = ((decimal)((decimal)(buyQuantity)) / ((decimal)buyQuantity + giveQuantity)) * supplyPrice;
                    e.InputParameters["PromotionPrice"] = promotionPrice;
                } catch (Exception ex) {
                    PageUtility.ShowModelDlg(this.Page, "买或送的数量格式不正确");
                    e.Cancel = true;
                    return;
                }
            }
        }
        if (this.ViewState["ObjectId"] != null)
        {
            e.InputParameters["FormApplyID"] = int.Parse(this.ViewState["ObjectId"].ToString());
        }
    }