Exemplo n.º 1
0
        public void ConvertTo(WorkDoneView workDoneView, WorkDone workDone)
        {
            int?timeSpentHours   = workDoneView.TimeSpentHours == null ? 0 : workDoneView.TimeSpentHours;
            int?timeSpentMinutes = workDoneView.TimeSpentMinutes == null ? 0 : workDoneView.TimeSpentMinutes;

            workDone.WorkDonePK      = workDoneView.WorkDonePK;
            workDone.ToDoListFK      = workDoneView.ToDoListFK;
            workDone.LegalEntityFK   = workDoneView.LegalEntityFK;
            workDone.Date            = workDoneView.Date;
            workDone.WorkTypeFK      = workDoneView.WorkTypeFK;
            workDone.WorkSubtypeFK   = workDoneView.WorkSubtypeFK;
            workDone.ServiceTypeFK   = workDoneView.ServiceTypeFK;
            workDone.Description     = workDoneView.Description;
            workDone.Comment         = workDoneView.Comment;
            workDone.TimeSpent       = timeSpentHours * 60 + timeSpentMinutes;
            workDone.CreatedWithToDo = workDoneView.CreatedWithToDo;
            workDone.Deleted         = workDoneView.Deleted;
        }
Exemplo n.º 2
0
        public void ConvertFrom(WorkDone workDone, WorkDoneView workDoneView)
        {
            int timeSpentHours   = workDone.TimeSpent == null ? 0 : (int)workDone.TimeSpent / 60;
            int timeSpentMinutes = (workDone.TimeSpent == null ? 0 : (int)workDone.TimeSpent) - (timeSpentHours * 60);

            workDoneView.WorkDonePK       = workDone.WorkDonePK;
            workDoneView.ToDoListFK       = workDone.ToDoListFK;
            workDoneView.LegalEntityFK    = workDone.LegalEntityFK;
            workDoneView.Date             = workDone.Date;
            workDoneView.WorkTypeFK       = workDone.WorkTypeFK;
            workDoneView.WorkSubtypeFK    = workDone.WorkSubtypeFK;
            workDoneView.ServiceTypeFK    = workDone.ServiceTypeFK;
            workDoneView.Description      = workDone.Description;
            workDoneView.Comment          = workDone.Comment;
            workDoneView.UserFK           = workDone.UserFK;
            workDoneView.CreationDate     = workDone.CreationDate;
            workDoneView.TimeSpentHours   = timeSpentHours;
            workDoneView.TimeSpentMinutes = timeSpentMinutes;
            workDoneView.CreatedWithToDo  = workDone.CreatedWithToDo;
            workDoneView.Deleted          = workDone.Deleted;
        }