Exemplo n.º 1
0
        public static void UpdateSourceToBasket(bool isAffiliate = false, bool isUpgradeFlow = false)
        {
            //Update source, dealer number, dealer name in basket to display in confirmation pdf
            var basketId       = isUpgradeFlow ? BasketHelper.GetUpgradeBasketId() : BasketHelper.GetBasketId();
            var loggedUserData = LoggedUser;

            if (loggedUserData != null && IsDealerOrAgent)
            {
                var source      = string.Empty;
                var dealerId    = new Guid();
                var createdBy   = loggedUserData.Name;
                var createdName = loggedUserData.Name + " " + loggedUserData.Name;

                if (IsDealer)
                {
                    source = "Dealer";
                    var company = Configuration.ConfigurationHelper.**WsConfig.Company;
                    if (company != Company.TVVLAANDEREN && company != Company.TELESAT)
                    {
                        dealerId = GetDealerId(createdBy);
                    }
                    // This is only required for HDAustria for now. As we are yet to map the dealers to correct groups in TVV/TSAT for campaigns.
                }
                else if (IsAgent)
                {
                    source = "Agent";
                }

                if (dealerId == new Guid())
                {
                    dealerId = BasketHelper.GetDefaultDealerId();
                }

                var updateBasketInfo = new CreateBasketDTO
                {
                    BasketId    = basketId,
                    Source      = source,
                    CreatedBy   = createdBy,
                    CreatedName = (isAffiliate ? "Affiliate-" : string.Empty) + createdName,
                    DealerId    = dealerId
                };
                **.ServiceBus.Extern.Basket.GetService().UpdateSourceToBasket(updateBasketInfo);
            }
        }