Zbiór zmian 522 dla trunk

Pokaż
Ignoruj:
Data:
2009-04-02 15:59:52 (17 years ago)
Autor:
marek
Opis:

fixes #151

Lokalizacja:
trunk/BazaReklam
Pliki:
2 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/BazaReklam/FactureViewer.Designer.cs

    r372 r522  
    267267            this.btnRefresh.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; 
    268268            this.btnRefresh.UseVisualStyleBackColor = true; 
     269            //this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click); 
    269270            //  
    270271            // reportViewer1 
  • trunk/BazaReklam/FactureViewer.cs

    r457 r522  
    3535            proforma = rodzaj; 
    3636 
    37             btnRefresh.Click += zapiszButton_Click; 
     37            btnRefresh.Click += btnRefresh_Old_Click; 
    3838 
    3939            fakturaTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; 
     
    119119            InitializeComponent(); 
    120120 
     121            btnRefresh.Click += btnRefresh_Click; 
    121122 
    122123            idFaktury = idFakt; 
    123124            proforma = r; 
    124  
    125             btnRefresh.Click += Refresh_Click; 
    126125 
    127126            fakturaTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; 
     
    272271        } 
    273272 
    274         /* 
    275         /// <summary> 
    276         ///  FAKTURA DLA POZNANIA 
    277         /// </summary> 
    278         /// <param name="idFakt"></param> 
    279         public FactureViewer(int idFakt) 
    280         { 
    281             InitializeComponent(); 
    282  
    283             idFaktury = idFakt; 
    284  
    285             this.btnRefresh.Click += new EventHandler(zapiszPoznanButton_Click); 
    286  
    287             fakturaTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; 
    288             fakturA_DETAILSTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; 
    289             fAKTURYTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; 
    290             proformaTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; 
    291  
    292             ds = new DataSet(); 
    293  
    294             //zczytuje dane z pliku z tlumaczeniami 
    295             Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Baza_Reklam.Raporty.faktura.xml"); 
    296             ds.ReadXml(s); 
    297  
    298             fAKTURYTableAdapter.FillByIdFaktury(this.rEKLAMADataSet.FAKTURY, idFakt); 
    299  
    300             typComboBox.Enabled = false; 
    301           //  wersjaComboBox.Enabled = false; 
    302          // jezykComboBox.Enabled = false; 
    303  
    304             reportViewer1.LocalReport.ReportEmbeddedResource = "Baza_Reklam.Raporty.fakturaPoznan.rdlc"; 
    305             reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", fakturaTableAdapter1.GetDataByIdFaktury(idFakt))); 
    306             reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("FakturaDetails", fakturA_DETAILSTableAdapter1.GetDataByIdFaktury(idFakt))); 
    307             reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("tlumaczenia", ds.Tables[0])); 
    308  
    309             jezykComboBox.SelectedIndex = 0; 
    310             typComboBox.SelectedIndex = 1; 
    311         //    wersjaComboBox.SelectedIndex = 0; 
    312         } 
    313         */ 
    314  
    315  
    316273        private void FactureViewer_Load(object sender, EventArgs e) 
    317274        { 
     
    322279        } 
    323280 
    324         private void zapiszButton_Click(object sender, EventArgs e) 
     281        private void btnRefresh_Old_Click(object sender, EventArgs e) 
    325282        { 
    326283            Cursor = Cursors.WaitCursor; 
     
    332289 
    333290            reportViewer1.Reset(); 
    334             reportViewer1.LocalReport.ReportEmbeddedResource = proforma ? "Baza_Reklam.Raporty.fakturaReversed.rdlc" : "Baza_Reklam.Raporty.proformaReversed.rdlc"; 
     291            reportViewer1.LocalReport.ReportEmbeddedResource = proforma ? "Baza_Reklam.Raporty.proformaReversed.rdlc" : "Baza_Reklam.Raporty.fakturaReversed.rdlc"; 
    335292 
    336293            //ustawienie parametrów, nowych datasoure dla raportu 
     
    338295 
    339296            if (proforma) 
     297            { 
     298                //paramList.Add(new ReportParameter("typ", typComboBox.SelectedItem.ToString(), true)); 
     299                paramList.Add(new ReportParameter("podpis", podpisCheckBox.Checked.ToString(), true)); 
     300                reportViewer1.LocalReport.SetParameters(paramList); 
     301                reportViewer1.LocalReport.DataSources.Clear(); 
     302                reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", proformaTableAdapter.GetDataByIdFaktury(idFaktury))); 
     303            } 
     304            else 
    340305            { 
    341306                paramList.Add(new ReportParameter("jezyk", jezykComboBox.SelectedItem.ToString(), true)); 
     
    343308                reportViewer1.LocalReport.SetParameters(paramList); 
    344309                reportViewer1.LocalReport.DataSources.Clear(); 
    345                 reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", fakturaTableAdapter1.GetDataByIdFaktury(idFaktury))); 
    346  
    347             } 
    348             else 
    349             { 
    350                 paramList.Add(new ReportParameter("typ", typComboBox.SelectedItem.ToString(), true)); 
    351                 paramList.Add(new ReportParameter("podpis", podpisCheckBox.Checked.ToString(), true)); 
    352                 reportViewer1.LocalReport.SetParameters(paramList); 
    353                 reportViewer1.LocalReport.DataSources.Clear(); 
    354                 reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", proformaTableAdapter.GetDataByIdFaktury(idFaktury))); 
     310                reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", fakturaTableAdapter1.GetDataByIdFaktury(idFaktury)));    
    355311            } 
    356312 
     
    435391        } 
    436392 
    437         private void Refresh_Click(object sender, EventArgs e) 
     393        private void btnRefresh_Click(object sender, EventArgs e) 
    438394        { 
    439395            Cursor = Cursors.WaitCursor; 
     
    472428 
    473429        } 
    474  
    475         //drukowanie raportu serwerowego 
    476         /* 
    477         private int m_currentPageIndex; 
    478         private IList<Stream> m_streams; 
    479  
    480  
    481         public void HandlePrint(object sender, CancelEventArgs e) 
    482         { 
    483             Run(); 
    484             //MessageBox.Show("Drukowanie"); 
    485             e.Cancel = true; 
    486         } 
    487  
    488         private void Print(PrinterSettings printerSettings) 
    489         { 
    490             MessageBox.Show("PrintBegin"); 
    491             if (m_streams == null || m_streams.Count == 0) 
    492                 return; 
    493  
    494             PrintDocument printDoc = new PrintDocument(); 
    495             printDoc.PrinterSettings = printerSettings; 
    496             printDoc.PrintPage += new PrintPageEventHandler(PrintPage); 
    497             MessageBox.Show("Print"); 
    498             printDoc.Print(); 
    499         } 
    500  
    501         private void Run() 
    502         { 
    503             PrintDialog printDialog = new PrintDialog(); 
    504             if (printDialog.ShowDialog() == DialogResult.OK) 
    505             { 
    506                 MessageBox.Show("Export"); 
    507                 Export(reportViewer1.ServerReport); 
    508                 m_currentPageIndex = 0; 
    509                 MessageBox.Show("Print"); 
    510                 Print(printDialog.PrinterSettings); 
    511             } 
    512         } 
    513  
    514         private void PrintPage(object sender, PrintPageEventArgs ev) 
    515         { 
    516             MessageBox.Show("PrintPage1"); 
    517             Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]); 
    518             pageImage.Save("C:\\testestPRO.emf"); 
    519  
    520             // Note: Coordinate (0,0) does not coincide with the top left corner of 
    521             // the page; it coincides with the top left corner of the printable area 
    522             // of the page. To account for this we have to subtract the hard margin. 
    523  
    524             MessageBox.Show("PrintPage2nnn"); 
    525             RectangleF adjustedRect = new RectangleF( 
    526                 ev.PageBounds.Left - ev.PageSettings.HardMarginX, 
    527                 ev.PageBounds.Top - ev.PageSettings.HardMarginY, 
    528                 ev.PageBounds.Width, ev.PageBounds.Height); 
    529             MessageBox.Show(adjustedRect.Top.ToString() + "*" + adjustedRect.Height.ToString() + "*" + adjustedRect.Width.ToString()); 
    530             ev.Graphics.DrawImage(pageImage, adjustedRect); 
    531             MessageBox.Show("PrintPage4"); 
    532             m_currentPageIndex++; 
    533             ev.HasMorePages = (m_currentPageIndex < m_streams.Count); 
    534             MessageBox.Show("PrintPage5"); 
    535         } 
    536  
    537         private void Export(ServerReport report) 
    538         { 
    539             MessageBox.Show("ExportBegin"); 
    540  
    541             string deviceInfo = 
    542  
    543               "<DeviceInfo>" + 
    544  
    545               "  <OutputFormat>EMF</OutputFormat>" + 
    546  
    547               "  <PageWidth>21cm</PageWidth>" + 
    548  
    549               "  <PageHeight>29cm</PageHeight>" + 
    550  
    551               "  <MarginTop>1cm</MarginTop>" + 
    552  
    553               "  <MarginLeft>1cm</MarginLeft>" + 
    554  
    555               "  <MarginRight>1cm</MarginRight>" + 
    556  
    557               "  <MarginBottom>1cm</MarginBottom>" + 
    558  
    559               "</DeviceInfo>"; 
    560  
    561             m_streams = new List<Stream>(); 
    562             string mimeType; 
    563             string extension; 
    564             System.Collections.Specialized.NameValueCollection urlAccessParameters = new System.Collections.Specialized.NameValueCollection(); 
    565             urlAccessParameters.Add("rs:PersistStreams", "True"); 
    566             Stream reportStream = report.Render("Image", deviceInfo, urlAccessParameters, out mimeType, out extension); 
    567             m_streams.Add(reportStream); 
    568             urlAccessParameters.Remove("rs:PersistStreams"); 
    569             urlAccessParameters.Add("rs:GetNextStream", "True"); 
    570             while (reportStream.Length != 0) 
    571             { 
    572                 reportStream = 
    573                     report.Render("Image", deviceInfo, urlAccessParameters, out mimeType, out extension); 
    574                 m_streams.Add(reportStream); 
    575             } 
    576  
    577             m_streams.RemoveAt(m_streams.Count - 1); 
    578  
    579             foreach (Stream stream in m_streams) 
    580                 stream.Position = 0; 
    581  
    582             MessageBox.Show("ExportEnd"); 
    583         } 
    584         */ 
    585430 
    586431        // drukowanie raportu lokalnego 
     
    675520            opisTextBox.Text = powodKorektyComboBox.SelectedItem.ToString(); 
    676521        } 
    677  
    678522    } 
    679523}