361 lines
12 KiB
C#
361 lines
12 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
using GMW_data;
|
|
|
|
namespace GMW_Term.WebUserControls
|
|
{
|
|
public partial class mod_execParticolare : System.Web.UI.UserControl
|
|
{
|
|
#region area da NON modificare
|
|
|
|
#region area protected
|
|
|
|
protected string _idxGridView;
|
|
protected string _idxGridViewExt;
|
|
protected string _tabCache;
|
|
protected bool _showNewBtn = false;
|
|
|
|
/// <summary>
|
|
/// wrapper traduzione termini
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(string lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma);
|
|
}
|
|
|
|
/// <summary>
|
|
/// recupera i dati di un nuovo record contenuti nel footer di un gridView;
|
|
/// questi devono esses opportunamente nominati (es: txt{0}, dl{0}, ...)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void recuperaFooter(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
//recupero la riga footer...
|
|
DataColumnCollection colonne = colonneObj();
|
|
string nomeCol;
|
|
string tipoColonna = "";
|
|
foreach (DataColumn colonna in colonne)
|
|
{
|
|
nomeCol = colonna.ColumnName;
|
|
// cerco un textbox o quello che sia...
|
|
if (grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "textBox";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "dropDownList";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "checkBox";
|
|
}
|
|
else if (grView.FooterRow.FindControl(string.Format("selAjax_{0}", nomeCol)) != null)
|
|
{
|
|
tipoColonna = "selAjax";
|
|
}
|
|
// in base al tipo salvo negli inputparameters dell'ODS
|
|
switch (tipoColonna)
|
|
{
|
|
case "textBox":
|
|
e.InputParameters[nomeCol] = ((TextBox)grView.FooterRow.FindControl(string.Format("txt{0}", nomeCol))).Text.Trim();
|
|
break;
|
|
case "dropDownList":
|
|
e.InputParameters[nomeCol] = ((DropDownList)grView.FooterRow.FindControl(string.Format("dl{0}", nomeCol))).SelectedValue;
|
|
break;
|
|
case "checkBox":
|
|
e.InputParameters[nomeCol] = ((CheckBox)grView.FooterRow.FindControl(string.Format("chk{0}", nomeCol))).Checked;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
tipoColonna = "";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// inserisce nuovo valore da footer
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lblIns_click(object sender, EventArgs e)
|
|
{
|
|
// click su inserimento, chiamo il metodo insert dell'ObjectDataSource
|
|
ods.Insert();
|
|
SteamWare.memLayer.ML.emptyCacheVal(_tabCache);
|
|
}
|
|
/// <summary>
|
|
/// annulla inserimento nuovo valore da footer
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lblCanc_click(object sender, EventArgs e)
|
|
{
|
|
// annullo inserimento: nascondo footer, bind controlli...
|
|
grView.FooterRow.Visible = false;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// traduce gli header delle colonne
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
LinkButton lb;
|
|
// aggiorno gli headers
|
|
foreach (TableCell cella in grView.HeaderRow.Cells)
|
|
{
|
|
try
|
|
{
|
|
lb = (LinkButton)cella.Controls[0];
|
|
lb.Text = traduci(lb.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1);
|
|
lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord);
|
|
}
|
|
else
|
|
{
|
|
lblNumRec.Text = "";
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// gestione evento richeista nuovo valore (mostra footer, ...)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
// reset selezione...
|
|
resetSelezione();
|
|
// mostro il footer oppure la riga dei dettagli x nuovo...
|
|
if (grView.FooterRow != null)
|
|
{
|
|
grView.FooterRow.Visible = true;
|
|
}
|
|
// sollevo evento nuovo valore...
|
|
if (eh_nuovoValore != null)
|
|
{
|
|
eh_nuovoValore(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// reset della selezione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region gestione eventi
|
|
|
|
//public event EventHandler eh_resetSelezione;
|
|
public event EventHandler eh_nuovoValore;
|
|
//public event EventHandler eh_selValore;
|
|
|
|
#endregion
|
|
|
|
#region public
|
|
|
|
/// <summary>
|
|
/// definisce visibilità btnNew
|
|
/// </summary>
|
|
public bool showNewBtn
|
|
{
|
|
get
|
|
{
|
|
return _showNewBtn;
|
|
}
|
|
set
|
|
{
|
|
_showNewBtn = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// effettua update del modulo
|
|
/// </summary>
|
|
public void doUpdate()
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// metodi al caricamento della pagina
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// scrive label e text bottoni
|
|
btnLoginPage.Text = "[7]-LogOut";
|
|
btnLoginPage.AccessKey = "7";
|
|
btnButtonsHome.Text = "[9]-Home";
|
|
btnButtonsHome.AccessKey = "9";
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua logout...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnLoginPage_Click(object sender, EventArgs e)
|
|
{
|
|
TermUtils.TU.forceLogOut();
|
|
Response.Redirect("~/Barcode.aspx");
|
|
}
|
|
/// <summary>
|
|
/// va alla pagina dei buttons principale
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnButtonsHome_Click(object sender, EventArgs e)
|
|
{
|
|
Response.Redirect("~/Home.aspx");
|
|
}
|
|
|
|
/// <summary>
|
|
/// elenco colonne del datagrid
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected DataColumnCollection colonneObj()
|
|
{
|
|
DS_magazzino.V_DettMagPartDataTable tabella = new DS_magazzino.V_DettMagPartDataTable();
|
|
DataColumnCollection colonne = tabella.Columns;
|
|
return colonne;
|
|
}
|
|
/// <summary>
|
|
/// inizializzazione valori di default
|
|
/// </summary>
|
|
/// <param name="e"></param>
|
|
protected override void OnInit(EventArgs e)
|
|
{
|
|
base.OnInit(e);
|
|
_idxGridView = "TipoSearch";
|
|
|
|
aggiornaControlliDataGL();
|
|
}
|
|
/// <summary>
|
|
/// aggiorna controlli datagrid e numero righe in pagina
|
|
/// </summary>
|
|
protected void aggiornaControlliDataGL()
|
|
{
|
|
grView.PageSize = 6;
|
|
}
|
|
|
|
/// <summary>
|
|
/// gestione cambio selezione valore
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
|
/// </summary>
|
|
public void resetSelezione()
|
|
{
|
|
SteamWare.memLayer.ML.emptySessionVal(string.Format("{0}_sel", _idxGridView));
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
lblWarning.Visible = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// salvo in session che il prox comando è iniziare lista prelievo...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void imgAzioneLista_Click(object sender, ImageClickEventArgs e)
|
|
{
|
|
ImageButton imgb = (ImageButton)sender;
|
|
SteamWare.memLayer.ML.setSessionVal("nextObjCommand", imgb.CommandArgument);
|
|
}
|
|
/// <summary>
|
|
/// in caso di aggiornamento verifico se sia salvato un comando inizia o completa lista prelievo...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e)
|
|
{
|
|
//// carico l'idx dell'oggetto
|
|
//string tipo = e.Keys["tipo"].ToString();
|
|
//string valore = e.Keys["valore"].ToString();
|
|
//// quale comando?
|
|
//string _comando = "";
|
|
//if (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand"))
|
|
//{
|
|
// _comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand");
|
|
// SteamWare.memLayer.ML.emptySessionVal("nextObjCommand");
|
|
//}
|
|
//string CodSoggetto = MagClass.magazzino.CodSoggCurrUser;
|
|
//switch (_comando)
|
|
//{
|
|
// case "UDC":
|
|
// // salvo in sessione
|
|
// memLayer.ML.setSessionVal("UDC_sel", valore);
|
|
// // blocco update!
|
|
// e.Cancel = true;
|
|
// // faccio redirect
|
|
// Response.Redirect("~/UDC.aspx");
|
|
// break;
|
|
// case "Particolare":
|
|
// // salvo in sessione
|
|
// memLayer.ML.setSessionVal("Particolare_sel", valore);
|
|
// // blocco update!
|
|
// e.Cancel = true;
|
|
// // faccio redirect
|
|
// Response.Redirect("~/Particolare.aspx");
|
|
// break;
|
|
// case "Cella":
|
|
// // salvo in sessione
|
|
// memLayer.ML.setSessionVal("IdxCella_sel", valore);
|
|
// // blocco update!
|
|
// e.Cancel = true;
|
|
// // faccio redirect
|
|
// Response.Redirect("~/Cella.aspx");
|
|
// break;
|
|
// default:
|
|
// // faccio update!
|
|
// break;
|
|
//}
|
|
}
|
|
|
|
/// <summary>
|
|
/// ssitema visualizzazione dal filtraggi
|
|
/// </summary>
|
|
private void checkFixOds()
|
|
{
|
|
// chiamo procedura che aggiorna ods principale
|
|
grView.SelectedIndex = -1;
|
|
updateOds();
|
|
}
|
|
/// <summary>
|
|
/// aggiorno il gridview
|
|
/// </summary>
|
|
protected void updateOds()
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
|
|
}
|
|
} |