Files
GPW/GPW_Commesse/WebUserControls/mod_elencoTimbr.ascx.cs
2022-01-13 12:54:59 +01:00

156 lines
4.0 KiB
C#

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)
{
}
/// <summary>
/// evento update valori
/// </summary>
public event EventHandler eh_nuovoValore;
/// <summary>
/// evento update righe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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());
}
}
/// <summary>
/// evento cancellazione riga
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
grView.DataBind();
raiseUpdate();
}
/// <summary>
/// imposto ODS
/// </summary>
private void checkFixOds()
{
ods.DataBind();
grView.DataBind();
}
public void doUpdate()
{
checkFixOds();
}
/// <summary>
/// calcola cognome-nome da idx
/// </summary>
/// <param name="idxDip"></param>
/// <returns></returns>
public string cognomeNome(object idxDip)
{
string answ = "";
int IdxDipendente = 0;
if (int.TryParse($"{idxDip}", out IdxDipendente))
{
answ = DataProxy.DP.cognomeNomeByIdx(IdxDipendente);
}
return answ;
}
/// <summary>
/// inverte valore booleano
/// </summary>
/// <param name="isEnt"></param>
/// <returns></returns>
public bool invBool(object valore)
{
bool answ = true;
try
{
answ = !Convert.ToBoolean(valore);
}
catch
{ }
return answ;
}
/// <summary>
/// converte valore in booleano
/// </summary>
/// <param name="isEnt"></param>
/// <returns></returns>
public bool toBool(object valore)
{
bool answ = true;
try
{
answ = Convert.ToBoolean(valore);
}
catch
{ }
return answ;
}
/// <summary>
/// verifica se l'utente possa approvare la modifica oraria
/// </summary>
public bool userCanApprove
{
get
{
bool answ = false;
try
{
answ = user_std.UtSn.userHasRight("GPW_admin");
}
catch
{ }
return answ;
}
}
/// <summary>
/// verifica se l'utente possa eliminare il record:
/// - se non approvato
/// - se admin
/// </summary>
public bool userCanDelete(object approvata)
{
bool answ = !Convert.ToBoolean(approvata);
try
{
answ = user_std.UtSn.userHasRight("GPW_admin");
}
catch
{ }
return answ;
}
/// <summary>
/// determina se sia visibile username
/// </summary>
public bool showUserName { get; set; }
/// <summary>
/// determina se sia visibile formato data estesa
/// </summary>
public bool showLongDateFormat { get; set; }
}
}