Files
GPW/GPW_Admin/ExportTimbZucchetti.aspx.cs
T
Samuele E. Locatelli e4973c2d39 Fix warnings progetto ADM
2020-09-07 10:30:02 +02:00

80 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using GPW_data;
using SteamWare;
namespace GPW_Admin
{
public partial class ExportTimbZucchetti : BasePage
{
protected DateTime inizio;
protected DateTime fine;
protected int idxDipendente;
string codTimbra;
/// <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();
}
}
/// <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
}
}
/// <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();
}
}
}