private void updateObject()
        {
            MPackageBonus v = (MPackageBonus)ProductSelected;

            if (v == null)
            {
                return;
            }

            v.ServiceObj      = null;
            v.ItemObj         = null;
            v.ItemCategoryObj = null;

            if (lkupItem.SelectedObject != null)
            {
                if (lkupItem.Lookup == LookupSearchType2.ServiceLookup)
                {
                    v.ServiceObj    = lkupItem.SelectedObject;
                    v.SelectionType = "1";
                }
                else if (lkupItem.Lookup == LookupSearchType2.InventoryItemLookup)
                {
                    v.ItemObj       = lkupItem.SelectedObject;
                    v.SelectionType = "2";
                }
                else if (lkupItem.Lookup == LookupSearchType2.ItemCategoryLookup)
                {
                    v.ItemCategoryObj = lkupItem.SelectedObject;
                    v.SelectionType   = "3";
                }
            }

            v.Quantity = txtQuantity.Text;
        }
        private static void OnProductSelectedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            UProductSelection control = obj as UProductSelection;
            MPackageBonus     d       = (MPackageBonus)e.NewValue;

            updateGui(control, d);
        }
Example #3
0
        private void cmdBonusGetDelete_Click(object sender, RoutedEventArgs e)
        {
            MPackageBonus pp = (MPackageBonus)(sender as Button).Tag;

            vw.RemoveBonusFreeItem(pp);

            vw.IsModified = true;
        }
Example #4
0
        private void cmdBonusFreeAdd_Click(object sender, RoutedEventArgs e)
        {
            MPackageBonus pp = new MPackageBonus(new CTable(""));

            pp.EnabledFlag   = "Y";
            pp.SelectionType = "1";
            vw.AddBonusItemFree(pp);

            vw.IsModified = true;
        }
Example #5
0
        public CPackageItemAdapter(MBaseModel vw)
        {
            item = vw;

            if (item is MPackageBonus)
            {
                bonus = (MPackageBonus)item;
            }
            else if (item is MPackageBundle)
            {
                bundle = (MPackageBundle)item;
            }
            else if (item is MPackageVoucher)
            {
                voucher = (MPackageVoucher)item;
            }
        }
        private void cbxEnable_Unchecked(object sender, RoutedEventArgs e)
        {
            UProductSelection control = this;

            if (control.OnChanged != null)
            {
                control.OnChanged(control, null);
            }

            MPackageBonus v = (MPackageBonus)ProductSelected;

            if (v == null)
            {
                return;
            }

            v.EnabledFlag = "N";
        }
        private static void updateGui(UProductSelection control, MPackageBonus v)
        {
            if (v == null)
            {
                return;
            }

            MPackageBonus o = new MPackageBonus(v.GetDbObject().Clone());

            control.cbxEnable.IsChecked = o.EnabledFlag.Equals("Y");
            int selectionType = CUtil.StringToInt(o.SelectionType);

            control.cboSelectionType.SelectedIndex = selectionType - 1;

            if (selectionType == 1)
            {
                control.lkupItem.SelectedObject = o.ServiceObj;
            }
            else if (selectionType == 2)
            {
                control.lkupItem.SelectedObject = o.ItemObj;
            }
            else if (selectionType == 3)
            {
                control.lkupItem.SelectedObject = o.ItemCategoryObj;
            }
            else
            {
                control.lkupItem.SelectedObject = o.ServiceObj;
            }

            control.txtQuantity.Text = o.Quantity;

            v.ExtFlag = "I";
            if (v.PackageBonusID.Equals(""))
            {
                v.ExtFlag = "A";
            }
        }