public void Init(TaskLogApplicationService service, string title, PeriodViewModel period, TaskSpecifyViewModel taskSpecify, ObservableCollection <TaskReportItemViewModel> targets) { this.service = service; this.TaskReports = targets; this.Title = title; Periods = new ObservableCollection <PeriodViewModel>(); Periods.Add(ItselfOrDefault <WholePeriodViewModel>(period)); Periods.Add(ItselfOrDefault <PartialPeriodViewModel>(period)); Periods.Add(ItselfOrDefault <DatePeriodViewModel>(period)); this.Period = period != null ? period : Periods[0]; TaskSpecifies = new ObservableCollection <TaskSpecifyViewModel>(); TaskSpecifies.Add(ItselfOrDefault <AllTaskSpecifyViewModel>(taskSpecify)); TaskSpecifies.Add(ItselfOrDefault <AllTaskSpecifyByKeywordViewModel>(taskSpecify)); TaskSpecifies.Add(ItselfOrDefault <IndividualTaskSpecifyViewModel>(taskSpecify)); this.TaskSpecify = taskSpecify != null ? taskSpecify :TaskSpecifies[0]; ReportCommand = new DelegateCommand( (_) => { var report = service.CreateReport(Period.Create(), TaskSpecify.Create(CreateTaskSearhMethods())); Update(report); }); AddRowCommand = new DelegateCommand( (_) => { TaskReports.Add(new TaskReportItemViewModel()); }); //Update(); }
public ReportTarget CreateModel() { return(new Business.Domain.Model.ReportTarget(Title, Period.Create(), TaskSpecify.Create(CreateTaskSearhMethods()))); }