Ejemplo n.º 1
0
        private void btn_Click(object sender, EventArgs e)
        {
            var discountRate  = txtDiscountRate.Text.ToDecimal();
            var discountMoney = txtDiscoutMoney.Text.ToDecimal();
            var discountPrice = txtDiscountPrice.Text.ToDecimal();
            var btn           = sender as SimpleButton;

            switch (btn.Name)
            {
            case "btnConfirm":
                if (!toggleSwitch.IsOn)
                {
                    var selectedItem = ListPosExt.Where(item => item.BarID == FocusePostExt.BarID).First();
                    selectedItem.PosDiscountPrice = (discountRate / 100) * FocusePostExt.RetailPrice;
                    selectedItem.PosSalesAmount   = selectedItem.PosDiscountPrice * selectedItem.PosSalesCount;
                }
                else
                {
                    ListPosExt.ForEach(item =>
                    {
                        item.PosDiscountPrice = discountRate / 100 * item.RetailPrice;
                        item.PosSalesAmount   = item.PosDiscountPrice * item.PosSalesCount;
                    });
                }
                break;

            case "btnCancel":
                break;
            }
            Close();
        }
Ejemplo n.º 2
0
        private void txtDiscountRate_EditValueChanged(object sender, EventArgs e)
        {
            //折扣率
            var discountRate = txtDiscountRate.EditValue.ToString().ToDecimal();
            //折扣价格
            var discountPrice = txtDiscountPrice.Text.ToDecimal();
            //折扣金额
            var discountMoney = txtDiscoutMoney.Text.ToDecimal();

            if (discountType == DiscountType.SingleDiscount)
            {
                var updatedPosExtList = ListPosExt.Where(item => item.ID == FocusePostExt.ID).First();
                updatedPosExtList.PosDiscountPrice = (discountRate / 100) * FocusePostExt.RetailPrice;
                txtDiscoutMoney.EditValue          = FocusePostExt.RetailPrice - updatedPosExtList.PosDiscountPrice;
                txtDiscountPrice.EditValue         = FocusePostExt.RetailPrice - txtDiscoutMoney.EditValue.ToString().ToDecimal();
            }
        }