private void btnPrintCert_Click(object sender, RoutedEventArgs e) { if (_certvm == null) { _certvm = new CertificationMakeVM(); } RadButton btn = (RadButton)sender; DeliverySearchEntity delivery = (DeliverySearchEntity)btn.DataContext; var certs = _dataContext.GetCertifications(delivery, _certvm); if (certs.Count > 0) { #if UniqueCode var mapping = _dataContext.GetProductUniqueCodeMappings(delivery); CertificationPrintSetWin win = new CertificationPrintSetWin(certs, delivery.Details, mapping); #else CertificationPrintSetWin win = new CertificationPrintSetWin(certs, delivery.Details); #endif win.DataContext = new { Certification = certs[0], PrintTicket = new CertificationPrintTicket() }; win.Owner = View.Extension.UIHelper.GetAncestor <Window>(this); win.ShowDialog(); } else { MessageBox.Show("没有找到对应的合格证信息"); } }
private void btnPrint_Click(object sender, RoutedEventArgs e) { RadButton btn = (RadButton)sender; var entity = btn.DataContext as CertificationBO; if (entity.ID == default(int)) { MessageBox.Show("请先保存."); return; } entity.GradeName = _dataContext.Grades.First(o => o.ID == entity.Grade).Name; entity.SafetyTechniqueName = _dataContext.SafetyTechs.First(o => o.ID == entity.SafetyTechnique).Name; entity.CarriedStandardName = _dataContext.CarriedStandards.First(o => o.ID == entity.CarriedStandard).Name; CertificationPrintSetWin win = new CertificationPrintSetWin(); win.DataContext = new { Certification = entity, PrintTicket = new CertificationPrintTicket() }; win.Owner = View.Extension.UIHelper.GetAncestor <Window>(this); win.ShowDialog(); }