Exemple #1
0
        private Boolean isItemApplicable(MPackageTrayPriceDiscount pp, CBasketItem bi)
        {
            String        ppSelectType = pp.SelectionType;
            MSelectedItem vs           = (MSelectedItem)bi.Item;


            if ((ppSelectType.Equals("1")) && (vs.SelectionType.Equals("1")))
            {
                //Service
                if (vs.ServiceID.Equals(pp.ServiceId))
                {
                    return(true);
                }
            }
            else if ((ppSelectType.Equals("2")) && (vs.SelectionType.Equals("2")))
            {
                //Item
                if (vs.ItemID.Equals(pp.ItemId))
                {
                    return(true);
                }
            }
            else if ((ppSelectType.Equals("3")) && (vs.SelectionType.Equals("2")))
            {
                //Item Category VS Item

                MInventoryItem vi = (MInventoryItem)vs.ItemObj;
                if (vi.ItemCategory.Equals(pp.CategoryId))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #2
0
        private static void OnProductSelectedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            UProductPriceDiscountTray control = obj as UProductPriceDiscountTray;
            MPackageTrayPriceDiscount d       = (MPackageTrayPriceDiscount)e.NewValue;

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

            vw.RemoveTrayPriceItem(pp);

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

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

            vw.IsModified = true;
        }
Exemple #5
0
        private void cbxStdPrice_Unchecked(object sender, RoutedEventArgs e)
        {
            UProductPriceDiscountTray control = this;

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

            MPackageTrayPriceDiscount v = (MPackageTrayPriceDiscount)ProductSelected;

            if (v == null)
            {
                return;
            }

            v.StdPriceFlag = "N";
        }
Exemple #6
0
        private void updateObject()
        {
            MPackageTrayPriceDiscount v = (MPackageTrayPriceDiscount)ProductSelected;

            if (v == null)
            {
                return;
            }

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

            if (lkupItem.SelectedObject != null)
            {
                if (lkupItem.Lookup == LookupSearchType2.ServiceLookup)
                {
                    MService svc = (MService)lkupItem.SelectedObject;

                    v.ServiceObj    = svc;
                    v.SelectionType = "1";
                    v.Code          = svc.ServiceCode;
                    v.Name          = svc.ServiceName;
                }
                else if (lkupItem.Lookup == LookupSearchType2.InventoryItemLookup)
                {
                    MInventoryItem itm = (MInventoryItem)lkupItem.SelectedObject;

                    v.ItemObj       = itm;
                    v.SelectionType = "2";
                    v.Code          = itm.ItemCode;
                    v.Name          = itm.ItemNameThai;
                }
                else if (lkupItem.Lookup == LookupSearchType2.ItemCategoryLookup)
                {
                    MItemCategory cat = (MItemCategory)lkupItem.SelectedObject;

                    v.ItemCategoryObj = cat;
                    v.SelectionType   = "3";
                    v.Code            = cat.ItemCategoryID;
                    v.Name            = cat.CategoryName;
                }
            }
        }
Exemple #7
0
        private static void updateGui(UProductPriceDiscountTray control, MPackageTrayPriceDiscount v)
        {
            if (v == null)
            {
                return;
            }

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

            control.cbxEnable.IsChecked            = o.EnabledFlag.Equals("Y");
            control.cboSelectionType.SelectedIndex = CUtil.StringToInt(o.SelectionType) - 1;
            //control.cbxStdPrice.IsChecked = o.StdPriceFlag.Equals("Y");

            if (o.SelectionType.Equals("1"))
            {
                control.lkupItem.Lookup         = LookupSearchType2.ServiceLookup;
                control.lkupItem.SelectedObject = o.ServiceObj;
            }
            else if (o.SelectionType.Equals("2"))
            {
                control.lkupItem.Lookup         = LookupSearchType2.InventoryItemLookup;
                control.lkupItem.SelectedObject = o.ItemObj;
            }
            else
            {
                control.lkupItem.Lookup         = LookupSearchType2.ItemCategoryLookup;
                control.lkupItem.SelectedObject = o.ItemCategoryObj;
            }

            //This function call only one at the beginning
            v.ExtFlag = "I";
            if (v.PackageTrayPriceID.Equals(""))
            {
                v.ExtFlag = "A";
            }
        }
Exemple #8
0
        private void cmdDiscInterval_Click(object sender, RoutedEventArgs e)
        {
            MPackageTrayPriceDiscount v = (MPackageTrayPriceDiscount)ProductSelected;

            if (v == null)
            {
                return;
            }

            UProductPriceDiscountTray control = this;

            WinAddEditIntervalConfigEx w = new WinAddEditIntervalConfigEx(v.DiscountDefination, v.Name, "DISCOUNT");

            w.ShowDialog();
            if (w.IsOK)
            {
                v.DiscountDefination = w.ConfigString;

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