Пример #1
0
        public async Task <LoggedUserModel> SyncUserProfile()
        {
            var cr = User.SupplierNumber();

            if (!string.IsNullOrEmpty(cr))
            {
                List <string> CRs = new List <string>();
                CRs.Add(User.SupplierNumber());

                var isSubscription = _rootConfiguration.isSubscriptionConfiguration.isSubscription;
                var CrsList        = new List <SubscriptionModel>();
                if (isSubscription)
                {
                    CrsList = await _subscriptionService.GetCRsSubscriptionStatuses(CRs);
                }
                else
                {
                    CrsList.Add(new SubscriptionModel {
                        IsSubscribed = true, SubscriptionURL = "", IsRenewal = true, CR = User.SupplierNumber()
                    });
                }
                if (CrsList != null && CrsList.Count > 0)
                {
                    bool   isSubscribed    = CrsList.FirstOrDefault().IsSubscribed;
                    string subscirpeUrl    = CrsList.FirstOrDefault().SubscriptionURL;
                    var    loggedUserModel = await _iDMAppService.SyncUserInfo(User.UserId(), User.UserName(), User.FullName(), User.Mobile(), User.Email(), User.SupplierNumber(), User.SupplierName(), User.SupplierAgency(), User.UserRoles(), User.UserRelatedAgencyCode(), User.VROUserRoles());

                    loggedUserModel.IsSubscripe  = isSubscribed;
                    loggedUserModel.SubscirpeUrl = subscirpeUrl;
                    return(loggedUserModel);
                }
                else
                {
                    return(await _iDMAppService.SyncUserInfo(User.UserId(), User.UserName(), User.FullName(), User.Mobile(), User.Email(), User.SupplierNumber(), User.SupplierName(), User.SupplierAgency(), User.UserRoles(), User.UserRelatedAgencyCode(), User.VROUserRoles()));
                }
            }
            else
            {
                return(await _iDMAppService.SyncUserInfo(User.UserId(), User.UserName(), User.FullName(), User.Mobile(), User.Email(), User.SupplierNumber(), User.SupplierName(), User.SupplierAgency(), User.UserRoles(), User.UserRelatedAgencyCode(), User.VROUserRoles()));
            }
        }