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_Commesse.WebUserControls { public partial class mod_elencoTimbr : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } /// /// evento update valori /// public event EventHandler eh_nuovoValore; /// /// evento update righe /// /// /// protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e) { grView.DataBind(); raiseUpdate(); } private void raiseUpdate() { // sollevo evento nuovo valore... if (eh_nuovoValore != null) { eh_nuovoValore(this, new EventArgs()); } } /// /// evento cancellazione riga /// /// /// protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e) { grView.DataBind(); raiseUpdate(); } /// /// imposto ODS /// private void checkFixOds() { ods.DataBind(); grView.DataBind(); } public void doUpdate() { checkFixOds(); } /// /// calcola cognome-nome da idx /// /// /// public string cognomeNome(object idxDip) { string answ = ""; int IdxDipendente = 0; if (int.TryParse($"{idxDip}", out IdxDipendente)) { answ = DataProxy.DP.cognomeNomeByIdx(IdxDipendente); } return answ; } /// /// 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 approvare la modifica oraria /// public bool userCanApprove { get { bool answ = false; try { answ = user_std.UtSn.userHasRight("GPW_admin"); } 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; } /// /// determina se sia visibile username /// public bool showUserName { get; set; } /// /// determina se sia visibile formato data estesa /// public bool showLongDateFormat { get; set; } } }