예제 #1
0
 public void TransferMoneyToAurora(Wallet fromWallet, AuroraWallet toAuroraWallet, float amount)
 {
     if (amount <= fromWallet.Value)
     {
         fromWallet.SubMoney(amount, fromWallet.ID);
         toAuroraWallet.AddMoney(amount, toAuroraWallet.ID);
     }
 }
예제 #2
0
 public void RecieveMoneyFromAurora(AuroraWallet fromAuroraWallet, Wallet toWallet, float amount)
 {
     if (amount <= fromAuroraWallet.Balance)
     {
         fromAuroraWallet.SubMoney(amount, fromAuroraWallet.ID);
         toWallet.AddMoney(amount, toWallet.ID);
     }
 }
예제 #3
0
        public static Auction CreateAuction(AuctionFormViewModel viewModel, Gig gig, AuroraWallet auroraWallet)
        {
            gig.User.TransferMoneyToAurora(gig.User.Wallet, auroraWallet, viewModel.Bet);

            var auction = new Auction(viewModel, gig.SpecificIndustryID);

            return(auction);
        }
예제 #4
0
        public void Modify(InfluencerDto influencerDto, Influencer oldInfluencer, AuroraWallet auroraWallet)
        {
            if (oldInfluencer.MembershipTypeID != influencerDto.MembershipTypeID)
            {
                MembershipType.ModifyMembershipType(oldInfluencer.User, oldInfluencer.MembershipTypeID, influencerDto.MembershipTypeID, auroraWallet);
            }

            AboutTheInfluencer  = influencerDto.AboutTheInfluencer;
            AudienceAge         = influencerDto.AudienceAge;
            AudienceMainCountry = influencerDto.AudienceMainCountry;
            AudienceMainState   = influencerDto.AudienceMainState;
            AudienceMainTrait   = influencerDto.AudienceMainTrait;
            Exposure            = influencerDto.Exposure;
            MainLanguage        = influencerDto.MainLanguage;
            MainTopic           = influencerDto.MainTopic;
            MembershipTypeID    = influencerDto.MembershipTypeID;
            MainPlatform        = influencerDto.MainPlatform;
        }
예제 #5
0
        public void SellPackage(ApplicationUser buyerUser, ApplicationUser sellerUser, AuroraWallet toAuroraWallet)
        {
            var auroraMortage = Price * 0.05f;
            var clearPrice    = Price - auroraMortage;

            buyerUser.TransferMoneyToAurora(buyerUser.Wallet, toAuroraWallet, auroraMortage);
            buyerUser.TransferMoneyToUser(buyerUser.Wallet, sellerUser.Wallet, clearPrice);

            var purchaseNotification = Notification.GigPurchased(this, sellerUser.UserFullName);
            var soldNotification     = Notification.GigSold(this, buyerUser.UserFullName);

            buyerUser.Notify(purchaseNotification);
            sellerUser.Notify(soldNotification);
        }
예제 #6
0
        public static void ModifyMembershipType(ApplicationUser user, int oldMembershipTypeID, int newMembershipTypeID, AuroraWallet auroraWallet)
        {
            var pricePerDay    = 0.0f;
            var durationInDays = 0;
            var discount       = 0.0f;

            switch (oldMembershipTypeID)
            {
            case 1:
                pricePerDay    = 1.5f;
                durationInDays = 30;
                discount       = 0;
                break;

            case 2:
                if (newMembershipTypeID < 2)
                {
                    pricePerDay    = 0.55f;
                    durationInDays = 90;
                    discount       = 10;
                }
                else
                {
                    pricePerDay    = 0.55f;
                    durationInDays = 90;
                    discount       = 0;
                }
                break;

            case 3:
                if (newMembershipTypeID < 3)
                {
                    pricePerDay    = 0.52f;
                    durationInDays = 365;
                    discount       = 15;
                }
                else
                {
                    pricePerDay    = 0.52f;
                    durationInDays = 365;
                    discount       = 0;
                }
                break;

            case 4:
                if (newMembershipTypeID < 4)
                {
                    pricePerDay    = 1.37f;
                    durationInDays = 365;
                    discount       = 20;
                }
                else
                {
                    pricePerDay    = 1.37f;
                    durationInDays = 365;
                    discount       = 0;
                }
                break;

            default:
                pricePerDay = 0;
                break;
            }
            //ALGORYTHM FOR THE PAYMENT
            float payment = pricePerDay * durationInDays - (pricePerDay * durationInDays * discount) / 100;

            //DEPOSIT ANY MONEY LEFT BASED ON THE DURATION
            user.RecieveMoneyFromAurora(auroraWallet, user.Wallet, payment);

            //BY THE NEW MEMBERSHIP TYPE
            SellMembershipType(user, newMembershipTypeID, auroraWallet);
        }
예제 #7
0
        public static void SellMembershipType(ApplicationUser user, int membershipTypeID, AuroraWallet auroraWallet)
        {
            var payment = 0.0f;

            switch (membershipTypeID)
            {
            case 1:
                payment = 20.00f;
                break;

            case 2:
                payment = 50.00f;
                break;

            case 3:
                payment = 190.00f;
                break;

            case 4:
                payment = 500.00f;
                break;

            default:
                payment = 0.0f;
                break;
            }
            user.TransferMoneyToAurora(user.Wallet, auroraWallet, payment);
        }
예제 #8
0
        public void Modify(InfluencerFormViewModel updatedViewModel, Influencer oldInfluencer, AuroraWallet auroraWallet)
        {
            if (oldInfluencer.MembershipTypeID != updatedViewModel.MembershipTypeID)
            {
                MembershipType.ModifyMembershipType(oldInfluencer.User, oldInfluencer.MembershipTypeID, updatedViewModel.MembershipTypeID, auroraWallet);
            }

            AboutTheInfluencer  = updatedViewModel.AboutTheInfluencer;
            AudienceAge         = updatedViewModel.AudienceAge;
            AudienceMainCountry = updatedViewModel.AudienceMainCountry;
            AudienceMainState   = updatedViewModel.AudienceMainState;
            AudienceMainTrait   = updatedViewModel.AudienceMainTrait;
            Exposure            = updatedViewModel.Exposure;
            MainLanguage        = updatedViewModel.MainLanguage;
            MainTopic           = updatedViewModel.MainTopic;
            MembershipTypeID    = updatedViewModel.MembershipTypeID;
            MainPlatform        = updatedViewModel.MainPlatform;
        }
예제 #9
0
        public static Influencer CreateInflunecerWithPayment(InfluencerFormViewModel viewModel, ApplicationUser user, AuroraWallet auroraWallet)
        {
            var influencer = new Influencer(viewModel, user);

            user.Influencer = influencer;

            MembershipType.SellMembershipType(user, viewModel.MembershipTypeID, auroraWallet);

            return(influencer);
        }