Пример #1
0
        private void UpdateEntry(int raw, PtoWeekEntry entry)
        {
            var diff = entry.CalculateSimpleDiff();

            if (entry.Start == null && raw > 0)
            {
                var when = Data.GetDateFor(entry.Dow, this.dtpSelectedDate.Value);
                entry.Start = new TimeEntry()
                {
                    Id    = -1,
                    What  = TimeEntryEvent.StartOfDay,
                    When  = when,
                    IsPto = true,
                };
            }
            if (entry.End == null && raw > 0)
            {
                var when = Data.GetDateFor(entry.Dow, this.dtpSelectedDate.Value).AddMinutes(diff);
                entry.End = new TimeEntry()
                {
                    Id    = -1,
                    What  = TimeEntryEvent.EndOfDay,
                    When  = when,
                    IsPto = true,
                };
            }
            if (raw != diff)
            {
                entry.SetNewEnd(raw);
            }
        }
Пример #2
0
 private static void _UpsertPto(Data data, PtoWeekEntry entry)
 {
     if (entry.Start != null)
     {
         _UpsertPtoPart(data, entry.Start);
     }
     if (entry.End != null)
     {
         _UpsertPtoPart(data, entry.End);
     }
 }
Пример #3
0
        private void TimeOfDayHandler(PtoWeekEntry day, TimeEntry time)
        {
            switch (time.What)
            {
            case TimeEntryEvent.StartOfDay:
                day.Start = time;
                break;

            case TimeEntryEvent.EndOfDay:
                day.End = time;
                break;
            }
        }