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);
            }
        }
Exemplo n.º 2
0
        public static Guid GetDealerId(string dealerName)
        {
            if (!IsDealerOrAgent)
            {
                return(BasketHelper.GetDefaultDealerId());
            }

            //UserName is IBS Number. This should be the external billing id for the dealers in **Standing.
            var dealerInfo = **.ServiceBus.Extern.Dealer.GetService().GetDealerByCmsIdOrName(dealerName);

            //It says CMSID but the code looks for BillingSystemID.
            if (dealerInfo.Result.IsNotSuccess)
            {
                // var message = string.Format("SecurityHelper.GetDealerId - can't find dealer with name: {0}", dealerName);
                return(BasketHelper.GetDefaultDealerId());
            }

            return(dealerInfo.Id);
        }