public void AllowToDoAction(User actionOwner) { if(actionOwner.UserName!=this.UserName) throw new Exception("User Cant do the action"); }
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) { }
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) ) ); }
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); }
public void Delete(User user) { ctx.Users.Remove(user); ctx.SaveChanges(); }
public void Update(User user) { ctx.SaveChanges(); }
public void Create(User user) { ctx.Users.Add(user); ctx.SaveChanges(); }
public virtual void Delete(AppType appType, User actionOwner) { CreatorUser.AllowToDoAction(actionOwner); var currentState = this.StateCode; base.Delete(appType); AddMeetingHistory(currentState,MeetingOperationEnum.Delete); }
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); }
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); }
public void Revert(User actionOwner, AppType appType) { CreatorUser.AllowToDoAction(actionOwner); var currentState = this.StateCode; State.Revert(this); AddMeetingHistory(currentState,MeetingOperationEnum.Revert); SyncByUpdate(appType); }
public void UpdateDuringMeeting(string decisions, string details, User actionOwner) { this.CreatorUser.AllowToDoAction(actionOwner); Decisions = decisions; Details = details; }
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); }
public void CreateUser(string userName) { var user=new User(userName); userRepository.Create(user); }