Files
GMW/GMW/WebUserControls/mod_execUDC.ascx.cs
T

162 lines
5.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
using GMW_data;
namespace GMW.WebUserControls
{
public partial class mod_execUDC : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
traduciObj();
if (!Page.IsPostBack)
{
azzeraPostUpdate();
}
}
/// <summary>
/// traduzione oggetti
/// </summary>
private void traduciObj()
{
btnGo2Mag.Text = traduci("btnGo2Mag");
btnCreaListaPrelievo.Text = traduci("btnCreaListaPrelievo");
lblQta.Text = traduci("lblQta");
lblNewPos.Text = traduci("lblNewPos");
lblErrore.Text = traduci("ErroreCellaDestOccupata");
btnQta.Text = traduci("btnQta");
btnSposta.Text = traduci("btnSposta");
cbeQta.ConfirmText = traduci("confermaRettificaQta");
cbeSposta.ConfirmText = traduci("confermaSpostamentoUDC");
}
/// <summary>
/// evento btnGoToMag
/// </summary>
public event EventHandler eh_btnGoToMagPressed;
/// <summary>
/// evento btn1
/// </summary>
public event EventHandler eh_btnListaPrelievoPressed;
/// <summary>
/// evento aggiornati dati
/// </summary>
public event EventHandler eh_nuovoValore;
/// <summary>
/// wrapper traduzione
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(object lemma)
{
return user_std.UtSn.Traduci(lemma.ToString());
}
/// <summary>
/// va a dettaglio magazzino...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnGo2Mag_Click(object sender, EventArgs e)
{
// salvo l'UDC sel come val cercato cella...
memLayer.ML.setSessionVal("valoreCercatoCella", memLayer.ML.StringSessionObj("UDC_sel"));
memLayer.ML.emptySessionVal("Particolare_sel");
// sollevo evento nuovo valore...
if (eh_btnGoToMagPressed != null)
{
eh_btnGoToMagPressed(this, new EventArgs());
}
}
/// <summary>
/// crea listsa di prelievo x il particolare indicato (precompila...)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnCreaListaPrelievo_Click(object sender, EventArgs e)
{
// sollevo evento nuovo valore...
if (eh_btnListaPrelievoPressed != null)
{
eh_btnListaPrelievoPressed(this, new EventArgs());
}
}
/// <summary>
/// chiama procedura x spostamento tra celle di un UDC
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSposta_Click1(object sender, EventArgs e)
{
// ricavo il valore dell'UDC cliccato...
string UDC = memLayer.ML.StringSessionObj("UDC_sel");
int IdxCellaTo = 0;
bool cellaToOk = false;
try
{
DS_magazzino.CelleRow rowCella = MagClass.magazzino.taCelle.getByCodCella(txtNewCella.Text)[0];
IdxCellaTo = rowCella.IdxCella;
// controllo che la cella di destinazione NON sia bloccata
cellaToOk = rowCella.Attiva;
}
catch
{ }
if (cellaToOk)
{
// controllo che sia valido x fare l'operazione
if (IdxCellaTo > 0)
{
MagClass.magazzino.spostaUDC(memLayer.ML.StringSessionObj("CodCS"), UDC, IdxCellaTo, memLayer.ML.confReadBool("spostaUdcResettaLdp"), Request.UserHostName);
}
azzeraPostUpdate();
if (eh_nuovoValore != null)
{
eh_nuovoValore(this, new EventArgs());
}
}
else
{
// la cella è bloccata, nn devo permettere spostamento
lblErrore.Visible = true;
}
}
/// <summary>
/// aggiorna la qta pezzi dell'UDC indicato
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnQta_Click(object sender, EventArgs e)
{
string UDC = memLayer.ML.StringSessionObj("UDC_sel");
decimal qta = 0;
try
{
qta = Convert.ToDecimal(txtQta.Text);
}
catch
{ }
if (qta > 0)
{
MagClass.magazzino.rettificaQtaUDC(UDC, qta, Request.UserHostName);
}
azzeraPostUpdate();
if (eh_nuovoValore != null)
{
eh_nuovoValore(this, new EventArgs());
}
}
/// <summary>
/// reset controlli post aggiornamento
/// </summary>
private void azzeraPostUpdate()
{
lblErrore.Visible = false;
txtNewCella.Text = "";
txtQta.Text = "";
}
}
}