private void btnPreview_Click(object sender, EventArgs e) { if (cboYearList.GetSelectedDataRow() is Years item) { ObligationRequestViewModel model = new ObligationRequestViewModel(); model.GenerateReport(item.Year.ToInt(), new StaticSettings().OfficeId, Win.Properties.Settings.Default.FundType); frmReportViewer frm = new frmReportViewer(new rptObligationRequests() { DataSource = new List <ObligationRequestViewModel>() { model } }); frm.ShowDialog(); } }
private void btnPreview_Click(object sender, EventArgs e) { if (cboYearList.GetSelectedDataRow() is Years item) { ObligationRequestViewModel model = new ObligationRequestViewModel(); model.GenerateReport(vm => { var user = new UnitOfWork().UsersRepo.Find(x => x.Id == User.UserId); vm.PreparedBy = user?.FullName; vm.PreparedByPos = user?.Position; }, item.Year.ToInt(), new StaticSettings().OfficeId, Win.Properties.Settings.Default.FundType); frmReportViewer frm = new frmReportViewer(new rptDetailedObligationRequests() { DataSource = new List <ObligationRequestViewModel>() { model } }); frm.ShowDialog(); } }