using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Microsoft.Reporting.WebForms; using System.Data; using C2P_Data; namespace C2P_Report { public partial class ReportViewer : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (false) { ReportOffers.ProcessingMode = ProcessingMode.Remote; ReportOffers.ServerReport.ReportServerUrl = new Uri(@"http://10.74.82.217/ReportServer_SQL2008R2"); ReportOffers.ServerReport.ReportPath = @"/Test/ReportOffers"; ReportOffers.ServerReport.DisplayName = "Offers"; } else { ReportOffers.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; LocalReport localReport = ReportOffers.LocalReport; localReport.EnableExternalImages = true; // 0) recupero la richiesta di stampa: numero ticket! e lingua! string lingua = "EN"; int ticket = 0; string QuoteType = ""; int CodQuote = 0; int QuoteRev = 0; string chiave = ""; try { ticket = Convert.ToInt32(Request.QueryString["ticket"]); QuoteType = Request.QueryString["QuoteType"]; } catch { } // se NON ho ticket... if (ticket == 0) { try { CodQuote = Convert.ToInt32(Request.QueryString["CodQuote"]); QuoteRev = Convert.ToInt32(Request.QueryString["QuoteRev"]); } catch { } } try { chiave = string.Format("QuoteType={0}&CodQuote={1}&QuoteRev={2}", QuoteType, CodQuote, QuoteRev); } catch { } try { lingua = Request.QueryString["lingua"]; } catch { lingua = "EN"; } if (lingua == "" || lingua == null) lingua = "EN"; // 1) impostazione file report localReport.ReportPath = string.Format(@".\Reports\ReportOffers_{0}.rdlc", QuoteType); // 2) caricamento tab dati DataTable tabVoc = new DataTable(); DataTable tabVocQState = new DataTable(); DataTable tabQuote = new DataTable(); tabVoc = (DataTable)SteamWare.selDataVoc.mgr.getVocabolarioByLemma(lingua, "C2P_prt1"); // HARD CODED lemma x report!!! tabVocQState = (DataTable)SteamWare.selDataVoc.mgr.getVocabolarioByLemma(lingua, "ST"); // HARD CODED lemma x report!!! // se ho ticket... if (ticket > 0) { tabQuote = (DataTable)DtProxy.man.taQFQ.repOffersByTicket(ticket); } else // ho richiesta x chiave diretta... { tabQuote = (DataTable)DtProxy.man.taQFQ.repOffersByChiave(chiave); } // 3) inserimento dataset nel report localReport.DataSources.Add(new ReportDataSource("dsVocabolario", tabVoc)); localReport.DataSources.Add(new ReportDataSource("dsQuoteFull_Q_Data", tabQuote)); localReport.DataSources.Add(new ReportDataSource("dsVocabolarioQState", tabVocQState)); } } } } }