Files
gpw_testci/GPW_Smart/BaseUserControl.cs
2021-03-26 17:17:28 +01:00

184 lines
4.4 KiB
C#

using GPW_data;
using GPW_Smart;
using SteamWare;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GPW_Smart
{
public class BaseUserControl : System.Web.UI.UserControl
{
#region Protected Properties
/// <summary>
/// idx dipendente loggato
/// </summary>
protected int IdxDipendente
{
get
{
int idx = 0;
try
{
idx = memLayer.ML.IntSessionObj("IdxDipendente");
}
catch
{ }
return idx;
}
set
{
memLayer.ML.setSessionVal("IdxDipendente", value.ToString());
}
}
#endregion Protected Properties
#region Public Properties
public bool abilitaAll
{
get
{
bool answ = false;
try
{
string rawData = memLayer.ML.getRSV("abilitaAll");
bool.TryParse(rawData, out answ);
}
catch
{ }
return answ;
}
set
{
int ttlSec = value ? memLayer.ML.CRI("ttlAbilitaAll") : 0;
memLayer.ML.setRSV("abilitaAll", value.ToString(), ttlSec);
}
}
public string cognomeNome
{
get
{
return memLayer.ML.StringSessionObj("cognomeNome");
}
}
public string email
{
get
{
return memLayer.ML.StringSessionObj("email");
}
}
public string hashEmail
{
get
{
return memLayer.ML.StringSessionObj("hashEmail");
}
}
public string IP
{
get
{
return Request.UserHostName;
}
}
public int numColEU
{
get
{
return memLayer.ML.IntSessionObj("numColEU");
}
set
{
memLayer.ML.setSessionVal("numColEU", value);
}
}
public int numRowTimb
{
get
{
return memLayer.ML.IntSessionObj("numRowTimb");
}
set
{
memLayer.ML.setSessionVal("numRowTimb", value);
}
}
public string textSize
{
get
{
string answ = memLayer.ML.StringSessionObj("textSize");
if (string.IsNullOrEmpty(answ))
answ = "1.2em";
return answ;
}
set
{
memLayer.ML.setSessionVal("textSize", value);
}
}
#endregion Public Properties
#region Public Methods
/// <summary>
/// Verifica se il valore sia > limitValue
/// </summary>
/// <param name="_valore"></param>
/// <param name="minVal"></param>
/// <param name="maxVal"></param>
/// <returns></returns>
public bool betweenVal(object _valore, double minVal, double maxVal)
{
bool answ = false;
if (_valore != null)
{
double valore = 0;
_ = double.TryParse(_valore.ToString(), out valore);
answ = valore <= maxVal && valore >= minVal;
}
return answ;
}
/// <summary>
/// Verifica se il valore sia > limitValue
/// </summary>
/// <param name="_valore"></param>
/// <param name="maxVal"></param>
/// <returns></returns>
public bool gtVal(object _valore, double maxVal)
{
bool answ = false;
if (_valore != null)
{
double valore = 0;
_ = double.TryParse(_valore.ToString(), out valore);
answ = valore > maxVal;
}
return answ;
}
public bool gtZero(object _valore)
{
bool answ = false;
decimal valore = 0;
decimal.TryParse(_valore.ToString(), out valore);
answ = valore > 0;
return answ;
}
#endregion Public Methods
}
}