// Use this for initialization void Start() { if (synchronizer) { sc = synchronizer.GetComponent <SyncStrategy> (); } }
public Activity Pause() { CurrentActivity.Status = ActivityStatus.InPause; CurrentActivity.End = AcmanHelper.GetCurrentDateTime(); Repository.Edit(CurrentActivity); SyncStrategy.SyncAcmanActivity(CurrentActivity); return(CurrentActivity); }
public override Guid Add([FromBody] Activity entity) { if (entity.User == null && entity.UserId == Guid.Empty) { entity.UserId = CurrentConnection.CurrentUser.Id; } var id = Repository.Add(entity); SyncStrategy.SyncAcmanActivity(entity); return(id); }
public Activity Stop() { if (CurrentActivity == null) { return(null); } CurrentActivity.Status = ActivityStatus.Done; CurrentActivity.End = AcmanHelper.GetCurrentDateTime(); Repository.Edit(CurrentActivity); SyncStrategy.SyncAcmanActivity(CurrentActivity); return(CurrentActivity); }
public Activity StopById(Guid id) { var activity = Repository.Get(id); activity.Status = ActivityStatus.Done; activity.End = AcmanHelper.GetCurrentDateTime(); if (activity.Start == null) { activity.Start = activity.End; } Repository.Edit(activity); SyncStrategy.SyncAcmanActivity(activity); return(activity); }
public Activity ContinueById(Guid id) { ICollection <Activity> activities = Repository.GetByStatus(ActivityStatus.InProgress); Activity activity = Repository.Get(id); activity.Status = ActivityStatus.InProgress; if (activity.Start == null || activity.Start > AcmanHelper.GetCurrentDateTime()) { activity.Start = AcmanHelper.GetCurrentDateTime(); } activities.ToList().ForEach(a => a.Status = ActivityStatus.InPause); activities.Add(activity); Repository.Edit(activities); SyncStrategy.SyncAcmanActivity(activities); return(activity); }