Files
MoonPro.net/MP-SITE/excelExportEventi.aspx.cs
T
2018-11-10 09:27:09 +01:00

127 lines
2.6 KiB
C#

using SteamWare;
using System;
using System.Web;
using System.Web.UI;
public partial class excelExportEventi : System.Web.UI.Page
{
public override void VerifyRenderingInServerForm(Control control)
{
// Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
}
private void doExport()
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=Eventi.xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving than
// comment out the line below
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
gvEventi.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
#region area protected
protected resoconti _resoconti;
protected void Page_Load(object sender, EventArgs e)
{
_resoconti = new resoconti();
if (!Page.IsPostBack)
{
aggiornamento();
doExport();
}
}
protected void reportUpdate()
{
// alzo l'evento d update/inserimento e ricarico cache...
if (eh_doUpdate != null)
{
eh_doUpdate(this, new EventArgs());
}
}
#endregion
#region area public
#region gestione eventi
public event EventHandler eh_doUpdate;
#endregion
/// <summary>
/// idx della macchina da mostrare
/// </summary>
public string idxMacchina
{
get
{
string idxMacchina = "1";
try
{
idxMacchina = memLayer.ML.StringSessionObj("IdxMacchina");
}
catch
{
}
return idxMacchina;
}
set
{
memLayer.ML.setSessionVal("IdxMacchina", value);
}
}
public string statoDaIdx(object idx)
{
return _resoconti.statoDaIdx(Convert.ToInt32(idx));
}
public string tipoDaIdx(object idx)
{
return _resoconti.tipoDaIdx(Convert.ToInt32(idx));
}
public string macchinaDaIdx(object idx)
{
return _resoconti.macchinaDaIdx(idx.ToString());
}
public void aggiornamento()
{
gvEventi.AllowPaging = false;
//gvEventi.PageSize = _numRighe;
ods_EventList.DataBind();
}
public void reportUpdt(object sender, EventArgs e)
{
reportUpdate();
}
public string operatoreDaMatr(object matricola)
{
int matr = 0;
try
{
matr = Convert.ToInt32(matricola);
}
catch
{ }
return _resoconti.oprDaMatr(matr);
}
#endregion
}