114 lines
3.5 KiB
C#
114 lines
3.5 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
public partial class mod_calChiusura : ApplicationUserControl
|
|
{
|
|
public event EventHandler eh_resetSelezione;
|
|
|
|
protected override void Page_Load(object sender, EventArgs e)
|
|
{
|
|
base.Page_Load(sender, e);
|
|
if (!Page.IsPostBack)
|
|
{
|
|
grView.PageSize = _righeDataGridMed;
|
|
btnShowInsPeriodo.Text = traduci("btnShowInsPeriodo");
|
|
btnInsPeriodo.Text = traduci("btnInsPeriodo");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// gestione evento inserimento nuovo record standard (se ZERO presenti)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnNewFromEmpty_Click(object sender, EventArgs e)
|
|
{
|
|
// reset selezione...
|
|
resetSelezione();
|
|
// i primi valori ("0") di default sono "ND"... li inserisco come standard...
|
|
MapoDb.DataLayer.obj.taCalFF.Insert(DateTime.Now.Date, "-- [NUOVO] non definito --");
|
|
grView.DataBind();
|
|
}
|
|
/// <summary>
|
|
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
|
/// </summary>
|
|
public void resetSelezione()
|
|
{
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
if (eh_resetSelezione != null)
|
|
{
|
|
eh_resetSelezione(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// evento dati associati a controllo
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
LinkButton lb;
|
|
// aggiorno gli headers
|
|
foreach (TableCell cella in grView.HeaderRow.Cells)
|
|
{
|
|
try
|
|
{
|
|
lb = (LinkButton)cella.Controls[0];
|
|
lb.Text = traduci(lb.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1);
|
|
lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord);
|
|
}
|
|
else
|
|
{
|
|
lblNumRec.Text = "";
|
|
}
|
|
}
|
|
protected void btnShowInsPeriodo_Click(object sender, EventArgs e)
|
|
{
|
|
pnlInsPeriodo.Visible = !pnlInsPeriodo.Visible;
|
|
if (pnlInsPeriodo.Visible)
|
|
{
|
|
btnShowInsPeriodo.Text = traduci("btnHideInsPeriodo");
|
|
}
|
|
else
|
|
{
|
|
btnShowInsPeriodo.Text = traduci("btnShowInsPeriodo");
|
|
}
|
|
}
|
|
protected void btnInsPeriodo_Click(object sender, EventArgs e)
|
|
{
|
|
// verifico date congrue...
|
|
DateTime inizio = Convert.ToDateTime(txtDataFrom.Text);
|
|
DateTime fine = Convert.ToDateTime(txtDataTo.Text);
|
|
if (fine.CompareTo(inizio) >= 0)
|
|
{
|
|
// inserisco le voci x tutte le date nell'intervallo...
|
|
while (fine.CompareTo(inizio) >= 0)
|
|
{
|
|
|
|
MapoDb.DataLayer.obj.taCalFF.Insert(inizio, txtDescrizione.Text);
|
|
inizio = inizio.AddDays(1);
|
|
}
|
|
// update e nascondo pannello
|
|
grView.DataBind();
|
|
pnlInsPeriodo.Visible = false;
|
|
btnShowInsPeriodo.Text = traduci("btnShowInsPeriodo");
|
|
lblWarning.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
lblWarning.Visible = true;
|
|
lblWarning.Text = traduci("OrdineDateErrato");
|
|
}
|
|
}
|
|
}
|