Files
NKC/NKC_WF/WebUserControls/cmp_MaterialsMgmt.ascx.cs
samuele de1425bbde Aggiunta log azioni x reset/start kitting su cart:
- nel LOG "KittingStart = [NULL/GETDATE()]"
2023-06-26 19:30:30 +02:00

101 lines
3.1 KiB
C#

using NKC_SDK;
using SteamWare;
using System;
using System.Data;
using System.Linq;
using System.Web.UI;
namespace NKC_WF.WebUserControls
{
public partial class cmp_MaterialsMgmt : BaseUserControl
{
#region Protected Methods
protected void lbtAddNew_Click(object sender, EventArgs e)
{
DLMan.taMat.insertQuery(999999, "NEW MATERIAL 999999", 1000, 1000, 10);
grView.SelectedIndex = -1;
grView.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
cmp_numRow.numRow = 20;
grView.PageSize = cmp_numRow.numRow;
}
cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh;
}
#endregion Protected Methods
#region Private Methods
private void Cmp_numRow_eh_doRefresh(object sender, EventArgs e)
{
// recupero num righe ed aggiorno...
grView.PageSize = cmp_numRow.numRow;
grView.DataBind();
}
public bool canAddNew()
{
return userIsAuth;
}
/// <summary>
/// permesso scrittura SE E' abilitato a partire dalla tab diritti...
/// </summary>
public bool userIsAuth
{
get
{
bool isSuperAdmin = false;
// cerco in redis cache...
string supAdmKey = "isSuperAdmin";
if (memLayer.ML.isInSessionObject(supAdmKey))
{
isSuperAdmin = memLayer.ML.StringSessionObj(supAdmKey).ToLower() == "true";
}
else
{
// recupero elenco diritti
var diritti = user_std.UtSn.diritti;
// cerco il diritto di SuperAdmin... in caso di modifica livello x Admin NKC cambiare qui
isSuperAdmin = diritti.Where(x => x.COD_FUNZIONE == "SuperAdmin").Count() > 0;
// salvo
memLayer.ML.setSessionVal(supAdmKey, $"{isSuperAdmin}");
}
return isSuperAdmin;
}
}
public bool canEdit(object matId)
{
bool answ = $"{matId}" != "0";
return answ & userIsAuth;
}
#endregion Private Methods
protected void ods_Updating(object sender, System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs e)
{
string rawVal = "";
string fixDecFrom = memLayer.ML.CRS("fixDecFrom");
string fixDecTo = memLayer.ML.CRS("fixDecTo");
if (memLayer.ML.CRB("fixDecimals"))
{
rawVal = $"{e.InputParameters["L_mm"]}";
e.InputParameters["L_mm"] = rawVal.Replace(fixDecFrom, fixDecTo);
rawVal = $"{e.InputParameters["W_mm"]}";
e.InputParameters["W_mm"] = rawVal.Replace(fixDecFrom, fixDecTo);
rawVal = $"{e.InputParameters["T_mm"]}";
e.InputParameters["T_mm"] = rawVal.Replace(fixDecFrom, fixDecTo);
}
}
}
}