120 lines
4.3 KiB
C#
120 lines
4.3 KiB
C#
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;
|
|
using SteamWare;
|
|
|
|
namespace C2P_Report
|
|
{
|
|
public partial class ReportViewer : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
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 = "";
|
|
string TypeDoc = "";
|
|
|
|
try
|
|
{
|
|
ticket = Convert.ToInt32(Request.QueryString["ticket"]);
|
|
}
|
|
catch
|
|
{ }
|
|
|
|
try
|
|
{
|
|
QuoteType = Request.QueryString["QuoteType"];
|
|
}
|
|
catch
|
|
{ }
|
|
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";
|
|
|
|
try
|
|
{
|
|
TypeDoc = Request.QueryString["TypeDoc"];
|
|
}
|
|
catch
|
|
{
|
|
lingua = "ReportOff";
|
|
}
|
|
|
|
// 1) impostazione file report da TypeDoc:
|
|
if (TypeDoc == "ReportOff")
|
|
{
|
|
localReport.ReportPath = string.Format(@".\Reports\ReportOffers_{0}.rdlc", QuoteType);
|
|
}
|
|
else if (TypeDoc == "OffertDOC")
|
|
{
|
|
localReport.ReportPath = string.Format(@".\Reports\OffertDOC.rdlc");
|
|
}
|
|
else // fallback
|
|
{
|
|
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!!!
|
|
|
|
// passo entrambi i dati (ticket/chiave) poi la stored "si arrangia"...
|
|
tabQuote = (DataTable)DtProxy.man.taPQuot.GetData(ticket, 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));
|
|
// aggiungo parametro autorizzazione: 1 = user, 2 = superuser, 3 = admin/superadmin
|
|
string livAuth = "1";
|
|
// leggo da POST value...
|
|
try
|
|
{
|
|
livAuth = Request.QueryString["livAuth"];
|
|
}
|
|
catch
|
|
{ }
|
|
ReportParameter paramAuth = new ReportParameter("Authoriz", livAuth);
|
|
localReport.SetParameters(new ReportParameter[] { paramAuth });
|
|
}
|
|
}
|
|
}
|
|
} |