7d289a3b64
pulizia codice...
97 lines
3.0 KiB
C#
97 lines
3.0 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Web.UI.WebControls;
|
|
|
|
public partial class mod_anagOpMtz : ApplicationUserControl
|
|
{
|
|
public event EventHandler eh_resetSelezione;
|
|
/// <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 = "";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// reset delle selezioni
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
/// <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>
|
|
/// seleziono valore in editing...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
|
|
{
|
|
// seleziono la riga corrente...
|
|
grView.SelectedIndex = e.NewEditIndex;
|
|
}
|
|
/// <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...
|
|
GIM_dataLayer.DS_applicazioneTableAdapters.AnagrOperMtzTableAdapter taAnagOpMtz = new GIM_dataLayer.DS_applicazioneTableAdapters.AnagrOperMtzTableAdapter();
|
|
taAnagOpMtz.Insert("9999", memLayer.ML.confReadString("newCognome"), memLayer.ML.confReadString("newNome"));
|
|
grView.DataBind();
|
|
}
|
|
/// <summary>
|
|
/// è editabile SOLO se non è il primo user 0000 che è un segnaposto
|
|
/// </summary>
|
|
/// <param name="matricola"></param>
|
|
/// <returns></returns>
|
|
public bool isEditable(object matricola)
|
|
{
|
|
bool answ = isWritable();
|
|
if (answ)
|
|
{
|
|
answ = (memLayer.ML.confReadString("defaultMatr") != matricola.ToString());
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
} |