diff --git a/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs b/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs index 16700126..38b289fc 100644 --- a/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs +++ b/MP-ADM/WebUserControls/mod_newPromessaODL.ascx.cs @@ -7,13 +7,13 @@ namespace MP_ADM.WebUserControls { public partial class mod_newPromessaODL : BaseUserControl { - protected void Page_Load(object sender, EventArgs e) - { - if (!Page.IsPostBack) - { - setDefaults(); - } - } + #region Public Events + + public event EventHandler eh_nuovoValore; + + #endregion Public Events + + #region Public Properties /// /// Testo conferma salvataggio (create/Edit) @@ -31,50 +31,9 @@ namespace MP_ADM.WebUserControls } } - public void doSelPODL() - { - // se ho una promessa da clonare copio dati da quella... - int idxProm = 0; - try - { - if (memLayer.ML.isInSessionObject("idxProm2Clone")) - { - idxProm = memLayer.ML.IntSessionObj("idxProm2Clone"); - } - else if (memLayer.ML.isInSessionObject("idxProm2Edit")) - { - idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); - } - // provo a selezionare - var tPODL = DataLayerObj.taPODL.getByKey(idxProm); - if (tPODL.Rows.Count > 0) - { - var rPODL = tPODL[0]; - txtSearch.Text = rPODL.CodArticolo; - ddlArticolo.DataBind(); - ddlArticolo.SelectedValue = rPODL.CodArticolo; - ddlGruppi.DataBind(); - ddlGruppi.SelectedValue = rPODL.CodGruppo; - txtNumPz.Text = rPODL.NumPezzi.ToString(); - txtPzPallet.Text = rPODL.PzPallet.ToString(); - txtPrio.Text = rPODL.Priorita.ToString(); - if (memLayer.ML.cdvb("ADM_TC_MinSec")) - { - txtTCms.Text = TempiCiclo.minSec(rPODL.TCAssegnato); - } - else - { - txtTCmc.Text = rPODL.TCAssegnato.ToString("N3"); - } - ddlMacchine.SelectedValue = rPODL.IdxMacchina; - txtKeyExt.Text = rPODL.KeyRichiesta; - // svuoto se ci fosse cloning...... - memLayer.ML.emptySessionVal("idxProm2Clone"); - } - } - catch - { } - } + #endregion Public Properties + + #region Private Methods private void setDefaults() { @@ -102,16 +61,33 @@ namespace MP_ADM.WebUserControls } } - protected void txtSearch_TextChanged(object sender, EventArgs e) + /// + /// mostro elenco ultimi 5 tempi e note... + /// + private void showLastTimeAndNote() { - ddlArticolo.DataBind(); + // update tempi ciclo! + grViewTempi.DataBind(); } - #region gestione eventi + #endregion Private Methods - public event EventHandler eh_nuovoValore; + #region Protected Methods - #endregion gestione eventi + /// + /// annullamento inserimento + /// + /// + /// + protected void btnCancel_Click(object sender, EventArgs e) + { + memLayer.ML.emptySessionVal("idxProm2Clone"); + memLayer.ML.emptySessionVal("idxProm2Edit"); + if (eh_nuovoValore != null) + { + eh_nuovoValore(this, new EventArgs()); + } + } /// /// conferma inserimento TC @@ -189,43 +165,13 @@ namespace MP_ADM.WebUserControls } /// - /// annullamento inserimento + /// reset della selezione /// /// /// - protected void btnCancel_Click(object sender, EventArgs e) + protected void btnReset_Click(object sender, EventArgs e) { - memLayer.ML.emptySessionVal("idxProm2Clone"); - memLayer.ML.emptySessionVal("idxProm2Edit"); - if (eh_nuovoValore != null) - { - eh_nuovoValore(this, new EventArgs()); - } - } - - /// - /// aggiorno label min e centesimi - /// - /// - /// - protected void txtTempoCiclo_TextChanged(object sender, EventArgs e) - { -#if false - string text = ""; - string txtMinCent = txtTempoCiclo.Text.Trim().Replace(".", ","); - int min = 0; - int sec = 0; - try - { - // cerco di convertire in min/sec - min = Convert.ToInt32(Math.Floor(Convert.ToDouble(txtMinCent))); - sec = Convert.ToInt32((Convert.ToDouble(txtMinCent) - min) * 60); - text = string.Format("{0}:{1:00}", min, sec); - } - catch - { } - lblMinSec.Text = text; -#endif + resetSelezione(); } /// @@ -238,25 +184,6 @@ namespace MP_ADM.WebUserControls showLastTimeAndNote(); } - /// - /// mostro elenco ultimi 5 tempi e note... - /// - private void showLastTimeAndNote() - { - // update tempi ciclo! - grViewTempi.DataBind(); - } - - /// - /// selezione impianto - /// - /// - /// - protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e) - { - showLastTimeAndNote(); - } - /// /// selezione impianto /// @@ -268,22 +195,13 @@ namespace MP_ADM.WebUserControls } /// - /// reset della selezione + /// selezione impianto /// /// /// - protected void btnReset_Click(object sender, EventArgs e) + protected void ddlMacchine_SelectedIndexChanged(object sender, EventArgs e) { - resetSelezione(); - } - - /// - /// resetta la selezione dei valori in caso di modifiche su altri controlli - /// - public void resetSelezione() - { - grViewTempi.SelectedIndex = -1; - grViewTempi.DataBind(); + showLastTimeAndNote(); } /// @@ -314,5 +232,87 @@ namespace MP_ADM.WebUserControls } txtPzPallet.Text = rigaOdl.PzPallet.ToString(); } + + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + setDefaults(); + } + } + + protected void txtSearch_TextChanged(object sender, EventArgs e) + { + ddlArticolo.DataBind(); + } + + /// + /// aggiorno label min e centesimi + /// + /// + /// + protected void txtTempoCiclo_TextChanged(object sender, EventArgs e) + { + } + + #endregion Protected Methods + + #region Public Methods + + public void doSelPODL() + { + // se ho una promessa da clonare copio dati da quella... + int idxProm = 0; + try + { + if (memLayer.ML.isInSessionObject("idxProm2Clone")) + { + idxProm = memLayer.ML.IntSessionObj("idxProm2Clone"); + } + else if (memLayer.ML.isInSessionObject("idxProm2Edit")) + { + idxProm = memLayer.ML.IntSessionObj("idxProm2Edit"); + } + // provo a selezionare + var tPODL = DataLayerObj.taPODL.getByKey(idxProm); + if (tPODL.Rows.Count > 0) + { + var rPODL = tPODL[0]; + txtSearch.Text = rPODL.CodArticolo.Trim(); + ddlArticolo.DataBind(); + ddlArticolo.SelectedValue = rPODL.CodArticolo; + ddlGruppi.DataBind(); + ddlGruppi.SelectedValue = rPODL.CodGruppo; + txtNumPz.Text = rPODL.NumPezzi.ToString(); + txtPzPallet.Text = rPODL.PzPallet.ToString(); + txtPrio.Text = rPODL.Priorita.ToString(); + if (memLayer.ML.cdvb("ADM_TC_MinSec")) + { + txtTCms.Text = TempiCiclo.minSec(rPODL.TCAssegnato); + } + else + { + txtTCmc.Text = rPODL.TCAssegnato.ToString("N3"); + } + ddlMacchine.SelectedValue = rPODL.IdxMacchina; + txtKeyExt.Text = rPODL.KeyRichiesta; + // svuoto se ci fosse cloning...... + memLayer.ML.emptySessionVal("idxProm2Clone"); + } + } + catch + { } + } + + /// + /// resetta la selezione dei valori in caso di modifiche su altri controlli + /// + public void resetSelezione() + { + grViewTempi.SelectedIndex = -1; + grViewTempi.DataBind(); + } + + #endregion Public Methods } } \ No newline at end of file