@@ -334,4 +335,5 @@
\ No newline at end of file
+ TypeName="GPW_data.DS_UtilityTableAdapters.v_selGruppiTableAdapter">
+
\ No newline at end of file
diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs
index d577b9c..68bc8e4 100644
--- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs
+++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.cs
@@ -33,6 +33,20 @@ namespace GPW_Admin.WebUserControls
}
}
+ public bool isTicketReq
+ {
+ get
+ {
+ bool answ = false;
+ bool.TryParse(hfReqTicket.Value, out answ);
+ return answ;
+ }
+ set
+ {
+ hfReqTicket.Value = $"{value}";
+ }
+ }
+
public int numLicenze
{
get => licenzeGPW.licenzeAttive;
@@ -104,6 +118,7 @@ namespace GPW_Admin.WebUserControls
///
protected void btnReset_Click(object sender, EventArgs e)
{
+ isTicketReq = false;
resetSelezione();
}
@@ -164,7 +179,7 @@ namespace GPW_Admin.WebUserControls
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
- // mostro gestione licenza DIP
+ // altrimenti mostro gestione licenza DIP
raiseAddNew();
}
@@ -232,6 +247,26 @@ namespace GPW_Admin.WebUserControls
grView.DataBind();
}
+ ///
+ /// Richiesta selezione utente
+ ///
+ ///
+ ///
+ protected void lbtSelect_Click(object sender, EventArgs e)
+ {
+ isTicketReq = false;
+ }
+
+ ///
+ /// Richiesta inserimento ticket supporto
+ ///
+ ///
+ ///
+ protected void lbtTicket_Click(object sender, EventArgs e)
+ {
+ isTicketReq = true;
+ }
+
///
/// check licenze in fase di update...
///
@@ -260,6 +295,7 @@ namespace GPW_Admin.WebUserControls
{
if (!Page.IsPostBack)
{
+ isTicketReq = false;
fullRefresh();
}
fixVisibility();
@@ -342,6 +378,37 @@ namespace GPW_Admin.WebUserControls
#region Public Methods
+ ///
+ /// Verifica licenza (se sia libera x modifca o prima associazione)
+ ///
+ ///
+ ///
+ public bool checkFreeEdit(object idxDip)
+ {
+ bool answ = false;
+ int IdxDip = 0;
+ int.TryParse($"{idxDip}", out IdxDip);
+ if (IdxDip > 0)
+ {
+ var localUserList = DataProxy.DP.taDipendenti.getAttivi(false);
+ // cerco!
+ var currUser = localUserList.Where(x => x.idxDipendente == IdxDip).FirstOrDefault();
+
+ // verifico SE sia disponibile licenza...
+ var activationsList = licenzeGPW.ListaAttivazioni;
+ var currHash = DataProxy.DP.hashCodImpiego(currUser);
+ var currAct = activationsList.Where(x => x.CodImpiego == currHash).FirstOrDefault();
+ // se NON c'è licenza è ok (editabile)
+ answ = (currAct == null);
+ // ora verifico: se NON ha licenza OK, altrimenti deve essere scaduta...
+ if (!answ)
+ {
+ answ = currAct.VetoUnlock < DateTime.Today;
+ }
+ }
+ return answ;
+ }
+
///
/// Verifica licenza (se sia validata/associata a quelle in memoria)
///
diff --git a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs
index f830949..991d9d7 100644
--- a/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs
+++ b/GPW_Admin/WebUserControls/mod_adminDipendenti.ascx.designer.cs
@@ -103,5 +103,14 @@ namespace GPW_Admin.WebUserControls
/// To modify move field declaration from designer file to code-behind file.
///
protected global::System.Web.UI.WebControls.ObjectDataSource odsGruppi;
+
+ ///
+ /// hfReqTicket control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.HiddenField hfReqTicket;
}
}
diff --git a/GPW_Admin/dipendenti.aspx b/GPW_Admin/dipendenti.aspx
index e2475e1..4f7f265 100644
--- a/GPW_Admin/dipendenti.aspx
+++ b/GPW_Admin/dipendenti.aspx
@@ -5,6 +5,7 @@
<%@ Register Src="~/WebUserControls/cmp_userCard.ascx" TagPrefix="uc1" TagName="cmp_userCard" %>
<%@ Register Src="~/WebUserControls/cmp_toggle.ascx" TagPrefix="uc1" TagName="cmp_toggle" %>
<%@ Register Src="~/WebUserControls/cmp_userLicense.ascx" TagPrefix="uc1" TagName="cmp_userLicense" %>
+<%@ Register Src="~/WebUserControls/cmp_ticketFreeActiv.ascx" TagPrefix="uc1" TagName="cmp_ticketFreeActiv" %>
@@ -23,6 +24,7 @@
+
diff --git a/GPW_Admin/dipendenti.aspx.cs b/GPW_Admin/dipendenti.aspx.cs
index b833b05..acfd8ad 100644
--- a/GPW_Admin/dipendenti.aspx.cs
+++ b/GPW_Admin/dipendenti.aspx.cs
@@ -59,17 +59,28 @@ namespace GPW_Admin
cmp_userCard.showAll = mod_adminDipendenti1.showAll;
cmp_userCard.showExt = cmp_toggleLinkExt.toggleValue;
cmp_userLicense.Visible = IdxDipSel > 0;
+ cmp_ticketFreeActiv.Visible = cmp_ticketFreeActiv.idxDipSel > 0;
}
private void Mod_adminDipendenti1_eh_addNew(object sender, EventArgs e)
{
- IdxDipSel = mod_adminDipendenti1.IdxDipSel;
+ if (mod_adminDipendenti1.isTicketReq)
+ {
+ IdxDipSel = 0;
+ cmp_ticketFreeActiv.idxDipSel = mod_adminDipendenti1.IdxDipSel;
+ }
+ else
+ {
+ IdxDipSel = mod_adminDipendenti1.IdxDipSel;
+ cmp_ticketFreeActiv.idxDipSel = 0;
+ }
fixDisplay();
}
private void Mod_adminDipendenti1_eh_doReset(object sender, EventArgs e)
{
IdxDipSel = 0;
+ cmp_ticketFreeActiv.idxDipSel = 0;
fixDisplay();
}
diff --git a/GPW_Admin/dipendenti.aspx.designer.cs b/GPW_Admin/dipendenti.aspx.designer.cs
index 7472f0a..0946717 100644
--- a/GPW_Admin/dipendenti.aspx.designer.cs
+++ b/GPW_Admin/dipendenti.aspx.designer.cs
@@ -41,6 +41,15 @@ namespace GPW_Admin
///
protected global::GPW_Admin.WebUserControls.cmp_userLicense cmp_userLicense;
+ ///
+ /// cmp_ticketFreeActiv control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::GPW_Admin.WebUserControls.cmp_ticketFreeActiv cmp_ticketFreeActiv;
+
///
/// mod_adminDipendenti1 control.
///
diff --git a/GPW_Data/ObjLicenze.cs b/GPW_Data/ObjLicenze.cs
index 9e65411..3d9871f 100644
--- a/GPW_Data/ObjLicenze.cs
+++ b/GPW_Data/ObjLicenze.cs
@@ -10,6 +10,19 @@ namespace GPW_data
{
#region Public Enums
+ public enum StatoRichiesta
+ {
+ ND = 0,
+
+ Richiesta,
+
+ Valutazione,
+
+ Approvata,
+
+ Rifiutata
+ }
+
public enum TipoLicenza
{
ND = 0,
@@ -95,6 +108,97 @@ namespace GPW_data
#endregion Public Properties
}
+ public class SupportRequest
+ {
+ #region Public Properties
+
+ public string CodApp { get; set; } = "";
+ public string CodImp { get; set; } = "";
+ public string CodInst { get; set; } = "";
+ public string ContactEmail { get; set; } = "";
+ public string ContactPhone { get; set; } = "";
+ public int idxSubLic { get; set; } = 0;
+
+ public bool IsValid
+ {
+ get => !string.IsNullOrEmpty(MasterKey) && !string.IsNullOrEmpty(ContactEmail) && !string.IsNullOrEmpty(CodInst) && !string.IsNullOrEmpty(CodApp);
+ }
+
+ public string MasterKey { get; set; } = "";
+ public string ReqBody { get; set; } = "";
+
+ #endregion Public Properties
+ }
+
+ ///
+ /// Oggetto Ticket
+ ///
+ public class TicketDTO
+ {
+ #region Public Properties
+
+ ///
+ /// Codice univoco della sub licenza (opzionale)
+ ///
+ public string CodImpiego { get; set; } = "";
+
+ ///
+ /// Contatto email del cliente richiedente
+ ///
+ public string ContactEmail { get; set; } = "";
+
+ ///
+ /// Contatto telefonico del cliente richiedente
+ ///
+ public string ContactPhone { get; set; } = "";
+
+ public DateTime DtReq { get; set; } = DateTime.Now;
+
+ ///
+ /// IDX licenza master
+ ///
+ public int IdxLic { get; set; } = 0;
+
+ ///
+ /// IDX licenza child (opzionale)
+ ///
+ public int IdxSubLic { get; set; } = 0;
+
+ public int IdxTicket { get; set; } = 0;
+
+ ///
+ /// Motivazione della richiesta
+ ///
+ public string ReqBody { get; set; } = "";
+
+ ///
+ /// Stato richiesta
+ ///
+ public StatoRichiesta Status { get; set; } = StatoRichiesta.ND;
+
+ ///
+ /// Risposta alla richiesta
+ ///
+ public string SupplAnsw { get; set; } = "";
+
+ ///
+ /// Email del responsabile dell'azione (interno - supplier)
+ ///
+ public string SupplEmail { get; set; } = "";
+
+ ///
+ /// Cod dell'user responsabile dell'azione (interno - supplier)
+ ///
+ public string SupplUserCode { get; set; } = "";
+
+ ///
+ /// Tipologia di licenza gestita
+ ///
+ public TipoLicenza Tipo { get; set; } = TipoLicenza.UserKey;
+
+ #endregion Public Properties
+ }
+
public class UserLicenseRequest
{
#region Public Properties
diff --git a/GPW_Data/licenzeGPW.cs b/GPW_Data/licenzeGPW.cs
index 8195e31..d186603 100644
--- a/GPW_Data/licenzeGPW.cs
+++ b/GPW_Data/licenzeGPW.cs
@@ -680,6 +680,64 @@ namespace GPW_data
return await Task.FromResult(answ);
}
+ ///
+ /// Tenta invio di un ticket x licenza indicata
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static async Task sendTicketReq(string contEmail, string contPhone, string reqBody, string codImpiego, int idxSubLic = 0)
+ {
+ bool answ = false;
+ // cerco online
+ RestClient client = new RestClient(apiUrl);
+ string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
+ var request = new RestRequest($"/api/ticket/sendReq", DataFormat.Json);
+
+ SupportRequest richiesta = new SupportRequest()
+ {
+ ContactEmail = contEmail,
+ ContactPhone = contPhone,
+ ReqBody = reqBody,
+ CodInst = installazione,
+ CodApp = applicazione,
+ MasterKey = MasterKey,
+ idxSubLic = idxSubLic,
+ CodImp = codImpiego
+ };
+
+ request.AddJsonBody(richiesta);
+ var response = client.Post(request);
+
+ // controllo risposta
+ if (response.StatusCode == System.Net.HttpStatusCode.OK)
+ {
+ // verifico risposta
+ string rawData = response.Content;
+ try
+ {
+ if (rawData.StartsWith("["))
+ {
+ // deserializzo
+ List tickets = JsonConvert.DeserializeObject>(rawData);
+ answ = tickets != null;
+ }
+ else
+ {
+ // deserializzo singolo
+ TicketDTO tickets = JsonConvert.DeserializeObject(rawData);
+ answ = tickets != null;
+ }
+ }
+ catch
+ { }
+ }
+ return await Task.FromResult(answ);
+ }
+
///
/// Tenta attivazione licenza dato codice impiego
///