/// <summary> /// Update the SB collection with the new card /// </summary> protected void UpdateSBCollection() { try { WriteLogEntry("UpdateSBCollection", _NavigationState.SB_Card.CardNumber + ":Start"); // to prevent changing page from the address bar without filling the card info if (_NavigationState.SB_Card.CreditValue == 0 && _NavigationState.SB_Card.SB_Tickets.Count == 0) { StartNavigation(); } if (_NavigationState.LoggedInUserGUID != Guid.Empty) { _NavigationState.SB_ShoppingBasket.Contact_ID = _NavigationState.Contact.Contact_ID; } SBManager mng = new SBManager(); //to set the total and sub-total values mng.CalculateCardTotals(_NavigationState.SB_Card); int oldSBID = _NavigationState.SB_ShoppingBasket.SB_ShoppingBasket_Id; mng.UpdateShoppingBasket(_NavigationState.SB_ShoppingBasket); _NavigationState.SB_ShoppingBasket.SessionID = HttpContext.Current.Session.SessionID; _NavigationState.SB_ShoppingBasket.SB_Cards.Add(_NavigationState.SB_Card); //_NavigationState.SB_Card.SB_ShoppingBasket = _NavigationState.SB_ShoppingBasket; //handle if the card already exists on SB if (_NavigationState.ReplaceCard != null) { mng.RemoveSBCard(_NavigationState.ReplaceCard); _NavigationState.SB_ShoppingBasket.SB_Cards.Remove(_NavigationState.ReplaceCard); } mng.SaveSB(); //if user is anonymous then set the shopping basket id to a cookie if (!HttpContext.Current.User.Identity.IsAuthenticated) { mng.SetSB4AnonymousUser(_NavigationState.SB_ShoppingBasket); } SessionManager.Set <SB_ShoppingBasket>(enumSessionKeys.ShoppingBasket, _NavigationState.SB_ShoppingBasket); NavigationState.ScenarioCompleted = true; WriteLogEntry("UpdateSBCollection", _NavigationState.SB_Card.CardNumber + ":Completed"); } catch (Exception ex) { if (!ExceptionHandler.IsUserFriendly(ex)) { ex.Data.Add("ClassName", "NavBase"); ex.Data.Add("MethodName", "UpdateSBCollection"); ExceptionHandler.LogException(ex); } else { throw ex; } } }
/// <summary> /// Update the SB collection with the new card /// </summary> protected void UpdateSBCollection() { try { WriteLogEntry("UpdateSBCollection", _NavigationState.SB_Card.CardNumber + ":Start"); // to prevent changing page from the address bar without filling the card info if (_NavigationState.SB_Card.CreditValue == 0 && _NavigationState.SB_Card.SB_Tickets.Count == 0) { StartNavigation(); } if (_NavigationState.LoggedInUserGUID != Guid.Empty) _NavigationState.SB_ShoppingBasket.Contact_ID = _NavigationState.Contact.Contact_ID; SBManager mng = new SBManager(); //to set the total and sub-total values mng.CalculateCardTotals(_NavigationState.SB_Card); int oldSBID = _NavigationState.SB_ShoppingBasket.SB_ShoppingBasket_Id; mng.UpdateShoppingBasket(_NavigationState.SB_ShoppingBasket); _NavigationState.SB_ShoppingBasket.SessionID = HttpContext.Current.Session.SessionID; _NavigationState.SB_ShoppingBasket.SB_Cards.Add(_NavigationState.SB_Card); //_NavigationState.SB_Card.SB_ShoppingBasket = _NavigationState.SB_ShoppingBasket; //handle if the card already exists on SB if (_NavigationState.ReplaceCard != null) { mng.RemoveSBCard(_NavigationState.ReplaceCard); _NavigationState.SB_ShoppingBasket.SB_Cards.Remove(_NavigationState.ReplaceCard); } mng.SaveSB(); //if user is anonymous then set the shopping basket id to a cookie if (!HttpContext.Current.User.Identity.IsAuthenticated) { mng.SetSB4AnonymousUser(_NavigationState.SB_ShoppingBasket); } SessionManager.Set<SB_ShoppingBasket>(enumSessionKeys.ShoppingBasket, _NavigationState.SB_ShoppingBasket); NavigationState.ScenarioCompleted = true; WriteLogEntry("UpdateSBCollection", _NavigationState.SB_Card.CardNumber + ":Completed"); } catch (Exception ex) { if (!ExceptionHandler.IsUserFriendly(ex)) { ex.Data.Add("ClassName", "NavBase"); ex.Data.Add("MethodName", "UpdateSBCollection"); ExceptionHandler.LogException(ex); } else { throw ex; } } }