/// <summary> /// Handle Right Click Event /// </summary> public void HandleRightClickEvent(ref ContextMenuInfo eventInfo, out bool bubbleEvent) { Form oForm = oSBOApplication.Forms.ActiveForm; try { bubbleEvent = true; OneTimeDiscount oneTimeDisc = new OneTimeDiscount(oSBOApplication, oSBOCompany); PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); FixDiscount fixDisc = new FixDiscount(oSBOApplication, oSBOCompany); switch (oForm.TypeEx) { case "PRDDISC": prdDisc.RightClickEvent_PrdDisc(ref eventInfo, ref bubbleEvent); break; case "FIXDISC": fixDisc.RightClickEvent_FixDisc(ref eventInfo, ref bubbleEvent); break; } } catch (Exception ex) { bubbleEvent = false; Utils.releaseObject(oForm); oSBOApplication.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }
private static DiscountBase ConvertDiscountAndLineToDiscountBase(PeriodicDiscount discountAndLine) { DiscountBase discount = null; OfferDiscount offer = null; MixAndMatchDiscount mixAndMatch = null; MultipleBuyDiscount multipleBuy = null; ThresholdDiscount threshold = null; switch (discountAndLine.PeriodicDiscountType) { case PeriodicDiscountOfferType.Offer: offer = new OfferDiscount(discountAndLine.ValidationPeriod); discount = offer; break; case PeriodicDiscountOfferType.MixAndMatch: mixAndMatch = new MixAndMatchDiscount(discountAndLine.ValidationPeriod); mixAndMatch.DealPriceValue = discountAndLine.MixAndMatchDealPrice; mixAndMatch.DiscountAmountValue = discountAndLine.MixAndMatchDiscountAmount; mixAndMatch.DiscountPercentValue = discountAndLine.MixAndMatchDiscountPercent; mixAndMatch.NumberOfLeastExpensiveLines = discountAndLine.MixAndMatchNumberOfLeastExpensiveLines; mixAndMatch.NumberOfTimesApplicable = discountAndLine.MixAndMatchNumberOfTimeApplicable; mixAndMatch.LeastExpensiveMode = discountAndLine.LeastExpensiveMode; discount = mixAndMatch; break; case PeriodicDiscountOfferType.MultipleBuy: multipleBuy = new MultipleBuyDiscount(discountAndLine.ValidationPeriod); discount = multipleBuy; break; case PeriodicDiscountOfferType.Threshold: threshold = new ThresholdDiscount(discountAndLine.ValidationPeriod); threshold.ShouldCountNonDiscountItems = discountAndLine.ShouldCountNonDiscountItems != 0; discount = threshold; break; } if (discount != null) { discount.IsCategoryToProductOrVariantIdsMapSet = true; discount.OfferId = discountAndLine.OfferId; discount.OfferName = discountAndLine.Name; discount.PeriodicDiscountType = discountAndLine.PeriodicDiscountType; discount.IsDiscountCodeRequired = discountAndLine.IsDiscountCodeRequired; discount.ConcurrencyMode = discountAndLine.ConcurrencyMode; discount.PricingPriorityNumber = discountAndLine.PricingPriorityNumber; discount.CurrencyCode = discountAndLine.CurrencyCode; discount.DateValidationPeriodId = discountAndLine.ValidationPeriodId; discount.DateValidationType = (DateValidationType)discountAndLine.DateValidationType; discount.DiscountType = GetDiscountMethodType(discount.PeriodicDiscountType, discountAndLine.DiscountType); discount.ValidFrom = discountAndLine.ValidFromDate; discount.ValidTo = discountAndLine.ValidToDate; } return(discount); }
/// <summary> /// Handle Menu Event /// </summary> public void HandleMenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) { BubbleEvent = true; OneTimeDiscount oneTimeDisc = new OneTimeDiscount(oSBOApplication, oSBOCompany); PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); FixDiscount fixDisc = new FixDiscount(oSBOApplication, oSBOCompany); try { switch (pVal.MenuUID) { case "96969": oneTimeDisc.MenuEvent_CashDisc(ref pVal, out BubbleEvent); break; case "51115": prdDisc.MenuEvent_PrdDisc(ref pVal, out BubbleEvent); break; case "32323": fixDisc.MenuEvent_FixDisc(ref pVal, out BubbleEvent); break; // Add case "1282": MenuEventHandlerAdd(ref pVal, out BubbleEvent); break; // next record case "1288": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // previous record case "1289": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // first data record case "1290": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // last data record case "1291": MenuEventHandlerNextPrev(ref pVal, out BubbleEvent); break; // Refresh //case "1304" case "PrdDiscAdd": prdDisc.MenuEvent_PrdDiscAdd(ref pVal, ref BubbleEvent); break; case "PrdDiscDel": prdDisc.MenuEvent_PrdDiscDel(ref pVal, ref BubbleEvent); break; case "FixDiscAdd": fixDisc.MenuEvent_FixDiscAdd(ref pVal, ref BubbleEvent); break; case "FixDiscDel": fixDisc.MenuEvent_FixDiscDel(ref pVal, ref BubbleEvent); break; } } catch (Exception ex) { BubbleEvent = false; oSBOApplication.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } }
private void MenuEventHandlerNextPrev(ref SAPbouiCOM.MenuEvent pVal, out bool bubbleEvent) { bubbleEvent = true; if (pVal.BeforeAction == false) { Form oForm = oSBOApplication.Forms.ActiveForm; PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); switch (oForm.TypeEx) { case "PRDDISC": prdDisc.NextPrev_PrdDisc(ref oForm); break; } } }
private static RetailDiscountLine ConvertDiscountAndLineToDiscountLine(PeriodicDiscount discountAndLine, DiscountBase discount) { RetailDiscountLine discountLine = new RetailDiscountLine(); discountLine.OfferId = discountAndLine.OfferId; discountLine.DiscountLineNumber = discountAndLine.DiscountLineNumber; discountLine.ProductId = discountAndLine.ProductId; discountLine.DistinctProductVariantId = discountAndLine.DistinctProductVariantId; discountLine.DiscountAmount = discountAndLine.DiscountAmount; discountLine.DiscountLinePercentOrValue = discountAndLine.DiscountLinePercentOrValue; discountLine.DiscountMethod = (int)GetLineDiscountOfferMethod(discount.PeriodicDiscountType, discount.DiscountType, discountAndLine.DiscountMethod, discountAndLine.MixAndMatchLineSpecificDiscountType); discountLine.DiscountPercent = discountAndLine.DiscountPercent; discountLine.MixAndMatchLineGroup = discountAndLine.MixAndMatchLineGroup; discountLine.MixAndMatchLineNumberOfItemsNeeded = discountAndLine.MixAndMatchLineNumberOfItemsNeeded; discountLine.MixAndMatchLineSpecificDiscountType = discountAndLine.MixAndMatchLineSpecificDiscountType; discountLine.OfferPrice = discountAndLine.OfferPrice; discountLine.UnitOfMeasureSymbol = discountAndLine.UnitOfMeasureSymbol; return(discountLine); }
/// <summary> /// Event when click Add Menu (CTRL+A) /// </summary> private void MenuEventHandlerAdd(ref SAPbouiCOM.MenuEvent pVal, out bool bubbleEvent) { bubbleEvent = true; if (pVal.BeforeAction == false) { Form oForm = oSBOApplication.Forms.ActiveForm; PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); FixDiscount fixDisc = new FixDiscount(oSBOApplication, oSBOCompany); switch (oForm.TypeEx) { case "PRDDISC": prdDisc.Template_Add_PrdDisc(ref oForm); break; case "FIXDISC": fixDisc.Template_Add_FixDisc(ref oForm); break; } Utils.releaseObject(oForm); } }
/// <summary> /// Handle Item Event /// </summary> public void HandleItemEvent(string FormUID, ref ItemEvent pVal, out bool bubbleEvent) { bubbleEvent = true; OneTimeDiscount cashDisc = new OneTimeDiscount(oSBOApplication, oSBOCompany); PeriodicDiscount prdDisc = new PeriodicDiscount(oSBOApplication, oSBOCompany); FixDiscount fixDisc = new FixDiscount(oSBOApplication, oSBOCompany); SalesOrder salesOrder = new SalesOrder(oSBOApplication, oSBOCompany); try { if (pVal.EventType != BoEventTypes.et_FORM_UNLOAD) { if (pVal.FormTypeEx == "CASHDISC") { cashDisc.ItemEvent_CashDisc(FormUID, ref pVal, ref bubbleEvent); } else if (pVal.FormTypeEx == "PRDDISC") { prdDisc.ItemEvent_PrdDisc(FormUID, ref pVal, ref bubbleEvent); } else if (pVal.FormTypeEx == "FIXDISC") { fixDisc.ItemEvent_PrdDisc(FormUID, ref pVal, ref bubbleEvent); } else if (pVal.FormType == 139) { salesOrder.ItemEvents_SalesOrder(FormUID, ref pVal, ref bubbleEvent); } } } catch (Exception ex) { bubbleEvent = false; oSBOApplication.MessageBox(ex.Message); } }