Пример #1
0
        private void activateDiscount(int type, decimal value, decimal amount, bool isMultiple, bool isHistory, int discountWid)
        {
            bool flag = false;

            if (!isHistory)
            {
                discountWid = 0;
            }
            if ((type == dcdetail_customdiscounttype && discountWid != 0) || type != dcdetail_customdiscounttype)
            {
                foreach (cls_discount disc in this.disclist)
                {
                    if (type == disc.get_type() && !disc.get_status())
                    {
                        if (type == dcdetail_customdiscounttype && discountWid != disc.get_SyncId())
                        {
                            continue;
                        }
                        if (type == cls_globalvariables.dcdetail_promoqty && isMultiple)
                        {
                            disc.set_name("Item Discount");
                        }

                        set_discount_name(disc, type);
                        disc.set_status(true);
                        disc.set_ismultiple(isMultiple);
                        disc.set_value(value);
                        if (amount == 0 && !isMultiple && type == dcdetail_promoqty)
                        {
                            amount = value * -1;
                        }
                        if (isHistory)
                        {
                            disc.set_discounted_amount(amount);
                        }
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag && type == dcdetail_customdiscounttype)
            {
                cls_discount discountTemp = new cls_discount();
                discountTemp.set_status(true);
                discountTemp.set_ismultiple(isMultiple);
                discountTemp.set_value(value);
                discountTemp.set_name("Custom Discount");
                if (isHistory)
                {
                    discountTemp.set_discounted_amount(amount);
                }
                this.disclist.Add(discountTemp);
            }
        }
Пример #2
0
        public void activateDiscount_using_wid(long SyncId, decimal value, bool isMultiple)
        {
            cls_discount disc = get_discount_using_wid(SyncId);

            if (SyncId == disc.get_SyncId() && !disc.get_status())
            {
                disc.set_status(true);
                disc.set_value(value);
                disc.set_ismultiple(isMultiple);
            }
            else if (SyncId == disc.get_SyncId() && disc.get_status())
            {
                if (DialogHelper.ShowDialog("This discount is already being used. Do you want to remove the discount?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    disc.set_status(false);
                }
            }
            else
            {
            }
        }