// Use this for initialization
 void Start()
 {
     if (synchronizer)
     {
         sc = synchronizer.GetComponent <SyncStrategy> ();
     }
 }
예제 #2
0
 public Activity Pause()
 {
     CurrentActivity.Status = ActivityStatus.InPause;
     CurrentActivity.End    = AcmanHelper.GetCurrentDateTime();
     Repository.Edit(CurrentActivity);
     SyncStrategy.SyncAcmanActivity(CurrentActivity);
     return(CurrentActivity);
 }
예제 #3
0
        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);
        }
예제 #4
0
 public Activity Stop()
 {
     if (CurrentActivity == null)
     {
         return(null);
     }
     CurrentActivity.Status = ActivityStatus.Done;
     CurrentActivity.End    = AcmanHelper.GetCurrentDateTime();
     Repository.Edit(CurrentActivity);
     SyncStrategy.SyncAcmanActivity(CurrentActivity);
     return(CurrentActivity);
 }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }