Files
GPW/GPW_Admin/ExportTimbZucchetti.aspx.cs
2022-02-03 07:32:10 +01:00

98 lines
3.0 KiB
C#

using GPW_data;
using SteamWare;
using System;
using System.Web;
using System.Web.UI;
namespace GPW_Admin
{
public partial class ExportTimbZucchetti : BasePage
{
#region Private Fields
private string codTimbra;
#endregion Private Fields
#region Protected Fields
protected DateTime fine;
protected int idxDipendente;
protected DateTime inizio;
#endregion Protected Fields
#region Private Methods
/// <summary>
/// export html pagina
/// </summary>
private void doExport()
{
string attachment = "attachment; filename=Timbrature.txt";
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
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 = "text/csv";
Response.AddHeader("Pragma", "public");
// scrivo le righe dell'output!
DS_export.TimbratureZucchettiDataTable tabTimb = DataProxy.DP.taExpZucc.GetData(inizio, fine, idxDipendente, codTimbra);
foreach (DS_export.TimbratureZucchettiRow riga in tabTimb)
{
Response.Write(riga.campoExport);
Response.Write(Environment.NewLine);
}
//System.IO.StringWriter stringWrite = new System.IO.StringWriter();
//System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
//grView.RenderControl(htmlWrite);
//Response.Write(stringWrite.ToString());
Response.End();
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
aggiornamento();
doExport();
}
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// update controlli
/// </summary>
public void aggiornamento()
{
// carico dati inizio/fine periodo richiesti
inizio = Convert.ToDateTime(memLayer.ML.objSessionObj("_inizio"));
fine = Convert.ToDateTime(memLayer.ML.objSessionObj("_fine"));
idxDipendente = memLayer.ML.IntSessionObj("idxDip_sel");
if (idxDipendente == -1) idxDipendente = 0;
codTimbra = memLayer.ML.confReadString("codTimbra");
if (string.IsNullOrEmpty(codTimbra))
{
codTimbra = "90"; // timbratrice 90: da web.config
}
}
#endregion Public Methods
}
}