Files
GPW/GPW_Admin/WebUserControls/cmp_userCard.ascx.cs
T
2022-09-12 19:54:25 +02:00

101 lines
2.7 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();
}
}
#endregion Public Properties
#region Protected Methods
protected void Page_Load(object sender, EventArgs e)
{
}
#endregion Protected Methods
#region Public Methods
public string getImgUrl(object idxDip, object UserAuthkey)
{
string urlName = showExt ? "smartBaseUrlExt" : "smartBaseUrlInt";
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 baseUrl = $"{memLayer.ML.CRS("UrlQRCodeGen")}/HOME/QR_site/JSON_ENC?val=";
string urlEncoded = memLayer.ML.CRS(urlName) + HttpUtility.UrlEncode("jumper?idxDipendente={0}&UserAuthkey={1}");
//string rawUrl = memLayer.ML.CRS(urlName) + "jumper?idxDipendente={0}&UserAuthkey={1}";
//string urlEncoded = HttpUtility.UrlEncode(rawUrl);
qrPayload currPayload = new qrPayload()
{
baseUrl = urlEncoded,
parameters = valori
};
string payload = JsonConvert.SerializeObject(currPayload);
string answ = $"{baseUrl}{payload}";
return answ;
}
#endregion Public Methods
}
}