296 lines
7.9 KiB
C#
296 lines
7.9 KiB
C#
using MapoDb;
|
|
using SteamWare;
|
|
using System;
|
|
|
|
namespace MP_ADM
|
|
{
|
|
public class BaseUserControl : System.Web.UI.UserControl
|
|
{
|
|
#region Internal Fields
|
|
|
|
/// <summary>
|
|
/// Oggetto datalayer specifico NON singleton x scalare
|
|
/// </summary>
|
|
internal DataLayer DataLayerObj = new DataLayer();
|
|
|
|
#endregion Internal Fields
|
|
|
|
#region Public Fields
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione Controlli periodici
|
|
/// </summary>
|
|
public bool enableControlli = memLayer.ML.cdvb("enableControlli");
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione Disegno articolo
|
|
/// </summary>
|
|
public bool enableDisegno = memLayer.ML.cdvb("enableDisegno");
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione grafici JScript
|
|
/// </summary>
|
|
public bool enableGraphJS = memLayer.ML.cdvb("enableGraphJS");
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione Pezzi LAsciati in macchina
|
|
/// </summary>
|
|
public bool enablePzProdLasciati = memLayer.ML.cdvb("enablePzProdLasciati");
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione Richieste - Promesse - ODL
|
|
/// </summary>
|
|
public bool enableRPO = memLayer.ML.cdvb("enableRPO");
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione scarti
|
|
/// </summary>
|
|
public bool enableScarti = memLayer.ML.cdvb("enableScarti");
|
|
|
|
/// <summary>
|
|
/// Abilitazione scheda Tecnica
|
|
/// </summary>
|
|
public bool enableSchedaTecnica = memLayer.ML.cdvb("enableSchedaTecnica");
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione SplitODL
|
|
/// </summary>
|
|
public bool enableSplitODL = memLayer.ML.cdvb("enableSplitODL");
|
|
|
|
/// <summary>
|
|
/// Abilitazione gestione Set PZ Pallet su tablet
|
|
/// </summary>
|
|
public bool enableTabSetPzPallet = memLayer.ML.cdvb("enableTabSetPzPallet");
|
|
|
|
#endregion Public Fields
|
|
|
|
#region Public Events
|
|
|
|
public event EventHandler eh_nuovoValore;
|
|
|
|
public event EventHandler eh_resetSelezione;
|
|
|
|
public event EventHandler eh_selValore;
|
|
|
|
#endregion Public Events
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Clipboard corrente utente
|
|
/// </summary>
|
|
public string clipboard
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("UserClipboard");
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("UserClipboard", value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// titolo pagina
|
|
/// </summary>
|
|
public string titolo
|
|
{
|
|
get
|
|
{
|
|
return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", "");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// UID formattato con "_"
|
|
/// </summary>
|
|
public string uid
|
|
{
|
|
get
|
|
{
|
|
return this.UniqueID.Replace("$", "_").Replace("-", "_");
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Verifica se la macchina MAIN sia MASTER
|
|
/// </summary>
|
|
protected bool isMaster(string idxMacchina)
|
|
{
|
|
return DataLayerObj.isMaster(idxMacchina);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...)
|
|
/// </summary>
|
|
protected bool isMulti(string idxMacchina)
|
|
{
|
|
return DataLayerObj.isMulti(idxMacchina);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Verifica se la macchina MAIN sia SLAVE
|
|
/// </summary>
|
|
protected bool isSlave(string idxMacchina)
|
|
{
|
|
return DataLayerObj.isSlave(idxMacchina);
|
|
}
|
|
|
|
/// <summary>
|
|
/// conversione da tempo minuti centesimali a minuti/secondi
|
|
/// </summary>
|
|
/// <param name="valore"></param>
|
|
/// <returns></returns>
|
|
protected TimeSpan minCent2Sec(decimal valore)
|
|
{
|
|
TimeSpan answ = new TimeSpan(0, 0, 1);
|
|
try
|
|
{
|
|
answ = new TimeSpan(0, Convert.ToInt32(valore), Convert.ToInt32((valore - Convert.ToInt32(valore)) * 60));
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// cambia il colore del campo secondo la due date indicata
|
|
/// rosso: in ritardo (scaduta)
|
|
/// verde: > 2 week
|
|
/// giallo: altrimenti
|
|
/// </summary>
|
|
/// <param name="dueDate"></param>
|
|
/// <returns></returns>
|
|
public string cssDueDate(object dueDate)
|
|
{
|
|
DateTime oggi = DateTime.Today;
|
|
DateTime dataRif = oggi.AddDays(-1);
|
|
DateTime.TryParse(dueDate.ToString(), out dataRif);
|
|
string answ = "text-secondary";
|
|
if (dataRif < oggi)
|
|
{
|
|
answ = "text-danger";
|
|
}
|
|
else if (dataRif < oggi.AddDays(14))
|
|
{
|
|
answ = "text-warning";
|
|
}
|
|
else
|
|
{
|
|
answ = "text-success";
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Conversione a bool del valore
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
public bool getBool(object value)
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(value.ToString(), out answ);
|
|
return answ;
|
|
}
|
|
|
|
public string min2hour(object minutes)
|
|
{
|
|
string answ = "";
|
|
double minDbl = 0;
|
|
double.TryParse($"{minutes}", out minDbl);
|
|
answ = $"{minDbl / 60:N2}";
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// formatta in minuti/sec partendo da min.cent
|
|
/// </summary>
|
|
/// <param name="minCent"></param>
|
|
/// <returns></returns>
|
|
public string minSec(object minCent)
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = string.Format("{0:mm}:{0:ss}", minCent2Sec(Convert.ToDecimal(minCent.ToString().Replace(".", ","))));
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Solleva evento nuovo valore
|
|
/// </summary>
|
|
public void raiseNewVal()
|
|
{
|
|
// evento come nuovo...
|
|
if (eh_nuovoValore != null)
|
|
{
|
|
eh_nuovoValore(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Solleva evento reset
|
|
/// </summary>
|
|
public void raiseReset()
|
|
{
|
|
if (eh_resetSelezione != null)
|
|
{
|
|
eh_resetSelezione(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
public void raiseSelNew()
|
|
{
|
|
// sollevo evento nuovo valore...
|
|
if (eh_selValore != null)
|
|
{
|
|
eh_selValore(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua traduzione del lemma
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(object lemmaRaw)
|
|
{
|
|
return user_std.UtSn.Traduci($"{lemmaRaw}");
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua traduzione del lemma
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(string lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma);
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua traduzione in inglese del lemma
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduciEn(string lemma)
|
|
{
|
|
return user_std.UtSn.TraduciEn(lemma);
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |