In test QUALCOSA funziona...
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_menuTop.ascx.cs" Inherits="GPW_Smart.WebUserControls.cmp_menuTop" %>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark text-light">
|
||||
<a class="navbar-brand" href="#">Sauder NKC <i class="fa fa-object-group" aria-hidden="true"></i></a>
|
||||
<a class="navbar-brand" href="#"><asp:Label runat="server" ID="lblSwData" /> <i class="fa fa-clock-o" aria-hidden="true"></i></a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
using SteamWare;
|
||||
using GPW_data;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
|
||||
namespace GPW_Smart.WebUserControls
|
||||
{
|
||||
public partial class cmp_menuTop : System.Web.UI.UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// user agent corrente
|
||||
/// </summary>
|
||||
protected string userAgent = "";
|
||||
/// <summary>
|
||||
/// IP corrente
|
||||
/// </summary>
|
||||
protected string postazione_IP = "";
|
||||
/// <summary>
|
||||
/// gestione evento refresh
|
||||
/// </summary>
|
||||
public event EventHandler eh_doRefresh;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -13,6 +26,99 @@ namespace GPW_Smart.WebUserControls
|
||||
{
|
||||
searchVal = "";
|
||||
}
|
||||
// controllo se c'è utente in sessione..
|
||||
checkUser();
|
||||
// sistemo visualizzazione
|
||||
postazione_IP = Request.UserHostName;
|
||||
try
|
||||
{
|
||||
lblSwData.Text = memLayer.ML.StringSessionObj("cognomeNome");
|
||||
}
|
||||
catch
|
||||
{
|
||||
lblSwData.Text = "GPW";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica presenza utente autorizzato in sessione
|
||||
/// </summary>
|
||||
private void checkUser()
|
||||
{
|
||||
if (!memLayer.ML.isInSessionObject("idxDipendente"))
|
||||
{
|
||||
// controllo cookie device...
|
||||
checkAuthCookieGPW();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica al presenza di un cookie VALIDO per autorizzare il device
|
||||
/// </summary>
|
||||
private void checkAuthCookieGPW()
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies["AuthGPW"];
|
||||
if (cookie == null || cookie.Value == "")
|
||||
{
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("~/regNewDevice.aspx");
|
||||
}
|
||||
else
|
||||
{
|
||||
// ricavo utente da cookie...
|
||||
string devSecret = cookie.Value;
|
||||
DS_Applicazione.AnagDevicesRow device = null;
|
||||
// cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
|
||||
int idxDipendente = 0;
|
||||
try
|
||||
{
|
||||
device = DataProxy.DP.taAnagDev.getByDeviceSecret(devSecret)[0];
|
||||
idxDipendente = device.idxDipendente;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (idxDipendente > 0)
|
||||
{
|
||||
// aggiorno descrizione (user agent) ed IP...
|
||||
userAgent = Request.UserAgent;
|
||||
postazione_IP = Request.UserHostName;
|
||||
// controllo IP e DeviceDescription x eventuale update
|
||||
if ((device.lastIPv4 != postazione_IP) || (device.Description != userAgent))
|
||||
{
|
||||
// salvo ultimo "contatto" del device aggiornando descrizione ed IP
|
||||
DataProxy.DP.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
|
||||
}
|
||||
// salvo in sessione utente
|
||||
memLayer.ML.setSessionVal("idxDipendente", idxDipendente);
|
||||
string CognomeNome = "";
|
||||
string email = "";
|
||||
string hashEmail = "";
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
CognomeNome = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
email = rigaDip.email;
|
||||
hashEmail = SteamCrypto.getHashStringMD5(email);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
memLayer.ML.setSessionVal("cognomeNome", CognomeNome);
|
||||
memLayer.ML.setSessionVal("email", email);
|
||||
memLayer.ML.setSessionVal("hashEmail", hashEmail);
|
||||
}
|
||||
else
|
||||
{
|
||||
// svuoto cookie...
|
||||
memLayer.ML.emptyCookieVal("AuthGPW");
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("~/regNewDevice.aspx");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta visibilità search globale
|
||||
|
||||
@@ -12,6 +12,15 @@ namespace GPW_Smart.WebUserControls {
|
||||
|
||||
public partial class cmp_menuTop {
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lblSwData.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblSwData;
|
||||
|
||||
/// <summary>
|
||||
/// Controllo divSearch.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_timbrature.ascx.cs" Inherits="GPW.WebUserControls.mod_timbrature" %>
|
||||
<div class="ui-grid-a">
|
||||
<div class="ui-block-a ui-content">
|
||||
<asp:Button runat="server" CssClass="ui-btn ui-btn-icon-left ui-shadow ui-corner-all clr-btn-blue" data-icon="check" ID="btnEntrata" Text="Entrata" OnClick="btnEntrata_Click" Width="100%" />
|
||||
</div>
|
||||
<div class="ui-block-b">
|
||||
<asp:Button runat="server" CssClass="ui-btn ui-btn-icon-left ui-shadow ui-corner-all clr-btn-green" data-icon="check" ID="btnUscita" Text="Uscita" OnClick="btnUscita_Click" Width="100%" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<asp:LinkButton runat="server" CssClass="btn btn-primary btn-block" ID="lbtEntrata" OnClick="lbtEntrata_Click"><i class="fa fa-sign-in" aria-hidden="true"></i> Entrata</asp:LinkButton>
|
||||
</div>
|
||||
<div class="col">
|
||||
<asp:LinkButton runat="server" CssClass="btn btn-success btn-block" ID="lbtUscita" OnClick="lbtUscita_Click">Uscita <i class="fa fa-sign-out" aria-hidden="true"></i></asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
<asp:Label runat="server" ID="lblWarning" Visible="false" />
|
||||
<div class="elTimbSmart">
|
||||
<asp:GridView ID="grView" runat="server" AllowPaging="false" DataSourceID="ods" AutoGenerateColumns="False" DataKeyNames="dataLav,idxDipendente" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" OnRowCreated="grView_RowCreated" OnSelectedIndexChanged="grView_SelectedIndexChanged">
|
||||
<AlternatingRowStyle BackColor="White" />
|
||||
<asp:GridView ID="grView" runat="server" AllowPaging="false" DataSourceID="ods" AutoGenerateColumns="False" DataKeyNames="dataLav,idxDipendente" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" OnRowCreated="grView_RowCreated" OnSelectedIndexChanged="grView_SelectedIndexChanged" CssClass="table table-striped table-sm">
|
||||
<%--<AlternatingRowStyle BackColor="White" />
|
||||
<EditRowStyle BackColor="#2461BF" />
|
||||
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
|
||||
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
|
||||
@@ -20,68 +20,67 @@
|
||||
<SortedAscendingCellStyle BackColor="#F5F7FB" />
|
||||
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
|
||||
<SortedDescendingCellStyle BackColor="#E9EBEF" />
|
||||
<SortedDescendingHeaderStyle BackColor="#4870BE" />
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="data" SortExpression="dataLav" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" ID="lbShowOre" CommandArgument="showProj" CommandName="Select" data-inline="true"><%# Eval("dataLav", "{0:MM.dd} <sup>{0:ddd}</sup>") %></asp:LinkButton>
|
||||
<%--<asp:Label ID="Label1" runat="server" Text='<%# Eval("dataLav", "{0:MM-dd ddd}") %>' />--%>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Ent" SortExpression="entrata_1" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label3" runat="server" Text='<%# Eval("entrata_1","{0:HH:mm}") %>' ForeColor="#226622" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Usc" SortExpression="uscita_1" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label4" runat="server" Text='<%# Eval("uscita_1","{0:HH:mm}") %>' ForeColor="#222266" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Ent" SortExpression="entrata_2" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label5" runat="server" Text='<%# Eval("entrata_2","{0:HH:mm}") %>' ForeColor="#226622" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Usc" SortExpression="uscita_2" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label6" runat="server" Text='<%# Eval("uscita_2","{0:HH:mm}") %>' ForeColor="#222266" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Ent" SortExpression="entrata_3" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label7" runat="server" Text='<%# Eval("entrata_3","{0:HH:mm}") %>' ForeColor="#226622" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Usc" SortExpression="uscita_3" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label8" runat="server" Text='<%# Eval("uscita_3","{0:HH:mm}") %>' ForeColor="#222266" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="H lav" SortExpression="h_lav" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<b>
|
||||
<asp:Label ID="Label11" runat="server" Text='<%# Eval("h_lav","{0:0.00}") %>' />
|
||||
</b>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<b>
|
||||
<asp:Label ID="lblIsOk" runat="server" Text="*" ForeColor="Red" Visible='<%# invBool(Eval("isOk")) %>' />
|
||||
</b>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="Original_{0}" SelectMethod="getLastByUser" TypeName="GPW_data.DS_ApplicazioneTableAdapters.TimbratureExplTableAdapter" UpdateMethod="Update" FilterExpression="idxDipendente = {0} AND (NOT (entrata_1 IS NULL) )">
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter SessionField="idxDipendente" Name="idxDipendente" Type="Int32" />
|
||||
</FilterParameters>
|
||||
<SelectParameters>
|
||||
<asp:SessionParameter SessionField="idxDipendente" Name="idxDipendente" Type="Int32" />
|
||||
<asp:SessionParameter SessionField="numRowTimb" Name="num2show" Type="Int32" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<SortedDescendingHeaderStyle BackColor="#4870BE" />--%>
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="data" SortExpression="dataLav" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" ID="lbShowOre" CommandArgument="showProj" CommandName="Select" CssClass="btn btn-dark btn-sm px-1 py-0"><%# Eval("dataLav", "{0:MM.dd} <sup>{0:ddd}</sup>") %></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Ent" SortExpression="entrata_1" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label3" runat="server" Text='<%# Eval("entrata_1","{0:HH:mm}") %>' ForeColor="#226622" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Usc" SortExpression="uscita_1" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label4" runat="server" Text='<%# Eval("uscita_1","{0:HH:mm}") %>' ForeColor="#222266" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Ent" SortExpression="entrata_2" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label5" runat="server" Text='<%# Eval("entrata_2","{0:HH:mm}") %>' ForeColor="#226622" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Usc" SortExpression="uscita_2" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label6" runat="server" Text='<%# Eval("uscita_2","{0:HH:mm}") %>' ForeColor="#222266" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Ent" SortExpression="entrata_3" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label7" runat="server" Text='<%# Eval("entrata_3","{0:HH:mm}") %>' ForeColor="#226622" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Usc" SortExpression="uscita_3" ItemStyle-HorizontalAlign="Center">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label8" runat="server" Text='<%# Eval("uscita_3","{0:HH:mm}") %>' ForeColor="#222266" Font-Size="Smaller" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="H lav" SortExpression="h_lav" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<b>
|
||||
<asp:Label ID="Label11" runat="server" Text='<%# Eval("h_lav","{0:0.00}") %>' />
|
||||
</b>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<b>
|
||||
<asp:Label ID="lblIsOk" runat="server" Text="*" ForeColor="Red" Visible='<%# invBool(Eval("isOk")) %>' />
|
||||
</b>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="Original_{0}" SelectMethod="getLastByUser" TypeName="GPW_data.DS_ApplicazioneTableAdapters.TimbratureExplTableAdapter" UpdateMethod="Update" FilterExpression="idxDipendente = {0} AND (NOT (entrata_1 IS NULL) )">
|
||||
<FilterParameters>
|
||||
<asp:SessionParameter SessionField="idxDipendente" Name="idxDipendente" Type="Int32" />
|
||||
</FilterParameters>
|
||||
<SelectParameters>
|
||||
<asp:SessionParameter SessionField="idxDipendente" Name="idxDipendente" Type="Int32" />
|
||||
<asp:SessionParameter SessionField="numRowTimb" Name="num2show" Type="Int32" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,230 +1,232 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using GPW_data;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using SteamWare;
|
||||
using GPW_data;
|
||||
|
||||
namespace GPW.WebUserControls
|
||||
{
|
||||
public partial class mod_timbrature : System.Web.UI.UserControl
|
||||
public partial class mod_timbrature : System.Web.UI.UserControl
|
||||
{
|
||||
protected bool forceButtons = true;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
protected bool forceButtons = true;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
// verifico se ci sia un numero di righe selezionate altrimenti lo imposto...
|
||||
if (!memLayer.ML.isInSessionObject("numColEU")) numColEU = 2;
|
||||
if (!memLayer.ML.isInSessionObject("numRowTimb")) numRowTimb = 10;
|
||||
memLayer.ML.setSessionVal("dataRif", DateTime.Today);
|
||||
}
|
||||
setButtons();
|
||||
}
|
||||
|
||||
public int numColEU
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 2;
|
||||
try
|
||||
{
|
||||
answ = memLayer.ML.IntSessionObj("numColEU");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (answ <= 0) answ = 2;
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("numColEU", value);
|
||||
}
|
||||
}
|
||||
public int numRowTimb
|
||||
{
|
||||
get
|
||||
{
|
||||
return memLayer.ML.IntSessionObj("numRowTimb");
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("numRowTimb", value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposto highlight di un area intorno al button
|
||||
/// </summary>
|
||||
private void setButtons()
|
||||
{
|
||||
// controllo SE voglio inibire i buttons...
|
||||
if (forceButtons)
|
||||
{
|
||||
// controllo se il prox comando DOVREBBE essere entrata o uscita
|
||||
bool nextIsEntrata = true;
|
||||
// controllo dipendente
|
||||
if (IdxDipendente > 0)
|
||||
{
|
||||
// ricavo ultima timbratura..
|
||||
nextIsEntrata = timbratrice.nextIsEntrata(IdxDipendente);
|
||||
// di conseguenza cambio abilitazione ad un buttons
|
||||
if (nextIsEntrata)
|
||||
{
|
||||
btnEntrata.Enabled = true;
|
||||
btnUscita.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
btnEntrata.Enabled = false;
|
||||
btnUscita.Enabled = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
btnEntrata.Enabled = false;
|
||||
btnUscita.Enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
btnEntrata.Enabled = true;
|
||||
btnUscita.Enabled = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// timbro entrata...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnEntrata_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool isEntrata = true;
|
||||
registraTimbratura(isEntrata);
|
||||
}
|
||||
/// <summary>
|
||||
/// uscita...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnUscita_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool isEntrata = false;
|
||||
registraTimbratura(isEntrata);
|
||||
}
|
||||
/// <summary>
|
||||
/// Abilita tutti i buttons
|
||||
/// </summary>
|
||||
public void abilitaAll()
|
||||
{
|
||||
forceButtons = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorno visualizzazione
|
||||
/// </summary>
|
||||
public void doUpdate()
|
||||
{
|
||||
setButtons();
|
||||
grView.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// update elenco ultime timbrature
|
||||
/// </summary>
|
||||
private void updateTimbrature()
|
||||
{
|
||||
// aggiorno datagrid
|
||||
}
|
||||
/// <summary>
|
||||
/// registro timbratura
|
||||
/// </summary>
|
||||
/// <param name="isEntrata"></param>
|
||||
/// <returns></returns>
|
||||
private int registraTimbratura(bool isEntrata)
|
||||
{
|
||||
// salvo evento entrata...
|
||||
string IPv4 = "";
|
||||
bool approvata = false;
|
||||
if (IdxDipendente > 0)
|
||||
{
|
||||
// recupero IP
|
||||
IPv4 = Request.UserHostName;
|
||||
// controllo se IP locale = approvata...
|
||||
if (IPv4.Contains(memLayer.ML.confReadString("localNet")))
|
||||
{
|
||||
approvata = true;
|
||||
}
|
||||
timbratrice.registraTimbratura(IdxDipendente, DateTime.Now, isEntrata, IPv4, "Web", approvata);
|
||||
lblWarning.Visible = false;
|
||||
//aggiorno timbrature visualizzate
|
||||
setButtons();
|
||||
updateTimbrature();
|
||||
grView.DataBind();
|
||||
}
|
||||
else
|
||||
{
|
||||
lblWarning.Text = "IdxDipendente non trovato! timbratura impossibile";
|
||||
lblWarning.Visible = true;
|
||||
}
|
||||
return IdxDipendente;
|
||||
}
|
||||
/// <summary>
|
||||
/// idx dipendente loggato
|
||||
/// </summary>
|
||||
protected int IdxDipendente
|
||||
{
|
||||
get
|
||||
{
|
||||
int idx = 0;
|
||||
try
|
||||
{
|
||||
idx = memLayer.ML.IntSessionObj("IdxDipendente");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
/// <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;
|
||||
}
|
||||
|
||||
protected void grView_RowCreated(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
int maxNum = e.Row.Cells.Count - 2;
|
||||
for (int i = numColEU * 2 + 1; i < maxNum; i++)
|
||||
{
|
||||
e.Row.Cells[i].Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// rimando ai progetti sulla data indicata...
|
||||
DateTime dataRif = DateTime.Today;
|
||||
try
|
||||
{
|
||||
dataRif = Convert.ToDateTime(grView.SelectedDataKey["dataLav"]);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// salvo in sessione...
|
||||
memLayer.ML.setSessionVal("dataRif", dataRif);
|
||||
// reinvio
|
||||
Response.Redirect(string.Format("Progetti?dataRif={0:yyyy-MM-dd}", dataRif));
|
||||
}
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
// verifico se ci sia un numero di righe selezionate altrimenti lo imposto...
|
||||
if (!memLayer.ML.isInSessionObject("numColEU")) numColEU = 2;
|
||||
if (!memLayer.ML.isInSessionObject("numRowTimb")) numRowTimb = 10;
|
||||
memLayer.ML.setSessionVal("dataRif", DateTime.Today);
|
||||
}
|
||||
setButtons();
|
||||
}
|
||||
|
||||
public int numColEU
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 2;
|
||||
try
|
||||
{
|
||||
answ = memLayer.ML.IntSessionObj("numColEU");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (answ <= 0) answ = 2;
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("numColEU", value);
|
||||
}
|
||||
}
|
||||
public int numRowTimb
|
||||
{
|
||||
get
|
||||
{
|
||||
return memLayer.ML.IntSessionObj("numRowTimb");
|
||||
}
|
||||
set
|
||||
{
|
||||
memLayer.ML.setSessionVal("numRowTimb", value);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposto highlight di un area intorno al button
|
||||
/// </summary>
|
||||
private void setButtons()
|
||||
{
|
||||
// controllo SE voglio inibire i buttons...
|
||||
if (forceButtons)
|
||||
{
|
||||
// controllo se il prox comando DOVREBBE essere entrata o uscita
|
||||
bool nextIsEntrata = true;
|
||||
// controllo dipendente
|
||||
if (IdxDipendente > 0)
|
||||
{
|
||||
// ricavo ultima timbratura..
|
||||
nextIsEntrata = timbratrice.nextIsEntrata(IdxDipendente);
|
||||
// di conseguenza cambio abilitazione ad un buttons
|
||||
if (nextIsEntrata)
|
||||
{
|
||||
fixBtnInOut(true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
fixBtnInOut(false, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fixBtnInOut(false, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fixBtnInOut(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void fixBtnInOut(bool showIn, bool showOut)
|
||||
{
|
||||
lbtEntrata.Enabled = showIn;
|
||||
lbtUscita.Enabled = showOut;
|
||||
lbtEntrata.CssClass = showIn ? "btn btn-primary btn-block" : "btn btn-outline-primary disabled btn-block";
|
||||
lbtUscita.CssClass = showOut ? "btn btn-success btn-block" : "btn btn-outline-success disabled btn-block";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// timbro entrata...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lbtEntrata_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool isEntrata = true;
|
||||
registraTimbratura(isEntrata);
|
||||
}
|
||||
/// <summary>
|
||||
/// uscita...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void lbtUscita_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool isEntrata = false;
|
||||
registraTimbratura(isEntrata);
|
||||
}
|
||||
/// <summary>
|
||||
/// Abilita tutti i buttons
|
||||
/// </summary>
|
||||
public void abilitaAll()
|
||||
{
|
||||
forceButtons = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorno visualizzazione
|
||||
/// </summary>
|
||||
public void doUpdate()
|
||||
{
|
||||
setButtons();
|
||||
grView.DataBind();
|
||||
}
|
||||
/// <summary>
|
||||
/// update elenco ultime timbrature
|
||||
/// </summary>
|
||||
private void updateTimbrature()
|
||||
{
|
||||
// aggiorno datagrid
|
||||
}
|
||||
/// <summary>
|
||||
/// registro timbratura
|
||||
/// </summary>
|
||||
/// <param name="isEntrata"></param>
|
||||
/// <returns></returns>
|
||||
private int registraTimbratura(bool isEntrata)
|
||||
{
|
||||
// salvo evento entrata...
|
||||
string IPv4 = "";
|
||||
bool approvata = false;
|
||||
if (IdxDipendente > 0)
|
||||
{
|
||||
// recupero IP
|
||||
IPv4 = Request.UserHostName;
|
||||
// controllo se IP locale = approvata...
|
||||
if (IPv4.Contains(memLayer.ML.confReadString("localNet")))
|
||||
{
|
||||
approvata = true;
|
||||
}
|
||||
timbratrice.registraTimbratura(IdxDipendente, DateTime.Now, isEntrata, IPv4, "Web", approvata);
|
||||
lblWarning.Visible = false;
|
||||
//aggiorno timbrature visualizzate
|
||||
setButtons();
|
||||
updateTimbrature();
|
||||
grView.DataBind();
|
||||
}
|
||||
else
|
||||
{
|
||||
lblWarning.Text = "IdxDipendente non trovato! timbratura impossibile";
|
||||
lblWarning.Visible = true;
|
||||
}
|
||||
return IdxDipendente;
|
||||
}
|
||||
/// <summary>
|
||||
/// idx dipendente loggato
|
||||
/// </summary>
|
||||
protected int IdxDipendente
|
||||
{
|
||||
get
|
||||
{
|
||||
int idx = 0;
|
||||
try
|
||||
{
|
||||
idx = memLayer.ML.IntSessionObj("IdxDipendente");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
/// <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;
|
||||
}
|
||||
|
||||
protected void grView_RowCreated(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
int maxNum = e.Row.Cells.Count - 2;
|
||||
for (int i = numColEU * 2 + 1; i < maxNum; i++)
|
||||
{
|
||||
e.Row.Cells[i].Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// rimando ai progetti sulla data indicata...
|
||||
DateTime dataRif = DateTime.Today;
|
||||
try
|
||||
{
|
||||
dataRif = Convert.ToDateTime(grView.SelectedDataKey["dataLav"]);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// salvo in sessione...
|
||||
memLayer.ML.setSessionVal("dataRif", dataRif);
|
||||
// reinvio
|
||||
Response.Redirect(string.Format("Progetti?dataRif={0:yyyy-MM-dd}", dataRif));
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-22
@@ -1,10 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GPW.WebUserControls {
|
||||
@@ -13,47 +13,47 @@ namespace GPW.WebUserControls {
|
||||
public partial class mod_timbrature {
|
||||
|
||||
/// <summary>
|
||||
/// btnEntrata control.
|
||||
/// Controllo lbtEntrata.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnEntrata;
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtEntrata;
|
||||
|
||||
/// <summary>
|
||||
/// btnUscita control.
|
||||
/// Controllo lbtUscita.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnUscita;
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtUscita;
|
||||
|
||||
/// <summary>
|
||||
/// lblWarning control.
|
||||
/// Controllo lblWarning.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblWarning;
|
||||
|
||||
/// <summary>
|
||||
/// grView control.
|
||||
/// Controllo grView.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView grView;
|
||||
|
||||
/// <summary>
|
||||
/// ods control.
|
||||
/// Controllo ods.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
|
||||
}
|
||||
|
||||
@@ -1,121 +1,117 @@
|
||||
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;
|
||||
using GPW_data;
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace GPW.WebUserControls
|
||||
{
|
||||
public partial class mod_title : System.Web.UI.UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// user agent corrente
|
||||
/// </summary>
|
||||
protected string userAgent = "";
|
||||
/// <summary>
|
||||
/// IP corrente
|
||||
/// </summary>
|
||||
protected string postazione_IP = "";
|
||||
public partial class mod_title : System.Web.UI.UserControl
|
||||
{
|
||||
/// <summary>
|
||||
/// user agent corrente
|
||||
/// </summary>
|
||||
protected string userAgent = "";
|
||||
/// <summary>
|
||||
/// IP corrente
|
||||
/// </summary>
|
||||
protected string postazione_IP = "";
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// controllo se c'è utente in sessione..
|
||||
checkUser();
|
||||
// sistemo visualizzazione
|
||||
postazione_IP = Request.UserHostName;
|
||||
try
|
||||
{
|
||||
lblSwData.Text = memLayer.ML.StringSessionObj("cognomeNome");
|
||||
}
|
||||
catch
|
||||
{
|
||||
lblSwData.Text = "GPW";
|
||||
}
|
||||
//lblIpData.Text = memLayer.ML.StringSessionObj("cognomeNome");
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica presenza utente autorizzato in sessione
|
||||
/// </summary>
|
||||
private void checkUser()
|
||||
{
|
||||
if (!memLayer.ML.isInSessionObject("idxDipendente"))
|
||||
{
|
||||
// controllo cookie device...
|
||||
checkAuthCookieGPW();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica al presenza di un cookie VALIDO per autorizzare il device
|
||||
/// </summary>
|
||||
private void checkAuthCookieGPW()
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies["AuthGPW"];
|
||||
if (cookie == null || cookie.Value == "")
|
||||
{
|
||||
// controllo se c'è utente in sessione..
|
||||
checkUser();
|
||||
// sistemo visualizzazione
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("~/regNewDevice.aspx");
|
||||
}
|
||||
else
|
||||
{
|
||||
// ricavo utente da cookie...
|
||||
string devSecret = cookie.Value;
|
||||
DS_Applicazione.AnagDevicesRow device = null;
|
||||
// cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
|
||||
int idxDipendente = 0;
|
||||
try
|
||||
{
|
||||
device = DataProxy.DP.taAnagDev.getByDeviceSecret(devSecret)[0];
|
||||
idxDipendente = device.idxDipendente;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (idxDipendente > 0)
|
||||
{
|
||||
// aggiorno descrizione (user agent) ed IP...
|
||||
userAgent = Request.UserAgent;
|
||||
postazione_IP = Request.UserHostName;
|
||||
// controllo IP e DeviceDescription x eventuale update
|
||||
if ((device.lastIPv4 != postazione_IP) || (device.Description != userAgent))
|
||||
{
|
||||
// salvo ultimo "contatto" del device aggiornando descrizione ed IP
|
||||
DataProxy.DP.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
|
||||
}
|
||||
// salvo in sessione utente
|
||||
memLayer.ML.setSessionVal("idxDipendente", idxDipendente);
|
||||
string CognomeNome = "";
|
||||
string email = "";
|
||||
string hashEmail = "";
|
||||
try
|
||||
{
|
||||
lblSwData.Text = memLayer.ML.StringSessionObj("cognomeNome");
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
CognomeNome = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
email = rigaDip.email;
|
||||
hashEmail = SteamCrypto.getHashStringMD5(email);
|
||||
}
|
||||
catch
|
||||
{
|
||||
lblSwData.Text = "GPW";
|
||||
}
|
||||
//lblIpData.Text = memLayer.ML.StringSessionObj("cognomeNome");
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica presenza utente autorizzato in sessione
|
||||
/// </summary>
|
||||
private void checkUser()
|
||||
{
|
||||
if (!memLayer.ML.isInSessionObject("idxDipendente"))
|
||||
{
|
||||
// controllo cookie device...
|
||||
checkAuthCookieGPW();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica al presenza di un cookie VALIDO per autorizzare il device
|
||||
/// </summary>
|
||||
private void checkAuthCookieGPW()
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpCookie cookie = Request.Cookies["AuthGPW"];
|
||||
if (cookie == null || cookie.Value=="")
|
||||
{
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("~/regNewDevice.aspx");
|
||||
}
|
||||
else
|
||||
{
|
||||
// ricavo utente da cookie...
|
||||
string devSecret = cookie.Value;
|
||||
DS_Applicazione.AnagDevicesRow device = null;
|
||||
// cerco il device...ogni dipendente può averne + di 1 registrato a suo nome...
|
||||
int idxDipendente = 0;
|
||||
try
|
||||
{
|
||||
device = DataProxy.DP.taAnagDev.getByDeviceSecret(devSecret)[0];
|
||||
idxDipendente = device.idxDipendente;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (idxDipendente > 0)
|
||||
{
|
||||
// aggiorno descrizione (user agent) ed IP...
|
||||
userAgent = Request.UserAgent;
|
||||
postazione_IP = Request.UserHostName;
|
||||
// controllo IP e DeviceDescription x eventuale update
|
||||
if ((device.lastIPv4 != postazione_IP) || (device.Description != userAgent))
|
||||
{
|
||||
// salvo ultimo "contatto" del device aggiornando descrizione ed IP
|
||||
DataProxy.DP.taAnagDev.updateIP(device.IdxDevice, DateTime.Now, postazione_IP, userAgent);
|
||||
}
|
||||
// salvo in sessione utente
|
||||
memLayer.ML.setSessionVal("idxDipendente", idxDipendente);
|
||||
string CognomeNome = "";
|
||||
string email = "";
|
||||
string hashEmail = "";
|
||||
try
|
||||
{
|
||||
DS_Applicazione.DipendentiRow rigaDip = DataProxy.DP.taDipendenti.getByIdx(idxDipendente)[0];
|
||||
CognomeNome = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
|
||||
email = rigaDip.email;
|
||||
hashEmail = SteamCrypto.getHashStringMD5(email);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
memLayer.ML.setSessionVal("cognomeNome", CognomeNome);
|
||||
memLayer.ML.setSessionVal("email", email);
|
||||
memLayer.ML.setSessionVal("hashEmail", hashEmail);
|
||||
}
|
||||
else
|
||||
{
|
||||
// svuoto cookie...
|
||||
memLayer.ML.emptyCookieVal("AuthGPW");
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("~/regNewDevice.aspx");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
{ }
|
||||
memLayer.ML.setSessionVal("cognomeNome", CognomeNome);
|
||||
memLayer.ML.setSessionVal("email", email);
|
||||
memLayer.ML.setSessionVal("hashEmail", hashEmail);
|
||||
}
|
||||
else
|
||||
{
|
||||
// svuoto cookie...
|
||||
memLayer.ML.emptyCookieVal("AuthGPW");
|
||||
// rimando pagina x registrazione devices
|
||||
Response.Redirect("~/regNewDevice.aspx");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
logger.lg.scriviLog(string.Format("Errore in checkAuthCookie:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user