Пример #1
0
        public void AllowToDoAction(User actionOwner)
        {
            if(actionOwner.UserName!=this.UserName)
                throw new Exception("User Cant do the action");

            
        }
Пример #2
0
        public WorkingMeeting(string subject,
                                    DateTime startDate,
                                    int duration,
                                    string description,
                                    Location location, string attendeesName, string agenda, Guid syncId, AppType appType, User creator)
            : base(subject, startDate, duration, description, location, attendeesName, agenda, syncId, appType, creator)
        {

        }
Пример #3
0
 public IEnumerable<Meeting> GetMeetinginDuration(DateTime startDate, int duration, User creatorUser)
 {
     var queryStartDate = startDate;
     var queryEndDate = queryStartDate.AddHours(duration);
     return ctx.Meetings.Where(
         m => m.ActionType != EntityActionType.Delete &&
              m.CreatorUser.UserName == creatorUser.UserName &&
              (
                  (queryStartDate <= m.StartDate && m.StartDate <= queryEndDate) ||
                  (queryStartDate <= DbFunctions.AddHours(m.StartDate, m.Duration) && DbFunctions.AddHours(m.StartDate, m.Duration) <= queryEndDate)
              )
         );
 }
Пример #4
0
 protected Meeting(string subject,
     DateTime startDate,
     int duration,
     string description,
     Location location, string attendeesName, string agenda, Guid syncId, AppType appType, User creator)
     : base(syncId, appType)
 {
     CreatorUser = creator;
     State = MeetingState.Scheduled;
     SetMeetingDateTime(startDate, duration);
     setProperties(subject, description,
         location, attendeesName, agenda);
     AddMeetingHistory(StateCode,MeetingOperationEnum.Create);
     SetInitializedState(appType);
     
 }
Пример #5
0
 public void Delete(User user)
 {
     ctx.Users.Remove(user);
     ctx.SaveChanges();
 }
Пример #6
0
 public void Update(User user)
 {
     ctx.SaveChanges();
 }
Пример #7
0
 public void Create(User user)
 {
     ctx.Users.Add(user);
     ctx.SaveChanges();
 }
Пример #8
0
 public virtual void Delete(AppType appType, User actionOwner)
 {
     CreatorUser.AllowToDoAction(actionOwner);
     var currentState = this.StateCode;
     base.Delete(appType);
     AddMeetingHistory(currentState,MeetingOperationEnum.Delete);
 }
Пример #9
0
 public virtual void Update(string subject, DateTime startDate, int duration, string description,
     Location location, string attendeesName, string agenda, AppType appType, User actionOwner)
 {
     CreatorUser.AllowToDoAction(actionOwner);
     var currentState = this.StateCode;
     Transfer(actionOwner,startDate, duration);
     setProperties(subject,description,
         location, attendeesName, agenda);
     SyncByUpdate(appType);
     AddMeetingHistory(currentState,MeetingOperationEnum.Modify);
 }
Пример #10
0
 public void Transfer(User actionOwner, DateTime startDate, int duration)
 {
     if (!IsMeetingDateTimeChanged(startDate, duration)) return;
     CreatorUser.AllowToDoAction(actionOwner);
     var currentState = this.StateCode;
     State.Transfer(this,startDate,duration);
     AddMeetingHistory(currentState,MeetingOperationEnum.Transfer);
 }
Пример #11
0
 public void Revert(User actionOwner, AppType appType)
 {
     CreatorUser.AllowToDoAction(actionOwner);
     var currentState = this.StateCode;
     State.Revert(this);
     AddMeetingHistory(currentState,MeetingOperationEnum.Revert);
     SyncByUpdate(appType);
 }
Пример #12
0
 public void UpdateDuringMeeting(string decisions, string details, User actionOwner)
 {
     this.CreatorUser.AllowToDoAction(actionOwner);
     Decisions = decisions;
     Details = details;
 }
Пример #13
0
 public void Update(string subject, DateTime startDate, int duration, string description,
     string attendeesName, Location location, string agenda, AppType appType, User actionOwner)
 {
     base.Update(subject, startDate, duration, description, location, attendeesName, agenda, appType, actionOwner);
 }
Пример #14
0
 public void CreateUser(string userName)
 {
     var user=new User(userName);
     userRepository.Create(user);
 }