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 static TaskSpecifyViewModel Create(TaskSpecify taskSpecify) { if (taskSpecify is AllTaskSpecify) { if (((AllTaskSpecify)taskSpecify).HasTaskSearchMethod()) { var search = ((AllTaskSpecify)taskSpecify).TaskSearchMethod; return(new AllTaskSpecifyByKeywordViewModel(search.TaskKeyword, search.SearchMethod)); } else { return(new AllTaskSpecifyViewModel()); } } if (taskSpecify is IndividualTaskSpecify) { return(new IndividualTaskSpecifyViewModel()); } return(new AllTaskSpecifyViewModel()); }
//public TaskReport CreateReportForAllTask(Period period) //{ // var logs = taskLogRepository.FindWithinPeriod(period); // return logs.CreateReport(); //} //public TaskReport CreateReport(Period period, List<TaskSearchMethod> targets) //{ // var logs = taskLogRepository.FindWithinPeriod(period); // return logs.CreateReport(targets); //} public TaskReport CreateReport(Period period, TaskSpecify taskSpecify) { var logs = taskLogRepository.FindWithinPeriod(period); return(logs.CreateReport(taskSpecify.CreateTaskSearchMethods(logs))); }
public ReportTarget CreateModel() { return(new Business.Domain.Model.ReportTarget(Title, Period.Create(), TaskSpecify.Create(CreateTaskSearhMethods()))); }