using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GPW_data;
using SteamWare;
namespace GPW_Admin.WebUserControls
{
public partial class mod_elencoTimbr : BaseUserControl
{
#region Public Events
///
/// evento update valori
///
public event EventHandler eh_nuovoValore;
#endregion Public Events
#region Public Properties
///
/// determina se sia visibile formato data estesa
///
public bool showLongDateFormat { get; set; }
///
/// determina se sia visibile username
///
public bool showUserName { get; set; }
///
/// verifica se l'utente possa approvare la modifica oraria
///
public bool userCanApprove
{
get
{
bool answ = false;
try
{
answ = user_std.UtSn.userHasRight("GPW_admin");
}
catch
{ }
return answ;
}
}
#endregion Public Properties
#region Private Methods
///
/// imposto ODS
///
private void checkFixOds()
{
ods.DataBind();
grView.DataBind();
}
private void raiseUpdate()
{
// sollevo evento nuovo valore...
if (eh_nuovoValore != null)
{
eh_nuovoValore(this, new EventArgs());
}
}
#endregion Private Methods
#region Protected Methods
///
/// evento cancellazione riga
///
///
///
protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
grView.DataBind();
raiseUpdate();
}
///
/// evento update righe
///
///
///
protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
grView.DataBind();
raiseUpdate();
}
protected void Page_Load(object sender, EventArgs e)
{
}
#endregion Protected Methods
#region Public Methods
///
/// calcola cognome-nome da idx
///
///
///
public string cognomeNome(object idxDip)
{
string answ = "";
try
{
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(Convert.ToInt32(idxDip))[0];
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
}
catch
{ }
return answ;
}
public void doUpdate()
{
checkFixOds();
}
///
/// inverte valore booleano
///
///
///
public bool invBool(object valore)
{
bool answ = true;
try
{
answ = !Convert.ToBoolean(valore);
}
catch
{ }
return answ;
}
///
/// converte valore in booleano
///
///
///
public bool toBool(object valore)
{
bool answ = true;
try
{
answ = Convert.ToBoolean(valore);
}
catch
{ }
return answ;
}
///
/// verifica se l'utente possa eliminare il record:
/// - se non approvato
/// - se admin
///
public bool userCanDelete(object approvata)
{
bool answ = !Convert.ToBoolean(approvata);
try
{
answ = user_std.UtSn.userHasRight("GPW_admin");
}
catch
{ }
return answ;
}
#endregion Public Methods
}
}