157 lines
3.7 KiB
C#
157 lines
3.7 KiB
C#
using MapoDb;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace MP_SITE.WebUserControls
|
|
{
|
|
public class baseProdControl : System.Web.UI.UserControl
|
|
{
|
|
#region Public Events
|
|
|
|
/// <summary>
|
|
/// evento update
|
|
/// </summary>
|
|
public event EventHandler eh_doUpdate;
|
|
|
|
#endregion Public Events
|
|
|
|
#region Public Properties
|
|
|
|
public int numRighe
|
|
{
|
|
get
|
|
{
|
|
return _numRighe;
|
|
}
|
|
set
|
|
{
|
|
_numRighe = value;
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public virtual void doUpdate()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Conversione a bool del valore
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
public bool getBool(object value)
|
|
{
|
|
bool answ = false;
|
|
string rawVal = $"{value}".ToUpper();
|
|
// se è 1/0 --> len 1
|
|
if (rawVal.Length == 1)
|
|
{
|
|
answ = rawVal == "1" || rawVal == "S" || rawVal == "Y";
|
|
}
|
|
else
|
|
{
|
|
bool.TryParse($"{value}", out answ);
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
public string operatoreDaMatr(object matricola)
|
|
{
|
|
int matr = 0;
|
|
string answ = "N.A.";
|
|
try
|
|
{
|
|
matr = Convert.ToInt32(matricola);
|
|
}
|
|
catch
|
|
{ }
|
|
// cerco in LUT...
|
|
if (OprLUT.ContainsKey(matr))
|
|
{
|
|
answ = OprLUT[matr];
|
|
}
|
|
else
|
|
{
|
|
answ = _resoconti.oprDaMatr(matr);
|
|
OprLUT.Add(matr, answ);
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
public void reportUpdate()
|
|
{
|
|
// alzo l'evento d update/inserimento e ricarico cache...
|
|
if (eh_doUpdate != null)
|
|
{
|
|
eh_doUpdate(this, new EventArgs());
|
|
}
|
|
}
|
|
|
|
/// <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
|
|
|
|
#region Internal Fields
|
|
|
|
/// <summary>
|
|
/// Oggetto datalayer specifico
|
|
/// </summary>
|
|
internal DataLayer DataLayerObj = new DataLayer();
|
|
|
|
#endregion Internal Fields
|
|
|
|
#region Protected Fields
|
|
|
|
protected int _numRighe = 17;
|
|
|
|
protected resoconti _resoconti;
|
|
protected Dictionary<int, string> OprLUT = new Dictionary<int, string>();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Verifica se la macchina MAIN sia MULTI (da DatiMacchina / redis...)
|
|
/// </summary>
|
|
/// <param name="idxMacchina"></param>
|
|
/// <returns></returns>
|
|
protected bool isMulti(string idxMacchina)
|
|
{
|
|
return DataLayerObj.isMulti(idxMacchina);
|
|
}
|
|
|
|
protected virtual void Page_Load(object sender, EventArgs e)
|
|
{
|
|
_resoconti = new resoconti();
|
|
if (!Page.IsPostBack)
|
|
{
|
|
doUpdate();
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |