103 lines
3.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Consulenza.Web
{
public partial class Proposta : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ConsulenzaBaseWS.WSProposta CB = new ConsulenzaBaseWS.WSProposta();
int chiaveClientePB = Convert.ToInt32(txtCodiceCliente.Text.Trim());
int chiaveProposta = Convert.ToInt32(txtIdProposta.Text.Trim());
byte[] myPDF = null;
myPDF = ck_unica.Checked ? CB.CreaReport_ConsulenzaBaseCU_Proposta_ChiaveCliente(chiaveClientePB, chiaveProposta) :
CB.CreaReport_ConsulenzaBase_Proposta_ChiaveCliente(chiaveClientePB, chiaveProposta);
if (myPDF != null)
{
Session["pdf"] = myPDF;
Response.Redirect("Report.aspx", false);
}
else
ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "ClientScript", "alert('Deve essere selezionata almeno una voce')", true);
//// Opreazioni del client
//Response.ContentType = "application/pdf";
//Response.AddHeader("content-length", myPDF.Length.ToString());
//Response.BinaryWrite(myPDF);
//Response.Flush();
//Response.End();
}
protected void Button2_Click(object sender, EventArgs e)
{
ConsulenzaBaseWS.WSProposta CB = new ConsulenzaBaseWS.WSProposta();
byte[] myPDF = null;
myPDF = ck_unica.Checked ? CB.CreaReport_CU_Proposta_CodiceFiscale_PIVA_Mandato(
txtCodiceRete.Text.Trim(),
txtCodicePb.Text.Trim(),
txtCodiceFiscale.Text.Trim(),
txtPartitaIVA.Text.Trim(),
txtCodiceMandato.Text.Trim(),
Convert.ToInt32(txtIdProposta2.Text))
: CB.CreaReport_ConsulenzaBase_Proposta_CodiceFiscale_PIVA_Mandato(
txtCodiceRete.Text.Trim(),
txtCodicePb.Text.Trim(),
txtCodiceFiscale.Text.Trim(),
txtPartitaIVA.Text.Trim(),
txtCodiceMandato.Text.Trim(),
Convert.ToInt32(txtIdProposta2.Text));
// Opreazioni del client
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", myPDF.Length.ToString());
Response.BinaryWrite(myPDF);
Response.Flush();
Response.End();
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void SalvaReport_Click(object sender, EventArgs e)
{
ConsulenzaBaseWS.WSProposta CB = new ConsulenzaBaseWS.WSProposta();
if (ck_unica.Checked)
{
if (CB.SalvaReport_ConsulenzaBaseCU_Proposta_ChiaveCliente(Convert.ToInt32(txtCodiceCliente.Text.Trim()), (Convert.ToInt32(txtIdProposta.Text.Trim()))))
lbl_Messaggio.Text = "Report salvato nel database";
else
lbl_Messaggio.Text = "Errore al salvataggio del report nel database";
}
else
{
if (CB.SalvaReport_ConsulenzaBase_Proposta_ChiaveCliente(Convert.ToInt32(txtCodiceCliente.Text.Trim()), (Convert.ToInt32(txtIdProposta.Text.Trim()))))
lbl_Messaggio.Text = "Report salvato nel database";
else
lbl_Messaggio.Text = "Errore al salvataggio del report nel database";
}
}
}
}