Files
2020-12-31 10:35:24 +01:00

117 lines
2.3 KiB
C#

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MP_MAG.WebUserControls
{
public partial class cmp_LottiOut : BaseUserControl
{
/// <summary>
/// CodStato richiesto
/// </summary>
public string CodStato
{
get
{
return hfCodStato.Value;
}
set
{
hfCodStato.Value = value;
}
}
/// <summary>
/// Elenco dei lotti selezionati
/// </summary>
public List<string> lottiSel
{
get
{
List<string> answ = null;
string rawVal = hfJsonLotti.Value;
try
{
answ = JsonConvert.DeserializeObject<List<string>>(rawVal);
}
catch
{ }
if (answ == null)
{
answ = new List<string>();
}
return answ;
}
set
{
string rawVal = JsonConvert.SerializeObject(value);
hfJsonLotti.Value = rawVal;
// salvo ANCHE elenco in formato #lotto#lotto#
string eliString = $"#{string.Join("#", value)}#";
hfHashList.Value = eliString;
// update grView...
grView.DataBind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
/// <summary>
/// Update grid view
/// </summary>
public void doUpdate()
{
grView.DataBind();
}
public void deSelect()
{
grView.SelectedIndex = -1;
grView.DataBind();
}
protected void resetSelezione()
{
grView.SelectedIndex = -1;
grView.DataBind();
raiseReset();
}
/// <summary>
/// Lotto selezionato
/// </summary>
public string lottoSel
{
get
{
string answ = "";
try
{
if (grView.SelectedIndex >= 0)
{
answ = grView.SelectedValue.ToString();
}
}
catch
{ }
return answ;
}
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
raiseEvent();
}
}
}