示例#1
0
        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());
            }
        }
示例#2
0
 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);
     }
 }
示例#3
0
        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;
 }
示例#5
0
 public static void UpdateTimeCard(this TimeCard timecard, TimeCardViewModel timecardVM)
 {
     timecard.WorkedHours = 0;
 }