コード例 #1
0
ファイル: StudyRoom.cs プロジェクト: weedkiller/Spitball
        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));
        }
コード例 #2
0
ファイル: User.cs プロジェクト: weedkiller/Spitball
        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);
        }
コード例 #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));
        }
コード例 #4
0
ファイル: Coupon.cs プロジェクト: weedkiller/Spitball
        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;
        }
コード例 #5
0
ファイル: TutorCalendar.cs プロジェクト: weedkiller/Spitball
 public TutorCalendar(GoogleCalendar calendar, Tutor tutor)
 {
     Calendar = calendar;
     Tutor    = tutor;
 }
コード例 #6
0
ファイル: TutorHours.cs プロジェクト: weedkiller/Spitball
 public TutorHours(Tutor tutor, TutorAvailabilitySlot availabilitySlot)
 {
     Tutor            = tutor;
     AvailabilitySlot = availabilitySlot;
     CreateTime       = DateTime.UtcNow;
 }
コード例 #7
0
ファイル: AdminTutor.cs プロジェクト: weedkiller/Spitball
 public AdminTutor(Tutor tutor)
 {
     Tutor = tutor;
 }