public string AddTimeCard() { TimeCard newtimecard = new TimeCard(); TimeCardViewModel timecardVM = new TimeCardViewModel() { WorkedHours = 0 }; try { newtimecard.UpdateTimeCard(timecardVM); //{ WorkedHours=0}; //pr.TimeCard.Add(newTimeCard); //pr.Commit(); // _timecardRepository.Add(newtimecard); _unitOfWork.Commit(); return("New TimeCard added"); } catch (DbUpdateException ex) { return(ex.InnerException.Message); } catch (Exception ex) { LogError(ex); return("No Timecard added" + ex.ToString()); } }
private void InitTimeIntervalLine() { TimeIntervals = new ObservableCollection <UIElement>(); foreach (var classInterval in _timeLineMarkup.ClassesIntervals) { var tvm = new TimeCardViewModel(classInterval.Item); var tc = new TimeCard { DataContext = tvm }; Grid.SetRow(tc, TitleRowsCount + classInterval.Row); Grid.SetColumn(tc, classInterval.Column); Grid.SetRowSpan(tc, classInterval.RowSpan); Grid.SetColumnSpan(tc, classInterval.ColumnSpan); TimeIntervals.Add(tc); } }
private void InitTimeIntervalLine() { TimeIntervals = new ObservableCollection <UIElement>(); var i = 0; foreach (var classInterval in _timeLineMarkup.ClassesIntervals) { var tvm = new TimeCardViewModel(classInterval.Item); var tc = new TimeCard { DataContext = tvm }; Grid.SetRow(tc, TitleRowsCount + classInterval.Row); Grid.SetColumn(tc, classInterval.Column); Grid.SetRowSpan(tc, classInterval.RowSpan); Grid.SetColumnSpan(tc, classInterval.ColumnSpan); if ((++i) % ClassesPerDayMax == 0) { tc.Margin = new Thickness(0, 0, 0, DayMarginOffset); } TimeIntervals.Add(tc); } }
public TimeCardPage() { InitializeComponent(); _viewModel = new TimeCardViewModel(); DataContext = _viewModel; }
public static void UpdateTimeCard(this TimeCard timecard, TimeCardViewModel timecardVM) { timecard.WorkedHours = 0; }