Example #1
0
        public StudyRoom(Tutor tutor, User user, string onlineDocumentUrl)
        {
            _users = new[]
            {
                new StudyRoomUser(tutor.User, this),
                new StudyRoomUser(user, this)
            };
            Tutor             = tutor;
            Identifier        = ChatRoom.BuildChatRoomIdentifier(new[] { tutor.Id, user.Id });
            OnlineDocumentUrl = onlineDocumentUrl;
            Type     = StudyRoomType.PeerToPeer;
            DateTime = new DomainTimeStamp();



            AddEvent(new StudyRoomCreatedEvent(this));
        }
Example #2
0
        public virtual void UseToken(Tutor tutor)
        {
            Country country = Country;

            if (country != Entities.Country.UnitedStates)
            {
                return;
            }

            var userToken = UserTokens.FirstOrDefault(w => w.State == UserTokenState.NotUsed);

            if (userToken != null)
            {
                userToken.State = UserTokenState.Used;
            }

            UseCoupon(tutor);
        }
Example #3
0
        internal TutorReview(string review, float rate, User user, Tutor tutor /*, StudyRoom room*/)
        {
            if (rate <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(rate));
            }
            if (!string.IsNullOrEmpty(review))
            {
                Review = review;
            }
            Rate     = rate;
            User     = user;
            Tutor    = tutor;
            DateTime = DateTime.UtcNow;

            //on tutor it will work but the commit will come after so the review count will f****d up
            AddEvent(new TutorAddReviewEvent(tutor.Id));
        }
Example #4
0
        public Coupon([NotNull] string code, CouponType couponType, Tutor tutor, decimal value,
                      int?amountOfUsers, int amountOfUsePerUser, DateTime?expiration, string description, string owner)
        {
            if (value <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }
            if (amountOfUsers.HasValue && amountOfUsers.Value <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }
            if (couponType == CouponType.Percentage && value > 100)
            {
                throw new ArgumentException("value cannot be more than 100");
            }

            if (code is null)
            {
                throw new ArgumentNullException(nameof(code));
            }
            if (!code.Length.IsBetween(MinimumLength, MaxLength))
            {
                throw new ArgumentOutOfRangeException(nameof(code));
            }

            Code = code;

            CouponType         = couponType;
            Tutor              = tutor;
            Value              = value;
            AmountOfUsers      = amountOfUsers;
            AmountOfUsePerUser = amountOfUsePerUser;
            Expiration         = expiration;
            Description        = description;
            Owner              = owner;
            CreateTime         = DateTime.UtcNow;
        }
Example #5
0
 public TutorCalendar(GoogleCalendar calendar, Tutor tutor)
 {
     Calendar = calendar;
     Tutor    = tutor;
 }
Example #6
0
 public TutorHours(Tutor tutor, TutorAvailabilitySlot availabilitySlot)
 {
     Tutor            = tutor;
     AvailabilitySlot = availabilitySlot;
     CreateTime       = DateTime.UtcNow;
 }
Example #7
0
 public AdminTutor(Tutor tutor)
 {
     Tutor = tutor;
 }