138 lines
3.9 KiB
C#
138 lines
3.9 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
public partial class mod_dettMtzProg : System.Web.UI.UserControl
|
|
{
|
|
public event EventHandler eh_newInserted;
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
traduciObj();
|
|
setupValori();
|
|
}
|
|
}
|
|
|
|
private void setupValori()
|
|
{
|
|
//txtDataInizio.Text = DateTime.Now.ToString("dd/MM/yy");
|
|
txtDataInizio.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
|
txtCadenza.Text = "1";
|
|
}
|
|
|
|
private void traduciObj()
|
|
{
|
|
lblTxtCerca.Text = traduci("lblTxtCerca");
|
|
lblInsNewIntPro.Text = traduci("lblInsNewIntPro");
|
|
lblDescrMtzPro.Text = traduci("lblDescrMtzPro");
|
|
lblInizioMtzPro.Text = traduci("lblInizioMtzPro");
|
|
lblPrior.Text = traduci("lblPrior");
|
|
chkImpFermo.Text = traduci("chkImpFermo");
|
|
lblTipoGuasto.Text = traduci("lblTipoGuasto");
|
|
lblFreq.Text = traduci("lblFreq");
|
|
lblCadenza.Text = traduci("lblCadenza");
|
|
btnCreaMtzPro.Text = traduci("btnCreaMtzPro");
|
|
lblMacchineInteressate.Text = traduci("lblMacchineInteressate");
|
|
rfvCad.Text = traduci("cadIntReq");
|
|
rfvDescrizione.Text = traduci("descrIntReq");
|
|
rfvData.Text = traduci("dataReq");
|
|
}
|
|
/// <summary>
|
|
/// wrap traduzione
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(object lemma)
|
|
{
|
|
return user_std.UtSn.Traduci(lemma.ToString());
|
|
}
|
|
protected void btnCreaMtzPro_Click(object sender, EventArgs e)
|
|
{
|
|
// spazzo TUTTE le righe del controllo...
|
|
foreach (ListItem riga in listMacchine.Items)
|
|
{
|
|
// se è selezionata creo riga anche x lei...
|
|
if (riga.Selected)
|
|
{
|
|
creaInterventoMtzPro(Convert.ToInt32(riga.Value));
|
|
}
|
|
}
|
|
// resetto selezioni e controlli...
|
|
txtDescrizione.Text = "";
|
|
txtCercaMacchine.Text = "*";
|
|
listMacchine.SelectedIndex = -1;
|
|
if (eh_newInserted != null)
|
|
{
|
|
eh_newInserted(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// crea un intervento di mtz programmata x la macchina con idx passato
|
|
/// </summary>
|
|
/// <param name="p"></param>
|
|
private void creaInterventoMtzPro(int idx)
|
|
{
|
|
TA_app.obj.taMtzPro.insertQuery(idx, Convert.ToDateTime(txtDataInizio.Text), ddlFreq.SelectedValue, Convert.ToInt32(txtCadenza.Text), txtDescrizione.Text.Trim(), Convert.ToInt32(ddlPrior.SelectedValue), chkImpFermo.Checked, Convert.ToInt32(ddlTipo.SelectedValue), Convert.ToInt32(ddlCausale.SelectedValue));
|
|
}
|
|
/// <summary>
|
|
/// aggiorna selezione di default
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPrior_DataBound(object sender, EventArgs e)
|
|
{
|
|
ddlPrior.SelectedIndex = memLayer.ML.CRI("defPriorMtzPred");
|
|
}
|
|
protected void ddlCausale_DataBound(object sender, EventArgs e)
|
|
{
|
|
ddlCausale.SelectedValue = memLayer.ML.CRS("defCauMtzPred");
|
|
}
|
|
|
|
protected override void OnInit(EventArgs e)
|
|
{
|
|
base.OnInit(e);
|
|
if (!Page.IsPostBack)
|
|
{
|
|
mod_filtroImpianto.ods = odsImpianti;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// chiamato post modifica valore check/selezione nel selettore filtro impianto
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void eh_selectedImpianto(object sender, EventArgs e)
|
|
{
|
|
checkFixOds();
|
|
}
|
|
|
|
private void checkFixOds()
|
|
{
|
|
if (mod_filtroImpianto.valoreInt != 0)
|
|
{
|
|
// resetto la selezione...
|
|
listMacchine.SelectedIndex = -1;
|
|
// cambio filtro su ods macchine mostrate...
|
|
if (mod_filtroImpianto.valoreInt > 0)
|
|
{
|
|
odsMacchine.FilterExpression = "(label LIKE '%{0}%') AND conditio = " + mod_filtroImpianto.valore;
|
|
odsMacchine.DataBind();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
odsMacchine.FilterExpression = "(label LIKE '%{0}%')";
|
|
odsMacchine.DataBind();
|
|
}
|
|
}
|
|
protected void txtCercaMacchine_TextChanged(object sender, EventArgs e)
|
|
{
|
|
checkFixOds();
|
|
}
|
|
|
|
}
|