Ejemplo n.º 1
0
        public SubscriptionList SyncPurchaseOrder(string userId)
        {
            UserSubscriptionLogic   userSubLogic = new UserSubscriptionLogic();
            List <UserSubscription> subsList     = new List <UserSubscription>();
            PurchaseOrderLogic      logic        = new PurchaseOrderLogic();
            SubscriptionList        userSsubList = new SubscriptionList();

            userSubLogic.UserManager = UserManager;
            userSubLogic.RoleManager = RoleManager;

            userSsubList.UserId = userId;
            var poList = logic.GetPOToBeSynchedByUser(userId);

            foreach (var poItem in poList)
            {
                foreach (var item in poItem.OrderItems)
                {
                    UserSubscription usersubs = new UserSubscription()
                    {
                        UserId             = userId,
                        SubscriptionTypeId = item.SubscriptionId,
                        ActivationDate     = DateTime.Now.Date,
                        Quantity           = item.Quantity
                    };
                    subsList.Add(usersubs);
                }
                var dataList = userSubLogic.CreateUserSubscriptionList(subsList, userId);
                poItem.IsSynched = true;
                logic.UpdatePurchaseOrder(poItem.Id, poItem);
                userSsubList.Subscriptions.AddRange(dataList.Subscriptions);
            }
            return(userSsubList);
        }
 public UserLicenseRequestTest()
 {
     InitializerClass.Initialize();
     useSubLogic = new UserSubscriptionLogic();
     userLogic   = new UserLogic();
     reqLogic    = new UserLicenseRequestLogic();
 }
Ejemplo n.º 3
0
 public UserSubscriptionLogicTest()
 {
     InitializerClass.Initialize();
     logic        = new UserSubscriptionLogic();
     userLogic    = new UserLogic();
     subTypelogic = new SubscriptionTypeLogic();
     usr          = userLogic.GetUserByEmail("*****@*****.**");
 }
Ejemplo n.º 4
0
        public LicenseLogicTest()
        {
            InitializerClass.Initialize();

            licLogic    = new Logic.DataLogic.LicenseLogic();
            userLogic   = new UserLogic();
            useSubLogic = new UserSubscriptionLogic();

            user = userLogic.GetUserByEmail("*****@*****.**");
            sub  = useSubLogic.GetSubscription(user.UserId).First();
        }
Ejemplo n.º 5
0
        public UserLicenseLogicTest()
        {
            InitializerClass.Initialize();

            userLicLogic = new UserLicenseLogic();
            userLogic    = new UserLogic();
            licLogic     = new Logic.ServiceLogic.LicenseLogic();
            userLicLogic = new UserLicenseLogic();
            subLogic     = new UserSubscriptionLogic();
            AdminUser    = userLogic.GetUserByEmail("*****@*****.**");
            TeamMember   = userLogic.GetUserByEmail("*****@*****.**");
            Sub          = subLogic.GetSubscription(AdminUser.UserId).First();
            LicenseList  = licLogic.GetLicenseList(Sub.Id);
        }
Ejemplo n.º 6
0
        public SubscriptionList OnlinePayment(string userId)
        {
            List <UserSubscription> subsList = new List <UserSubscription>();
            CartLogic cartLogic = new CartLogic()
            {
                UserManager = UserManager,
                RoleManager = RoleManager
            };
            UserSubscriptionLogic userSubLogic = new UserSubscriptionLogic()
            {
                UserManager = UserManager,
                RoleManager = RoleManager
            };
            var cartItems = cartLogic.GetCartItems(userId);

            if (cartItems.Count > 0)
            {
                foreach (CartItem item in cartItems)
                {
                    UserSubscription usersubs = new UserSubscription()
                    {
                        UserId             = userId,
                        SubscriptionTypeId = item.SubscriptionTypeId,
                        ActivationDate     = DateTime.Now.Date,
                        Quantity           = item.Quantity
                    };
                    usersubs.ExpireDate = usersubs.ActivationDate.AddDays(item.SubType.ActiveDays).Date;
                    subsList.Add(usersubs);
                }
                var dataList = userSubLogic.CreateUserSubscriptionList(subsList, userId);
                foreach (var item in cartItems)
                {
                    item.IsPurchased = true;
                    cartLogic.UpdateCartItem(item);
                }
                return(dataList);
            }
            else
            {
                ErrorMessage = cartLogic.ErrorMessage;
                return(null);
            }
        }
 public UserSubscriptionController()
 {
     logic = new UserSubscriptionLogic();
 }
 public UserSubscriptionLogicTest()
 {
     InitializerClass.Initialize();
     useSubLogic = new UserSubscriptionLogic();
     userLogic   = new UserLogic();
 }
 public UserSubscriptionBO()
 {
     userSubLogic = new UserSubscriptionLogic();
 }