132 lines
3.4 KiB
C#
132 lines
3.4 KiB
C#
using AppData;
|
|
using Newtonsoft.Json;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_scrapList : BaseUserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
mod_righePag.numRowPag = 10;
|
|
}
|
|
mod_righePag.eh_newNum += Mod_righePag_eh_newNum;
|
|
}
|
|
|
|
private void Mod_righePag_eh_newNum(object sender, EventArgs e)
|
|
{
|
|
grView.PageSize = mod_righePag.numRowPag;
|
|
}
|
|
|
|
protected Dictionary<int, string> anagMateriali
|
|
{
|
|
set
|
|
{
|
|
string jsonData = JsonConvert.SerializeObject(value);
|
|
memLayer.ML.setRSV("anagMateriali", jsonData, 60);
|
|
}
|
|
get
|
|
{
|
|
Dictionary<int, string> answ = new Dictionary<int, string>();
|
|
//cerco in redis...
|
|
string rawData = memLayer.ML.getRSV("anagMateriali");
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
answ = JsonConvert.DeserializeObject<Dictionary<int, string>>(rawData);
|
|
}
|
|
// sennò nel DB e salvo in redis...
|
|
else
|
|
{
|
|
var tabMat = DataLayer.man.taMat.GetData();
|
|
foreach (var item in tabMat)
|
|
{
|
|
answ.Add(item.MatID, item.MatDesc);
|
|
}
|
|
// salvo in redis
|
|
anagMateriali = answ;
|
|
}
|
|
// restituisco
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
public string matByKey(object _matId)
|
|
{
|
|
string answ = "";
|
|
int matId = 0;
|
|
int.TryParse(_matId.ToString(), out matId);
|
|
try
|
|
{
|
|
answ = anagMateriali[matId];
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
|
|
protected void chkToggle_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// seleziono TUTTI i checkbox presenti
|
|
foreach (GridViewRow row in grView.Rows)
|
|
{
|
|
try
|
|
{
|
|
CheckBox chkb = (CheckBox)row.FindControl("chkSelected");
|
|
chkb.Checked = !chkb.Checked;
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
public string cssByStatus(object _statusId)
|
|
{
|
|
int statusId = 0;
|
|
int.TryParse(_statusId.ToString(), out statusId);
|
|
string answ = statusId == 990 ? "text-dark" : "text-secondary font-italic";
|
|
|
|
return answ;
|
|
}
|
|
protected void lbtCreateOffOrd_Click(object sender, EventArgs e)
|
|
{
|
|
bool doReport = false;
|
|
// creo NUOVO ordine offline...
|
|
DS_App.OfflineOrderListDataTable tabOrdini = DataLayer.man.taOffOL.insertNew();
|
|
int itemId = 0;
|
|
// se ho la riga new in risposta...
|
|
if (tabOrdini.Count == 1)
|
|
{
|
|
// ciclo sulla grView x i selezionati
|
|
foreach (GridViewRow row in grView.Rows)
|
|
{
|
|
itemId = 0;
|
|
try
|
|
{
|
|
CheckBox chkb = (CheckBox)row.FindControl("chkSelected");
|
|
if (chkb.Checked)
|
|
{
|
|
// recupero valore
|
|
HiddenField hfid = (HiddenField)row.FindControl("hfItemID");
|
|
int.TryParse(hfid.Value, out itemId);
|
|
// aggiungo ad ordine
|
|
if (itemId > 0)
|
|
{
|
|
DataLayer.man.taOO2I.insertQuery(tabOrdini[0].OrdID, itemId);
|
|
doReport = true;
|
|
}
|
|
}
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
if (doReport)
|
|
{
|
|
grView.DataBind();
|
|
raiseEvent();
|
|
}
|
|
}
|
|
}
|
|
} |