예제 #1
0
        /// <summary>
        /// OpenTicket
        /// </summary>
        /// <param name="theInfo"></param>
        /// <param name="targetTicket"></param>
        public void openTicket(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket)
        {
            try
            {
                if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
                {
                    return;
                }
                if (_configurationHelper != null && _configurationHelper.ENABLE_bLOYAL)
                {
                    RefreshTicket(targetTicket);

                    if (_ticketId > 0)
                    {
                        if (TicketDictionary.Dictionary == null)
                        {
                            TicketDictionary.Dictionary = new Dictionary <int, string>();
                        }

                        if (!TicketDictionary.Dictionary.ContainsKey(_ticketId))
                        {
                            TicketDictionary.Dictionary.Add(_ticketId, Constants.CALCULATEDNOTCURRENT);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _loggerHelper.WriteLogError(ex, "openTicket");
            }
        }
예제 #2
0
 /// <summary>
 /// newTicket event
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 public void newTicket(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket)
 {
     if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
     {
         return;
     }
     RefreshTicket(targetTicket);
 }
예제 #3
0
 /// <summary>
 /// AddChoice
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 /// <param name="targetItem"></param>
 /// <param name="targetChoice"></param>
 public void addChoice(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket, MenuItem targetItem, Choice targetChoice)
 {
     if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
     {
         return;
     }
     RefreshTicket(targetTicket);
 }
예제 #4
0
 /// <summary>
 /// RemoveTicketDiscount
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 /// <param name="theDiscount"></param>
 public void removeTicketDiscount(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket, Dinerware.Discount theDiscount)
 {
     if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
     {
         return;
     }
     RefreshTicketAndUpdateDictionary(targetTicket);
 }
예제 #5
0
 /// <summary>
 /// New Transaction Track for Ticket
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 /// <param name="targetTender"></param>
 /// <param name="tenderedAmount"></param>
 /// <param name="amountDue"></param>
 /// <param name="changeDue"></param>
 public void newTransaction(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket, TenderType targetTender, decimal tenderedAmount, decimal amountDue, decimal changeDue)
 {
     if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
     {
         return;
     }
     RefreshTicket(targetTicket);
 }
예제 #6
0
 /// <summary>
 /// EepeatItem
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 /// <param name="targetItem"></param>
 public void repeatItem(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket, MenuItem targetItem)
 {
     if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
     {
         return;
     }
     RefreshTicketAndUpdateDictionary(targetTicket);
 }
예제 #7
0
        /// <summary>
        /// RemoveItem
        /// </summary>
        /// <param name="theInfo"></param>
        /// <param name="targetTicket"></param>
        /// <param name="targetItem"></param>
        public void removeItem(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket, MenuItem targetItem)
        {
            try
            {
                if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
                {
                    return;
                }
                if (_configurationHelper != null && _configurationHelper.ENABLE_bLOYAL && targetItem != null && _configurationHelper.LOAD_GIFTCARD_ITEMS != null && _configurationHelper.LOAD_GIFTCARD_ITEMS.Any())
                {
                    RefreshTicket(targetTicket);
                    UpdateTicketDictionary(_ticketId);

                    var loadGiftCardItem = _configurationHelper.LOAD_GIFTCARD_ITEMS.Find(t => t.Equals(targetItem.ItemName, StringComparison.InvariantCultureIgnoreCase));
                    if (!string.IsNullOrWhiteSpace(loadGiftCardItem))
                    {
                        var service = new LoyaltyEngineServices();

                        var calculatedCart = AsyncHelper.RunSync(() => service.GetCartBySourceExternalIdAsync(_targetTicket.ID));

                        if (calculatedCart != null && calculatedCart.Cart != null && calculatedCart.Cart.Lines != null && calculatedCart.Cart.Lines.Any())
                        {
                            var lines        = calculatedCart.Cart.Lines;
                            var giftCartLine = calculatedCart.Cart.Lines.ToList().Find(t => t.ProductName.Equals(loadGiftCardItem, StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrWhiteSpace(t.GiftCardNumber) && t.ProductExternalId.Equals(targetItem.TIID));
                            if (giftCartLine != null && giftCartLine.GiftCardAmount.HasValue && giftCartLine.GiftCardAmount.Value > 0)
                            {
                                if (!_calculateTransaction.CreditLoadGiftCardItem(calculatedCart, targetItem.Price, giftCartLine.GiftCardNumber, targetTicket.ID, giftCartLine))
                                {
                                    frmServerOfflineWarning offLineMsg = new frmServerOfflineWarning();
                                    offLineMsg.ShowDialog();
                                }
                                else
                                {
                                    lines.Remove(giftCartLine);
                                }
                            }

                            calculatedCart.Cart.Lines = lines;
                            var request = new CalculateCartCommand()
                            {
                                Cart = calculatedCart.Cart,
                                Uid  = calculatedCart.Cart.Uid
                            };

                            service.CalculateCart(request);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _loggerHelper.WriteLogError(ex, "removeItem");
            }
        }
예제 #8
0
        /// <summary>
        /// Exit Payment Window and close ticket event
        /// </summary>
        /// <param name="theInfo"></param>
        public async void exitPaymentWindow(IDisplayActions.displayActionInfo theInfo)
        {
            try
            {
                if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
                {
                    return;
                }
                if (_configurationHelper != null && _configurationHelper.ENABLE_bLOYAL)
                {
                    if (_ticketId != 0)
                    {
                        if (_targetTicket != null && _targetTicket.AmountDue == 0)
                        {
                            var response = _calculateTransaction.ApplyLoadGiftCardBalance(_ticketId, theInfo.userID);

                            if (response != null)
                            {
                                foreach (var loadItem in response)
                                {
                                    frmApplyGiftCardSummary gcSummary = new frmApplyGiftCardSummary(loadItem.NetAmount, loadItem.GiftCardNumber, loadItem.IsProvision, loadItem.IsNewCard);
                                    gcSummary.ShowDialog();
                                }
                            }

                            if (_ticketId > 0 &&
                                TicketDictionary.Dictionary != null &&
                                TicketDictionary.Dictionary.ContainsKey(_ticketId) &&
                                TicketDictionary.Dictionary[_ticketId] == Constants.CALCULATEDCURRENT)
                            {
                                var approveCartCommand = new ApproveCartCommand
                                {
                                    CartUid = TicketDictionary.CartDictionary[_ticketId],
                                    CartSourceExternalId = _ticketId.ToString(),
                                    ReferenceNumber      = _ticketId.ToString()
                                };
                                var service      = new LoyaltyEngineServices();
                                var cartApproval = service.ApproveCartAsync(approveCartCommand);

                                await _calculateTransaction.CommitCartAsync(_ticketId);
                            }

                            _ticketId = 0;  // after process complete set ticket id to 0
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _loggerHelper.WriteLogError(ex, "exitPaymentWindow");
            }
        }
예제 #9
0
 /// <summary>
 /// RemoveChoice
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 /// <param name="targetItem"></param>
 /// <param name="targetChoice"></param>
 public void removeChoice(IDisplayActions.displayActionInfo theInfo, Dinerware.Ticket targetTicket, Dinerware.MenuItem targetItem, Dinerware.Choice targetChoice)
 {
     try
     {
         if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
         {
             return;
         }
         RefreshTicket(targetTicket);
     }
     catch (Exception ex)
     {
         _loggerHelper.WriteLogError(ex, "removeChoice");
     }
 }
예제 #10
0
        /// <summary>
        /// RemoveTransaction
        /// </summary>
        /// <param name="theInfo"></param>
        /// <param name="targetTicket"></param>
        /// <param name="displayField"></param>
        /// <param name="paymentAmount"></param>
        /// <param name="amountDue"></param>
        public void removeTransaction(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket, string displayField, decimal paymentAmount, decimal amountDue)
        {
            try
            {
                if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
                {
                    return;
                }
                if (_configurationHelper != null && _configurationHelper.ENABLE_bLOYAL)
                {
                    RefreshTicket(targetTicket);

                    if (_ticketId != 0)
                    {
                        bool isCreditbLoyalTendersError = AsyncHelper.RunSync(() => _calculateTransaction.RefundbLoyalTendersAsync(_ticketId, paymentAmount));

                        if (isCreditbLoyalTendersError)
                        {
                            System.Windows.Forms.Form frmServiceUrlDown = null;
                            if (ServiceURLHelper.IsbLoyalServiceUrlDown)
                            {
                                frmServiceUrlDown = new frmbLoyalServiceUrlDownWarning();
                            }
                            else
                            {
                                frmServiceUrlDown = new frmServerOfflineWarning();
                            }

                            frmServiceUrlDown.ShowDialog();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _loggerHelper.WriteLogError(ex, "removeTransaction");
            }
        }
예제 #11
0
 /// <summary>
 /// logout event
 /// </summary>
 /// <param name="theInfo"></param>
 public void logout(IDisplayActions.displayActionInfo theInfo)
 {
 }
예제 #12
0
        /// <summary>
        /// EnterPaymentWindow for PaymentWindow - event
        /// </summary>
        /// <param name="theInfo"></param>
        /// <param name="theTicket"></param>
        public void enterPaymentWindow(IDisplayActions.displayActionInfo theInfo, Ticket theTicket)
        {
            try
            {
                if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
                {
                    return;
                }
                if (_configurationHelper != null && _configurationHelper.ENABLE_bLOYAL && theTicket != null && theTicket.Items != null && theTicket.Items.Any())
                {
                    RefreshTicket(theTicket);

                    if (theTicket != null)
                    {
                        var services = new LoyaltyEngineServices();

                        if (_configurationHelper.LOAD_GIFTCARD_ITEMS != null && _configurationHelper.LOAD_GIFTCARD_ITEMS.Any())
                        {
                            var loadGiftCardItems = _configurationHelper.LOAD_GIFTCARD_ITEMS.Where(p => theTicket.Items.Any(p2 => p2.ItemName.Equals(p, StringComparison.InvariantCultureIgnoreCase)));
                            if (loadGiftCardItems != null && loadGiftCardItems.Any())
                            {
                                foreach (var loadGiftItem in loadGiftCardItems)
                                {
                                    var loadGiftCardMenuItems = theTicket.Items.ToList().FindAll(t => t.ItemName.Equals(loadGiftItem, StringComparison.InvariantCultureIgnoreCase));
                                    if (loadGiftCardMenuItems != null)
                                    {
                                        foreach (var loadItem in loadGiftCardMenuItems)
                                        {
                                            var calculatedCart = AsyncHelper.RunSync(() => services.GetCartBySourceExternalIdAsync(theTicket.ID));

                                            CartLine giftCartLine = null;
                                            if (calculatedCart != null && calculatedCart.Cart != null && calculatedCart.Cart.Lines != null && calculatedCart.Cart.Lines.Any())
                                            {
                                                giftCartLine = calculatedCart.Cart.Lines.FirstOrDefault(t => t.ProductName.Equals(loadGiftItem, StringComparison.InvariantCultureIgnoreCase) && !string.IsNullOrWhiteSpace(t.GiftCardNumber) && !string.IsNullOrWhiteSpace(t.ProductExternalId) && t.ProductExternalId.Equals(loadItem.TIID));
                                            }

                                            if (giftCartLine == null || string.IsNullOrWhiteSpace(giftCartLine.GiftCardNumber))
                                            {
                                                frmLoadGiftCardBalance loadGiftCardBalance = new frmLoadGiftCardBalance(_ticketId, string.Empty, _targetTicket, loadItem, calculatedCart, loadGiftItem);
                                                loadGiftCardBalance.ShowDialog();
                                                loadGiftCardBalance.CheckCardNumber();
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        if (TicketDictionary.Dictionary != null && TicketDictionary.Dictionary.ContainsKey(_ticketId))
                        {
                            if (TicketDictionary.Dictionary[_ticketId] == Constants.CALCULATEDCURRENT &&
                                TicketDictionary.CartDictionary != null && TicketDictionary.CartDictionary.ContainsKey(_ticketId) &&
                                TicketDictionary.CartDictionary[_ticketId] != null)
                            {
                                var approveCartCommand = new ApproveCartCommand
                                {
                                    CartUid = TicketDictionary.CartDictionary[_ticketId],
                                    CartSourceExternalId = _ticketId.ToString(),
                                    ReferenceNumber      = _ticketId.ToString()
                                };

                                CartApproval cartApproval = AsyncHelper.RunSync(() => services.ApproveCartAsync(approveCartCommand));

                                if (cartApproval != null && cartApproval.Alerts != null && cartApproval.Alerts.Count > 0)
                                {
                                    foreach (var alert in cartApproval.Alerts)
                                    {
                                        if (alert.Uid != null && alert.Uid != Guid.Empty && !string.IsNullOrWhiteSpace(alert.SnippetUrl))
                                        {
                                            frmAlerts frmAlert = new frmAlerts(TicketDictionary.CartDictionary[_ticketId].ToString(), alert.Uid.ToString(), alert.SnippetUrl);
                                            frmAlert.ShowDialog();
                                        }
                                    }
                                }
                            }
                            else if (_configurationHelper.IS_CALCULATE_DISCOUNT_WARNING)
                            {
                                frmTicketMsgForm discountWarning = new frmTicketMsgForm(theInfo.userID, _ticketId);
                                discountWarning.ShowDialog();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _loggerHelper.WriteLogError(ex, "enterPaymentWindow");
            }
        }
예제 #13
0
        /// <summary>
        /// Void Ticket
        /// </summary>
        /// <param name="theInfo"></param>
        /// <param name="targetTicket"></param>
        public void voidTicket(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket)
        {
            try
            {
                if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
                {
                    return;
                }
                if (_configurationHelper != null && _configurationHelper.ENABLE_bLOYAL && targetTicket != null && targetTicket.Items != null && targetTicket.Items.Any() && _configurationHelper.LOAD_GIFTCARD_ITEMS != null && _configurationHelper.LOAD_GIFTCARD_ITEMS.Any())
                {
                    RefreshTicket(targetTicket);

                    var loadGiftCardItems = _configurationHelper.LOAD_GIFTCARD_ITEMS.Where(p => targetTicket.Items.Any(p2 => p2.ItemName.Equals(p, StringComparison.InvariantCultureIgnoreCase)));
                    if (loadGiftCardItems != null && loadGiftCardItems.Any())
                    {
                        var  service = new LoyaltyEngineServices();
                        bool isCreditLoadGiftCard = false;

                        var calculatedCart = AsyncHelper.RunSync(() => service.GetCartBySourceExternalIdAsync(_targetTicket.ID));


                        if (calculatedCart != null && calculatedCart.Cart != null && calculatedCart.Cart.Lines != null)
                        {
                            var lines = new List <CartLine>(calculatedCart.Cart.Lines.ToList());

                            foreach (var giftCartLine in calculatedCart.Cart.Lines)
                            {
                                if (giftCartLine.GiftCardAmount.HasValue && giftCartLine.GiftCardAmount.Value > 0)
                                {
                                    if (!_calculateTransaction.CreditLoadGiftCardItem(calculatedCart, giftCartLine.GiftCardAmount.Value, giftCartLine.GiftCardNumber, targetTicket.ID, giftCartLine))
                                    {
                                        frmServerOfflineWarning offLineMsg = new frmServerOfflineWarning();
                                        offLineMsg.ShowDialog();
                                    }
                                    else
                                    {
                                        isCreditLoadGiftCard = true;
                                        lines.Remove(giftCartLine);
                                    }
                                }
                            }

                            if (isCreditLoadGiftCard)
                            {
                                calculatedCart.Cart.Lines = lines;
                                var request = new CalculateCartCommand()
                                {
                                    Cart = calculatedCart.Cart,
                                    Uid  = calculatedCart.Cart.Uid
                                };

                                service.CalculateCart(request);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _loggerHelper.WriteLogError(ex, "voidTicket");
            }
        }
예제 #14
0
 /// <summary>
 /// Void Item
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 /// <param name="targetItem"></param>
 public void voidItem(IDisplayActions.displayActionInfo theInfo, Dinerware.Ticket targetTicket, Dinerware.MenuItem targetItem)
 {
 }
예제 #15
0
 /// <summary>
 /// ExitDinerware
 /// </summary>
 /// <param name="theInfo"></param>
 public void exitDinerware(IDisplayActions.displayActionInfo theInfo)
 {
 }
예제 #16
0
 /// <summary>
 /// idle
 /// </summary>
 /// <param name="theInfo"></param>
 public void idle(IDisplayActions.displayActionInfo theInfo)
 {
 }
예제 #17
0
 /// <summary>
 /// itemQuantityPrice
 /// </summary>
 /// <param name="theInfo"></param>
 /// <param name="targetTicket"></param>
 /// <param name="targetItem"></param>
 public void itemQuantityPrice(IDisplayActions.displayActionInfo theInfo, Ticket targetTicket, MenuItem targetItem)
 {
 }