Files
MoonPro.net/MP-ADM/WebUserControls/mod_approvProd.ascx.cs
T
Samuele E. Locatelli 91ccb018af Code cleanup con CodeMaid
2020-09-11 12:45:52 +02:00

160 lines
4.9 KiB
C#

using SteamWare;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MP_ADM.WebUserControls
{
public partial class mod_approvProd : BaseUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
grView.PageSize = pageSize;
}
}
/// <summary>
/// dimensione pagina
/// </summary>
public int pageSize
{
get
{
int answ = 10;
try
{
answ = Convert.ToInt32(txtPageSize.Text);
}
catch
{ }
return answ;
}
set
{
txtPageSize.Text = value.ToString();
}
}
/// <summary>
/// seleziona/deseleziona le righe indicate...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSelAll_Click(object sender, EventArgs e)
{
// seleziono tutti i valori visibili nel datagrid
CheckBox chkbox = ((CheckBox)sender);
bool isChecked = chkbox.Checked;
if (!isChecked)
{
chkbox.ToolTip = traduci("btnSelAll");
}
else
{
chkbox.ToolTip = traduci("btnDeselAll");
}
foreach (GridViewRow riga in grView.Rows)
{
((CheckBox)riga.FindControl("chkSelect")).Checked = isChecked;
}
}
/// <summary>
/// conferma dati produzione verso As400
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtApprovaProd_Click(object sender, EventArgs e)
{
foreach (GridViewRow riga in grView.Rows)
{
int IdxODL = 0;
DateTime DataRif = DateTime.Now.Date;
if (((CheckBox)riga.FindControl("chkSelect")).Checked && ((CheckBox)riga.FindControl("chkSelect")).Visible)
{
try
{
IdxODL = Convert.ToInt32(((Label)riga.FindControl("lblIdxODL")).Text);
DataRif = Convert.ToDateTime(((Label)riga.FindControl("lblDataRif")).Text);
}
catch
{ }
DataLayerObj.taAs400.insProdAs400(IdxODL, DataRif);
}
}
grView.DataBind();
}
/// <summary>
/// salvo comando
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbt_Command(object sender, CommandEventArgs e)
{
memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument);
}
/// <summary>
/// evento selezione riga: salvo tempo e qta nei campi input...
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
// ricavo i dati selezionati
int IdxODL = 0;
DateTime DataRif = DateTime.Now.Date;
try
{
IdxODL = Convert.ToInt32(grView.SelectedDataKey[0]);
DataRif = Convert.ToDateTime(grView.SelectedDataKey[1]);
}
catch
{ }
// gestione buttons approvazione
string _comando = "";
if (memLayer.ML.isInSessionObject("nextObjCommand"))
{
_comando = memLayer.ML.StringSessionObj("nextObjCommand");
memLayer.ML.emptySessionVal("nextObjCommand");
}
switch (_comando)
{
case "Approva":
DataLayerObj.taAs400.insProdAs400(IdxODL, DataRif);
break;
default:
break;
}
grView.SelectedIndex = -1;
grView.DataBind();
}
/// <summary>
/// cambio dim pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtPageSize_TextChanged(object sender, EventArgs e)
{
grView.PageSize = pageSize;
}
/// <summary>
/// effettua caricamento interventi pending
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtImportPending_Click(object sender, EventArgs e)
{
// forzo rilettura dati da approvare...
DataLayerObj.taAs400.ImportDati_ElencoConfermeProd();
// update tab...
grView.DataBind();
}
}
}