fix update pagina orario
This commit is contained in:
@@ -12,45 +12,51 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
public partial class mod_adminOrario : System.Web.UI.UserControl
|
||||
{
|
||||
#region area standard (non modificare)
|
||||
#region Public Events
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_resetSelezione;
|
||||
public event EventHandler eh_nuovoValore;
|
||||
|
||||
#endregion
|
||||
public event EventHandler eh_resetSelezione;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// controllo stato licenze!
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
public bool chkLicOk
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
get
|
||||
{
|
||||
return (licenzeGPW.checkLicenze);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// caricamento
|
||||
/// gestione evento richiesta nuovo valore (mostra footer, ...)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
}
|
||||
/// <summary>
|
||||
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
||||
/// </summary>
|
||||
public void resetSelezione()
|
||||
{
|
||||
grView.SelectedIndex = -1;
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
// inserisco record
|
||||
DataProxy.DP.taAO.insertQuery("0000 (new)", "descrizione");
|
||||
//update!
|
||||
grView.DataBind();
|
||||
if (eh_resetSelezione != null)
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_resetSelezione(this, new EventArgs());
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reset della selezione
|
||||
/// </summary>
|
||||
@@ -60,26 +66,21 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
resetSelezione();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// inserisce nuovo valore da footer
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblIns_click(object sender, EventArgs e)
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
||||
ods.Insert();
|
||||
}
|
||||
/// <summary>
|
||||
/// annulla inserimento nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblCanc_click(object sender, EventArgs e)
|
||||
{
|
||||
// annullo inserimento: nascondo footer, bind controlli...
|
||||
grView.FooterRow.Visible = false;
|
||||
DataColumnCollection colonne = null;
|
||||
using (DS_Applicazione.AnagOrariDataTable tabella = new DS_Applicazione.AnagOrariDataTable())
|
||||
{
|
||||
colonne = tabella.Columns;
|
||||
}
|
||||
return colonne;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// traduce gli header delle colonne
|
||||
/// </summary>
|
||||
@@ -90,7 +91,7 @@ namespace GPW_Admin.WebUserControls
|
||||
if (grView.Rows.Count > 0)
|
||||
{
|
||||
LinkButton lb;
|
||||
// aggiorno gli headers
|
||||
// aggiorno gli headers
|
||||
foreach (TableCell cella in grView.HeaderRow.Cells)
|
||||
{
|
||||
try
|
||||
@@ -110,74 +111,57 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area CUSTOM (da modificare)
|
||||
|
||||
/// <summary>
|
||||
/// elenco colonne del datagrid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected DataColumnCollection colonneObj()
|
||||
{
|
||||
DataColumnCollection colonne = null;
|
||||
using (DS_Applicazione.AnagOrariDataTable tabella = new DS_Applicazione.AnagOrariDataTable())
|
||||
{
|
||||
colonne = tabella.Columns;
|
||||
}
|
||||
return colonne;
|
||||
}
|
||||
/// <summary>
|
||||
/// determina se sia eliminabile il record (=non usato)
|
||||
/// </summary>
|
||||
/// <param name="idxMaker"></param>
|
||||
/// <returns></returns>
|
||||
public bool delEnabled(object idxObj)
|
||||
{
|
||||
bool answ = true;
|
||||
// solo se ha diritti scrittura controllo
|
||||
if (idxObj != null)
|
||||
{
|
||||
int trovati = 0;
|
||||
// controllo se ci siano tipo celle associate
|
||||
trovati = DataProxy.DP.taDipendenti.getByCodOrario(idxObj.ToString()).Rows.Count;
|
||||
// controllo se ci sono record correlati...
|
||||
if (trovati > 0)
|
||||
{
|
||||
answ = false;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// gestione evento richiesta nuovo valore (mostra footer, ...)
|
||||
/// annulla inserimento nuovo valore da footer
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
protected void lblCanc_click(object sender, EventArgs e)
|
||||
{
|
||||
// reset selezione...
|
||||
resetSelezione();
|
||||
// inserisco record
|
||||
DataProxy.DP.taAO.Insert("0000 (new)", "descrizione", 0, 0, false, 0, 0, 0, 0, 0, 0, 0, DateTime.Today.TimeOfDay, DateTime.Today.TimeOfDay, null, null, null, null);
|
||||
//update!
|
||||
grView.DataBind();
|
||||
// sollevo evento nuovo valore...
|
||||
if (eh_nuovoValore != null)
|
||||
{
|
||||
eh_nuovoValore(this, new EventArgs());
|
||||
}
|
||||
// annullo inserimento: nascondo footer, bind controlli...
|
||||
grView.FooterRow.Visible = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// controllo stato licenze!
|
||||
/// inserisce nuovo valore da footer
|
||||
/// </summary>
|
||||
public bool chkLicOk
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lblIns_click(object sender, EventArgs e)
|
||||
{
|
||||
get
|
||||
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
||||
ods.Insert();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check licenze in fase di update...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
{
|
||||
if (!licenzeGPW.checkLicenze)
|
||||
{
|
||||
return (licenzeGPW.checkLicenze);
|
||||
if (e != null)
|
||||
{
|
||||
// annullo insert se licenze sforate...
|
||||
e.Cancel = true;
|
||||
grView.EditIndex = -1;
|
||||
grView.DataBind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// caricamento
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
||||
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
||||
@@ -216,12 +200,15 @@ namespace GPW_Admin.WebUserControls
|
||||
case "textBox":
|
||||
e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text;
|
||||
break;
|
||||
|
||||
case "dropDownList":
|
||||
e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
|
||||
break;
|
||||
|
||||
case "checkBox":
|
||||
e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -236,25 +223,57 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// check licenze in fase di update...
|
||||
/// determina se sia eliminabile il record (=non usato)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ods_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
||||
/// <param name="idxMaker"></param>
|
||||
/// <returns></returns>
|
||||
public bool delEnabled(object idxObj)
|
||||
{
|
||||
if (!licenzeGPW.checkLicenze)
|
||||
bool answ = true;
|
||||
// solo se ha diritti scrittura controllo
|
||||
if (idxObj != null)
|
||||
{
|
||||
if (e != null)
|
||||
int trovati = 0;
|
||||
// controllo se ci siano tipo celle associate
|
||||
trovati = DataProxy.DP.taDipendenti.getByCodOrario(idxObj.ToString()).Rows.Count;
|
||||
// controllo se ci sono record correlati...
|
||||
if (trovati > 0)
|
||||
{
|
||||
// annullo insert se licenze sforate...
|
||||
e.Cancel = true;
|
||||
grView.EditIndex = -1;
|
||||
grView.DataBind();
|
||||
answ = false;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <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());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// effettua traduzione del lemma
|
||||
/// </summary>
|
||||
/// <param name="lemma"></param>
|
||||
/// <returns></returns>
|
||||
public string traduci(string lemma)
|
||||
{
|
||||
return user_std.UtSn.Traduci(lemma);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user