Merge branch 'release/FixReadDipRow'
This commit is contained in:
@@ -205,8 +205,11 @@ namespace GPW_Admin.WebUserControls
|
||||
if (oggi.Subtract(assunto).TotalDays > 60)
|
||||
{
|
||||
// recupero record utente
|
||||
#if false
|
||||
var tabDip = DataProxy.DP.taDipendenti.getByIdx(idxDipSel);
|
||||
if (tabDip != null && tabDip.Rows.Count == 1)
|
||||
if (tabDip != null && tabDip.Rows.Count == 1)
|
||||
#endif
|
||||
if (DataProxy.DP.getRowDip(idxDipSel) != null)
|
||||
{
|
||||
// verifica sia sbloccabile la licenza (online)
|
||||
answ = licenzeGPW.checkActivationUnlocked(CodImpiego).Result;
|
||||
|
||||
@@ -195,8 +195,11 @@ namespace GPW_Admin.WebUserControls
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(Convert.ToInt32(idxDip))[0];
|
||||
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
int IdxDipendente = 0;
|
||||
if (int.TryParse($"{idxDip}", out IdxDipendente))
|
||||
{
|
||||
answ = DataProxy.DP.cognomeNomeByIdx(IdxDipendente);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
@@ -114,13 +114,11 @@ namespace GPW_Admin.WebUserControls
|
||||
public string cognomeNome(object idxDip)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
int IdxDipendente = 0;
|
||||
if (int.TryParse($"{idxDip}", out IdxDipendente))
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(Convert.ToInt32(idxDip))[0];
|
||||
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
answ = DataProxy.DP.cognomeNomeByIdx(IdxDipendente);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
@@ -383,13 +383,11 @@ namespace GPW_Admin.WebUserControls
|
||||
public string cognomeNome(object idxDip)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
int IdxDipendente = 0;
|
||||
if (int.TryParse($"{idxDip}", out IdxDipendente))
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(Convert.ToInt32(idxDip))[0];
|
||||
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
answ = DataProxy.DP.cognomeNomeByIdx(IdxDipendente);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace GPW.WebUserControls
|
||||
string CognomeNome = "";
|
||||
if (memLayer.ML.confReadBool("showNameAfterCmd"))
|
||||
{
|
||||
CognomeNome = DataProxy.DP.CognomeNomeByIdx(DataProxy.idxDipendente);
|
||||
CognomeNome = DataProxy.DP.cognomeNomeByIdx(DataProxy.idxDipendente);
|
||||
}
|
||||
if (nextIsEntrata)
|
||||
{
|
||||
|
||||
@@ -205,13 +205,11 @@ namespace GPW_Commesse.WebUserControls
|
||||
public string cognomeNome(object idxDip)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
int IdxDipendente = 0;
|
||||
if (int.TryParse($"{idxDip}", out IdxDipendente))
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(Convert.ToInt32(idxDip))[0];
|
||||
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
answ = DataProxy.DP.cognomeNomeByIdx(IdxDipendente);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,13 +70,11 @@ namespace GPW_Commesse.WebUserControls
|
||||
public string cognomeNome(object idxDip)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
int IdxDipendente = 0;
|
||||
if (int.TryParse($"{idxDip}", out IdxDipendente))
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(Convert.ToInt32(idxDip))[0];
|
||||
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
answ = DataProxy.DP.cognomeNomeByIdx(IdxDipendente);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
+27
-12
@@ -1,4 +1,5 @@
|
||||
using SteamWare;
|
||||
using Newtonsoft.Json;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
@@ -110,7 +111,7 @@ namespace GPW_data
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.getRowDip(idxDipendente);
|
||||
answ = rigaDip.attivo;
|
||||
}
|
||||
catch
|
||||
@@ -128,7 +129,7 @@ namespace GPW_data
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.taDipendenti.getByIdx(_idxDipendente)[0];
|
||||
DS_Applicazione.DipendentiRow rigaDip = DP.getRowDip(_idxDipendente);
|
||||
answ = rigaDip.attivo;
|
||||
}
|
||||
catch
|
||||
@@ -230,16 +231,14 @@ namespace GPW_data
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string CognomeNomeByIdx(int idxDip)
|
||||
public string cognomeNomeByIdx(int idxDip)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
var rigaDip = getRowDip(idxDip);
|
||||
if (rigaDip != null)
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = taDipendenti.getByIdx(idxDip)[0];
|
||||
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
answ = $"{rigaDip.Cognome} {rigaDip.Nome}";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -316,15 +315,31 @@ namespace GPW_data
|
||||
return fatto;
|
||||
}
|
||||
|
||||
private static int cacheTTL = 60 * 5;
|
||||
private static string rkeyDipRow = memLayer.ML.redHash($"LiMan:DipRow");
|
||||
|
||||
public DS_Applicazione.DipendentiRow getRowDip(int idxDip)
|
||||
{
|
||||
DS_Applicazione.DipendentiRow answ = null;
|
||||
// solo se dip valido
|
||||
if (idxDip > 0)
|
||||
{
|
||||
var tabDip = DP.taDipendenti.getByIdx(idxDip);
|
||||
if (tabDip != null && tabDip.Rows.Count == 1)
|
||||
// cerco in redis...
|
||||
string redKey = $"{rkeyDipRow}:{idxDip}";
|
||||
string rawData = memLayer.ML.getRSV(redKey);
|
||||
if (string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
answ = tabDip[0];
|
||||
var tabDip = DP.taDipendenti.getByIdx(idxDip);
|
||||
if (tabDip != null && tabDip.Rows.Count == 1)
|
||||
{
|
||||
answ = tabDip[0];
|
||||
rawData = JsonConvert.SerializeObject(tabDip);
|
||||
memLayer.ML.setRSV(redKey, rawData, cacheTTL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = JsonConvert.DeserializeObject<DS_Applicazione.DipendentiDataTable>(rawData)[0];
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace GPW_data
|
||||
private static string rkeyTickets = memLayer.ML.redHash($"LiMan:Tickets");
|
||||
private static string rkeyVetoRefPayL = memLayer.ML.redHash($"LiMan:VetoRefPayL");
|
||||
|
||||
private static int cacheTTL = 5;
|
||||
private static int cacheTTL = 60 * 5;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -627,7 +627,7 @@ namespace GPW_data
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
|
||||
// salvo x 5 min
|
||||
memLayer.ML.setRSV(rkeyAuth, answ, 60 * cacheTTL);
|
||||
memLayer.ML.setRSV(rkeyAuth, answ, cacheTTL);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -712,7 +712,7 @@ namespace GPW_data
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey("installazione")[0].valString;
|
||||
// salvo x 5 min
|
||||
memLayer.ML.setRSV(rkeyInstall, answ, 60 * cacheTTL);
|
||||
memLayer.ML.setRSV(rkeyInstall, answ, cacheTTL);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -756,7 +756,7 @@ namespace GPW_data
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valInt;
|
||||
// salvo x 5 min
|
||||
memLayer.ML.setRSV(rkeyNumInstall, $"{answ}", 60 * cacheTTL);
|
||||
memLayer.ML.setRSV(rkeyNumInstall, $"{answ}", cacheTTL);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -817,7 +817,7 @@ namespace GPW_data
|
||||
{
|
||||
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
|
||||
// salvo x 5 min
|
||||
memLayer.ML.setRSV(rkeyMKey, answ, 60 * cacheTTL);
|
||||
memLayer.ML.setRSV(rkeyMKey, answ, cacheTTL);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -859,10 +859,9 @@ namespace GPW_data
|
||||
try
|
||||
{
|
||||
// recupero riga dip
|
||||
DS_Applicazione.DipendentiDataTable userTab = DataProxy.DP.taDipendenti.getByIdx(idxDip);
|
||||
if (userTab != null && userTab.Count > 0)
|
||||
var userRow = DataProxy.DP.getRowDip(idxDip);
|
||||
if (userRow != null)
|
||||
{
|
||||
var userRow = userTab[0];
|
||||
// calcolo suo codice...
|
||||
var codImpCurr = DataProxy.DP.hashCodImpiego(userRow);
|
||||
// cerco dip tra elenco json
|
||||
@@ -895,7 +894,7 @@ namespace GPW_data
|
||||
{
|
||||
answ = DataProxy.DP.taDipendenti.getAttivi(false);
|
||||
rawData = JsonConvert.SerializeObject(answ);
|
||||
memLayer.ML.setRSV(rkeyDipAct, rawData, 60 * cacheTTL);
|
||||
memLayer.ML.setRSV(rkeyDipAct, rawData, cacheTTL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace GPW_Smart.WebUserControls
|
||||
string hashEmail = "";
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.getRowDip(idxDipendente);
|
||||
CognomeNome = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
email = rigaDip.email;
|
||||
hashEmail = SteamCrypto.getHashStringMD5(email);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace GPW.WebUserControls
|
||||
string CognomeNome = "USER ND";
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.getRowDip(idxDipendente);
|
||||
CognomeNome = $"{rigaDip.Cognome} {rigaDip.Nome} [{idxDipendente}]";
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace GPW.WebUserControls
|
||||
string CognomeNome = "USER ND";
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.getRowDip(idxDipendente);
|
||||
CognomeNome = $"{rigaDip.Cognome} {rigaDip.Nome} [{idxDipendente}]";
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -7,216 +7,214 @@ using System.Web.UI.WebControls;
|
||||
|
||||
namespace GPW.WebUserControls
|
||||
{
|
||||
public partial class mod_mancTimb : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
public partial class mod_mancTimb : System.Web.UI.UserControl
|
||||
{
|
||||
// salvo data corrente x filtraggi...
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
memLayer.ML.setSessionVal("today", DateTime.Today.ToShortDateString());
|
||||
// imposto entrata
|
||||
rblEntrata.SelectedIndex = 0;
|
||||
presetDateTime();
|
||||
chkShowAll.Visible = userCanApprove;
|
||||
}
|
||||
checkFixOds();
|
||||
}
|
||||
|
||||
private void presetDateTime()
|
||||
{
|
||||
// imposto valori selezionati a metà
|
||||
DateTime adesso = DateTime.Now;
|
||||
// arrotondo a 5 minuti...
|
||||
int minuti = adesso.Minute;
|
||||
adesso = adesso.AddMinutes(-minuti).AddMinutes((minuti / 5) * 5);
|
||||
mod_dateTime.valoreDateTime = adesso;
|
||||
}
|
||||
|
||||
public event EventHandler ev_reqUpdate;
|
||||
/// <summary>
|
||||
/// registro timbratura NON APPROVATA
|
||||
/// </summary>
|
||||
/// <param name="isEntrata"></param>
|
||||
/// <returns></returns>
|
||||
private void registraTimbraturaNonApp(bool isEntrata, DateTime dataOra)
|
||||
{
|
||||
// salvo evento entrata...
|
||||
string IPv4 = "";
|
||||
bool approvata = false; // è una richiesta!!!!
|
||||
if (DataProxy.idxDipendente > 0)
|
||||
{
|
||||
// recupero IP
|
||||
IPv4 = Request.UserHostName;
|
||||
DataProxy.DP.taTimb.stp_insTimbMan(DataProxy.idxDipendente, dataOra, isEntrata, IPv4, "NoTim", approvata);
|
||||
logger.lg.scriviLog(string.Format("Richiesta timbratura per il dipendente:{0} in data:{1} isEntrata:{2}", DataProxy.idxDipendente, dataOra, isEntrata), tipoLog.INFO);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog("IdxDipendente non trovato! inserimento timbratura mancante impossibile", tipoLog.INFO);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// salvo richiesta
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnRichMT_Click(object sender, EventArgs e)
|
||||
{
|
||||
logger.lg.scriviLog("Richiesta registrazione timbratura manuale", tipoLog.INFO);
|
||||
// salva una richiesta di timbratura (ovvero approvata = FALSE!!!)
|
||||
DateTime richiesta = DateTime.Now;
|
||||
try
|
||||
{
|
||||
CultureInfo ita = new CultureInfo("it-IT");
|
||||
richiesta = mod_dateTime.valoreDateTime;
|
||||
bool isEntrata = Convert.ToBoolean(rblEntrata.SelectedValue);
|
||||
registraTimbraturaNonApp(isEntrata, richiesta);
|
||||
// aggiorno gridview
|
||||
grView.DataBind();
|
||||
}
|
||||
catch
|
||||
{
|
||||
logger.lg.scriviLog("Errore conversione datetime!");
|
||||
}
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
}
|
||||
/// <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>
|
||||
/// verifica se l'utente possa approvare la modifica oraria
|
||||
/// </summary>
|
||||
public bool userCanApprove
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
answ = DataProxy.DP.taDip2Ruoli.getByDipRuolo(DataProxy.idxDipendente, "AppMancTimb").Rows.Count > 0;
|
||||
// salvo data corrente x filtraggi...
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
memLayer.ML.setSessionVal("today", DateTime.Today.ToShortDateString());
|
||||
// imposto entrata
|
||||
rblEntrata.SelectedIndex = 0;
|
||||
presetDateTime();
|
||||
chkShowAll.Visible = userCanApprove;
|
||||
}
|
||||
checkFixOds();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// calcola cognome-nome da idx
|
||||
/// </summary>
|
||||
/// <param name="idxDip"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// cambia tipo di visualizzaizone
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void chkShowAll_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
checkFixOds();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua fix dell'ods
|
||||
/// </summary>
|
||||
private void checkFixOds()
|
||||
{
|
||||
if (chkShowAll.Checked)
|
||||
{
|
||||
ods.SelectMethod = "getNonAppr";
|
||||
}
|
||||
else
|
||||
{
|
||||
ods.SelectMethod = "getNonApprByDip";
|
||||
}
|
||||
grView.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper x salvare approvazioni
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// salvo approvazione
|
||||
DateTime dataOra = DateTime.Now;
|
||||
int idxDip = 0;
|
||||
try
|
||||
{
|
||||
dataOra = Convert.ToDateTime(grView.SelectedDataKey["dataOra"].ToString());
|
||||
idxDip = Convert.ToInt32(grView.SelectedDataKey["idxDipendente"].ToString());
|
||||
logger.lg.scriviLog(string.Format("Approvazione per dip {0} in data/ora {1}", idxDip, dataOra), tipoLog.INFO);
|
||||
// recupero tab timbr non approvate x dip
|
||||
DS_Applicazione.TimbratureRow rigaTimb = DataProxy.DP.taTimb.getByDipDataOra(idxDip, dataOra)[0];
|
||||
// effettua arrotondamento (aggiunge/toglie)
|
||||
int minOrig = dataOra.Minute;
|
||||
int secOrig = dataOra.Second;
|
||||
int minArr = 0;
|
||||
int step = Convert.ToInt32(txtArrot.Text);
|
||||
if (rigaTimb.entrata)
|
||||
{
|
||||
|
||||
minArr = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(minOrig / step))) * step;
|
||||
}
|
||||
else
|
||||
private void presetDateTime()
|
||||
{
|
||||
minArr = Convert.ToInt32(Math.Floor(Convert.ToDouble(minOrig / step))) * step;
|
||||
// imposto valori selezionati a metà
|
||||
DateTime adesso = DateTime.Now;
|
||||
// arrotondo a 5 minuti...
|
||||
int minuti = adesso.Minute;
|
||||
adesso = adesso.AddMinutes(-minuti).AddMinutes((minuti / 5) * 5);
|
||||
mod_dateTime.valoreDateTime = adesso;
|
||||
}
|
||||
// modifico data del record
|
||||
DataProxy.DP.taTimb.stp_Timbr_modifica(idxDip, dataOra, dataOra.AddMinutes(minArr - minOrig).AddSeconds(-secOrig));
|
||||
// approvo con data modificata
|
||||
DataProxy.DP.taTimb.stp_Timbr_Approva(idxDip, dataOra.AddMinutes(minArr - minOrig).AddSeconds(-secOrig));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// update!
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
}
|
||||
/// <summary>
|
||||
/// sistemo post eliminazione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
|
||||
{
|
||||
chkShowAll.Checked = true;
|
||||
checkFixOds();
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
|
||||
{
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
public event EventHandler ev_reqUpdate;
|
||||
/// <summary>
|
||||
/// registro timbratura NON APPROVATA
|
||||
/// </summary>
|
||||
/// <param name="isEntrata"></param>
|
||||
/// <returns></returns>
|
||||
private void registraTimbraturaNonApp(bool isEntrata, DateTime dataOra)
|
||||
{
|
||||
// salvo evento entrata...
|
||||
string IPv4 = "";
|
||||
bool approvata = false; // è una richiesta!!!!
|
||||
if (DataProxy.idxDipendente > 0)
|
||||
{
|
||||
// recupero IP
|
||||
IPv4 = Request.UserHostName;
|
||||
DataProxy.DP.taTimb.stp_insTimbMan(DataProxy.idxDipendente, dataOra, isEntrata, IPv4, "NoTim", approvata);
|
||||
logger.lg.scriviLog(string.Format("Richiesta timbratura per il dipendente:{0} in data:{1} isEntrata:{2}", DataProxy.idxDipendente, dataOra, isEntrata), tipoLog.INFO);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.lg.scriviLog("IdxDipendente non trovato! inserimento timbratura mancante impossibile", tipoLog.INFO);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// salvo richiesta
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnRichMT_Click(object sender, EventArgs e)
|
||||
{
|
||||
logger.lg.scriviLog("Richiesta registrazione timbratura manuale", tipoLog.INFO);
|
||||
// salva una richiesta di timbratura (ovvero approvata = FALSE!!!)
|
||||
DateTime richiesta = DateTime.Now;
|
||||
try
|
||||
{
|
||||
CultureInfo ita = new CultureInfo("it-IT");
|
||||
richiesta = mod_dateTime.valoreDateTime;
|
||||
bool isEntrata = Convert.ToBoolean(rblEntrata.SelectedValue);
|
||||
registraTimbraturaNonApp(isEntrata, richiesta);
|
||||
// aggiorno gridview
|
||||
grView.DataBind();
|
||||
}
|
||||
catch
|
||||
{
|
||||
logger.lg.scriviLog("Errore conversione datetime!");
|
||||
}
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
}
|
||||
/// <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>
|
||||
/// verifica se l'utente possa approvare la modifica oraria
|
||||
/// </summary>
|
||||
public bool userCanApprove
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
answ = DataProxy.DP.taDip2Ruoli.getByDipRuolo(DataProxy.idxDipendente, "AppMancTimb").Rows.Count > 0;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <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>
|
||||
/// cambia tipo di visualizzaizone
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void chkShowAll_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
checkFixOds();
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua fix dell'ods
|
||||
/// </summary>
|
||||
private void checkFixOds()
|
||||
{
|
||||
if (chkShowAll.Checked)
|
||||
{
|
||||
ods.SelectMethod = "getNonAppr";
|
||||
}
|
||||
else
|
||||
{
|
||||
ods.SelectMethod = "getNonApprByDip";
|
||||
}
|
||||
grView.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// wrapper x salvare approvazioni
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// salvo approvazione
|
||||
DateTime dataOra = DateTime.Now;
|
||||
int idxDip = 0;
|
||||
try
|
||||
{
|
||||
dataOra = Convert.ToDateTime(grView.SelectedDataKey["dataOra"].ToString());
|
||||
idxDip = Convert.ToInt32(grView.SelectedDataKey["idxDipendente"].ToString());
|
||||
logger.lg.scriviLog(string.Format("Approvazione per dip {0} in data/ora {1}", idxDip, dataOra), tipoLog.INFO);
|
||||
// recupero tab timbr non approvate x dip
|
||||
DS_Applicazione.TimbratureRow rigaTimb = DataProxy.DP.taTimb.getByDipDataOra(idxDip, dataOra)[0];
|
||||
// effettua arrotondamento (aggiunge/toglie)
|
||||
int minOrig = dataOra.Minute;
|
||||
int secOrig = dataOra.Second;
|
||||
int minArr = 0;
|
||||
int step = Convert.ToInt32(txtArrot.Text);
|
||||
if (rigaTimb.entrata)
|
||||
{
|
||||
|
||||
minArr = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(minOrig / step))) * step;
|
||||
}
|
||||
else
|
||||
{
|
||||
minArr = Convert.ToInt32(Math.Floor(Convert.ToDouble(minOrig / step))) * step;
|
||||
}
|
||||
// modifico data del record
|
||||
DataProxy.DP.taTimb.stp_Timbr_modifica(idxDip, dataOra, dataOra.AddMinutes(minArr - minOrig).AddSeconds(-secOrig));
|
||||
// approvo con data modificata
|
||||
DataProxy.DP.taTimb.stp_Timbr_Approva(idxDip, dataOra.AddMinutes(minArr - minOrig).AddSeconds(-secOrig));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// update!
|
||||
grView.SelectedIndex = -1;
|
||||
grView.DataBind();
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
}
|
||||
/// <summary>
|
||||
/// sistemo post eliminazione
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
|
||||
{
|
||||
chkShowAll.Checked = true;
|
||||
checkFixOds();
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
|
||||
{
|
||||
// sollevo evento
|
||||
ev_reqUpdate?.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace GPW.WebUserControls
|
||||
try
|
||||
{
|
||||
idxDipendente = Convert.ToInt32(ddlIdxDipendente.SelectedValue);
|
||||
dipendente = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
dipendente = DataProxy.DP.getRowDip(idxDipendente);
|
||||
UserAuthKey = dipendente.authKey;
|
||||
destinatario = dipendente.email;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user