131 lines
3.4 KiB
C#
131 lines
3.4 KiB
C#
using Newtonsoft.Json;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Web;
|
|
|
|
namespace GPW_Admin.WebUserControls
|
|
{
|
|
/// <summary>
|
|
/// Payload da deserializzare json
|
|
/// </summary>
|
|
public struct qrPayload
|
|
{
|
|
#region Public Properties
|
|
|
|
public string baseUrl { get; set; }
|
|
public string[] parameters { get; set; }
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
public partial class cmp_userCard : System.Web.UI.UserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
public string logoPath
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.CRS("imgLogoPath");
|
|
}
|
|
}
|
|
|
|
public bool showAll
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(hfShowAll.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfShowAll.Value = $"{value}";
|
|
repUserCards.DataBind();
|
|
}
|
|
}
|
|
|
|
public bool showExt
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(hfShowExt.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfShowExt.Value = $"{value}";
|
|
repUserCards.DataBind();
|
|
}
|
|
}
|
|
|
|
public bool linkCore
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(hfLinkCore.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfLinkCore.Value = $"{value}";
|
|
repUserCards.DataBind();
|
|
}
|
|
}
|
|
public string jumperFormat
|
|
{
|
|
get => hfJumperFormat.Value;
|
|
set => hfJumperFormat.Value = value;
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
jumperFormat = "jumper?idxDipendente={0}&UserAuthkey={1}";
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
public string getImgUrl(object idxDip, object UserAuthkey)
|
|
{
|
|
string urlName = showExt ? "smartBaseUrlExt" : "smartBaseUrlInt";
|
|
// se vuole modalità core --> sostituisco
|
|
if (linkCore)
|
|
{
|
|
urlName += "Core";
|
|
}
|
|
string[] valori = new string[2];
|
|
valori[0] = $"{idxDip}";
|
|
valori[1] = HttpUtility.UrlEncode($"{UserAuthkey}");
|
|
|
|
string baseUrl = $"{memLayer.ML.CRS("UrlQRCodeGen")}/HOME/QR_site/{memLayer.ML.CRS("UrlQuery")}";
|
|
string urlEncoded = memLayer.ML.CRS(urlName) + HttpUtility.UrlEncode("jumper?idxDipendente={0}&UserAuthkey={1}");
|
|
#if false
|
|
if (linkCore)
|
|
{
|
|
urlEncoded = memLayer.ML.CRS(urlName) + HttpUtility.UrlEncode("jumper?idxDipendente={0}&authKey={1}");
|
|
}
|
|
//string rawUrl = memLayer.ML.CRS(urlName) + "jumper?idxDipendente={0}&UserAuthkey={1}";
|
|
//string urlEncoded = HttpUtility.UrlEncode(rawUrl);
|
|
#endif
|
|
|
|
qrPayload currPayload = new qrPayload()
|
|
{
|
|
baseUrl = urlEncoded,
|
|
parameters = valori
|
|
};
|
|
string payload = JsonConvert.SerializeObject(currPayload);
|
|
string answ = $"{baseUrl}{payload}";
|
|
return answ;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |