public PhysicalPerson_ReportWindow(PhysicalPersonViewModel physicalPersonView) { InitializeComponent(); rdlcPhysicalPersonReport.LocalReport.DataSources.Clear(); List <PhysicalPersonsReportViewModel> PhysicalPerson = new List <PhysicalPersonsReportViewModel>(); List <PhysicalPersonViewModel> PhysicalPersonItems = new PhysicalPersonSQLiteRepository().GetPhysicalPersonsByPage(MainWindow.CurrentCompanyId, PhysicalPersonSearchObject, 1, 50).PhysicalPersons; int counter = 1; foreach (var PhysicalPersonItem in PhysicalPersonItems) { PhysicalPerson.Add(new PhysicalPersonsReportViewModel() { OrderNumbersForPhysicalPersons = counter++, PhysicalPersonCode = PhysicalPersonItem?.PhysicalPersonCode ?? "", Name = PhysicalPersonItem?.Name ?? "", SurName = PhysicalPersonItem?.SurName ?? "", ConstructionSiteCode = PhysicalPersonItem?.ConstructionSiteCode ?? "", ConstructionSiteName = PhysicalPersonItem?.ConstructionSiteName ?? "", DateOfBirth = PhysicalPersonItem?.DateOfBirth?.ToString("dd.MM.yyyy") ?? "", Passport = PhysicalPersonItem?.Passport ?? "", ResidenceCountryName = PhysicalPersonItem?.ResidenceCountry?.Name ?? "", ResidenceCityName = PhysicalPersonItem?.ResidenceCity?.Name ?? "", ResidenceAddress = PhysicalPersonItem?.ResidenceAddress ?? "" }); } var rpdsModel = new ReportDataSource() { Name = "DataSet1", Value = PhysicalPerson }; rdlcPhysicalPersonReport.LocalReport.DataSources.Add(rpdsModel); //List<ReportParameter> reportParams = new List<ReportParameter>(); //string parameterText = "Dana " + (CurrentEmployee?.InvoiceDate.ToString("dd.MM.yyyy") ?? "") + " na stočni depo klanice Bioesen primljeno je:"; //reportParams.Add(new ReportParameter("txtEmployeeDate", parameterText)); //var businessPartnerList = new List<InvoiceBusinessPartnerViewModel>(); //businessPartnerList.Add(new InvoiceBusinessPartnerViewModel() { Name = "Pera peric " }); //var businessPartnerModel = new ReportDataSource() { Name = "DataSet2", Value = businessPartnerList }; //rdlcInputNoteReport.LocalReport.DataSources.Add(businessPartnerModel); string exeFolder = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))); string ContentStart = System.IO.Path.Combine(exeFolder, @"SirmiumERPGFC\RdlcReports\Employees\PhysicalsReport.rdlc"); rdlcPhysicalPersonReport.LocalReport.ReportPath = ContentStart; // rdlcPhysicalPersonReport.LocalReport.SetParameters(reportParams); rdlcPhysicalPersonReport.SetDisplayMode(DisplayMode.PrintLayout); rdlcPhysicalPersonReport.Refresh(); rdlcPhysicalPersonReport.ZoomMode = ZoomMode.Percent; rdlcPhysicalPersonReport.ZoomPercent = 100; rdlcPhysicalPersonReport.RefreshReport(); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { #region Validation //if (CurrentPhysicalPerson?.BusinessPartner == null) //{ // MainWindow.WarningMessage = "Obavezno polje: Poslovni partner"; // return; //} #endregion Thread td = new Thread(() => { SubmitButtonContent = ((string)Application.Current.FindResource("Čuvanje_u_tokuTriTacke")); SubmitButtonEnabled = false; CurrentPhysicalPerson.IsSynced = false; CurrentPhysicalPerson.Company = new CompanyViewModel() { Id = MainWindow.CurrentCompanyId }; CurrentPhysicalPerson.CreatedBy = new UserViewModel() { Id = MainWindow.CurrentUserId }; PhysicalPersonResponse response = new PhysicalPersonSQLiteRepository().Create(CurrentPhysicalPerson); if (!response.Success) { MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Greška_kod_lokalnog_čuvanjaUzvičnik")); SubmitButtonContent = ((string)Application.Current.FindResource("Proknjiži")); SubmitButtonEnabled = true; } response = outputInvoiceService.Create(CurrentPhysicalPerson); if (!response.Success) { MainWindow.ErrorMessage = ((string)Application.Current.FindResource("Podaci_su_sačuvani_u_lokaluUzvičnikTačka_Greška_kod_čuvanja_na_serveruUzvičnik")) + response.Message; SubmitButtonContent = ((string)Application.Current.FindResource("Proknjiži")); SubmitButtonEnabled = true; } if (response.Success) { MainWindow.SuccessMessage = ((string)Application.Current.FindResource("Podaci_su_uspešno_sačuvaniUzvičnik")); SubmitButtonContent = ((string)Application.Current.FindResource("Proknjiži")); SubmitButtonEnabled = true; new PhysicalPersonSQLiteRepository().Sync(outputInvoiceService); PhysicalPersonCreatedUpdated(); Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { FlyoutHelper.CloseFlyout(this); }) ); } }); td.IsBackground = true; td.Start(); }