using SteamWare; using System; using System.Web.UI; using System.Web.UI.WebControls; namespace MoonProAdmin.WebUserControls { public partial class mod_approvProd : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { btnApprova.Text = traduci("btnApprovaProd"); grView.PageSize = pageSize; } } /// /// dimensione pagina /// public int pageSize { get { int answ = 10; try { answ = Convert.ToInt32(txtPageSize.Text); } catch { } return answ; } set { txtPageSize.Text = value.ToString(); } } /// /// wrapper traduzione /// /// /// public string traduci(object lemma) { return user_std.UtSn.Traduci(lemma.ToString()); } /// /// seleziona/deseleziona le righe indicate... /// /// /// 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; } } /// /// conferma dati produzione verso As400 /// /// /// protected void btnApprovaProd_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 { } MapoDb.DataLayer.obj.taAs400.insProdAs400(IdxODL, DataRif); } } grView.DataBind(); } /// /// salvo comando /// /// /// protected void lbt_Command(object sender, CommandEventArgs e) { SteamWare.memLayer.ML.setSessionVal("nextObjCommand", ((LinkButton)sender).CommandArgument); } /// /// evento selezione riga: salvo tempo e qta nei campi input... /// /// /// 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 (SteamWare.memLayer.ML.isInSessionObject("nextObjCommand")) { _comando = SteamWare.memLayer.ML.StringSessionObj("nextObjCommand"); SteamWare.memLayer.ML.emptySessionVal("nextObjCommand"); } switch (_comando) { case "Approva": MapoDb.DataLayer.obj.taAs400.insProdAs400(IdxODL, DataRif); break; default: break; } grView.SelectedIndex = -1; grView.DataBind(); } /// /// cambio dim pagina /// /// /// protected void txtPageSize_TextChanged(object sender, EventArgs e) { grView.PageSize = pageSize; } } }