139 lines
3.0 KiB
C#
139 lines
3.0 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
|
|
public partial class excelExportStati : 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=Stati.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);
|
|
gvStati.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 macchinaDaIdx(object idx)
|
|
{
|
|
return _resoconti.macchinaDaIdx(idx.ToString());
|
|
}
|
|
public string statoDaIdx(object idx)
|
|
{
|
|
return _resoconti.statoDaIdx(Convert.ToInt32(idx));
|
|
}
|
|
public string tipoDaIdx(object idx)
|
|
{
|
|
return _resoconti.tipoDaIdx(Convert.ToInt32(idx));
|
|
}
|
|
public void aggiornamento()
|
|
{
|
|
gvStati.AllowPaging = false;
|
|
ods_DiarioDiBordo.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);
|
|
}
|
|
/// <summary>
|
|
/// restituisce stringa formattata in HH:mm
|
|
/// </summary>
|
|
/// <param name="durataMinuti"></param>
|
|
/// <returns></returns>
|
|
public string durataEvento(object durataMinuti)
|
|
{
|
|
//string durataFormattata = "";
|
|
//int ore = (int)Math.Floor(((double)durataMinuti) / 60);
|
|
//durataFormattata = string.Format("{0}h:{1:#.0}min", ore, (double)durataMinuti - 60 * ore);
|
|
//return durataFormattata;
|
|
return durataMinuti.ToString();
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|