Files
GPW/GPW_Smart/WebUserControls/cmp_rilTemp.ascx.cs
T
2020-09-03 09:53:50 +02:00

88 lines
2.0 KiB
C#

using GPW_data;
using SteamWare;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GPW_Smart.WebUserControls
{
public partial class cmp_rilTemp : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
setupData();
}
}
protected int idxDip
{
get
{
return memLayer.ML.IntSessionObj("idxDipendente");
}
}
public DateTime dtRif
{
get
{
DateTime answ = DateTime.Today;
DateTime.TryParse(memLayer.ML.QSS("dataRif"), out answ);
return answ;
}
}
protected decimal tempRilevata
{
get
{
decimal answ = 37;
decimal.TryParse(txtTempRil.Text.Replace(".",","), out answ);
return answ;
}
set
{
txtTempRil.Text = $"{value:0.0}".Replace(",", ".");
}
}
private void setupData()
{
// recupero dati temperatura
decimal tempRil = 0;
try
{
var tabRT = DataProxy.DP.taRT.getByKey(idxDip, dtRif);
if (tabRT != null && tabRT.Rows.Count > 0)
{
tempRil = tabRT[0].tempRil;
}
}
catch
{ }
tempRilevata = tempRil;
}
protected void lbtSave_Click(object sender, EventArgs e)
{
DataProxy.DP.taRT.upsertQuery(idxDip, dtRif, tempRilevata);
// torno a timbrature...
Response.Redirect("Timbrature");
}
protected void lbtCancel_Click(object sender, EventArgs e)
{
// torno a timbrature...
Response.Redirect("Timbrature");
}
}
}