184 lines
4.2 KiB
C#
184 lines
4.2 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace XPS.WebUserControls
|
|
{
|
|
public partial class mod_noteItem : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// event handler generico
|
|
/// </summary>
|
|
public event EventHandler eh_hide;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// Valore filtro IdxObj x le note(PARENT)
|
|
/// </summary>
|
|
public string idxObj
|
|
{
|
|
get
|
|
{
|
|
return hfIdxObj.Value;
|
|
}
|
|
set
|
|
{
|
|
// se il cod fosse > 8 char --> trimmo!!!
|
|
if (value.Length > 8) value = value.Substring(0, 8);
|
|
hfIdxObj.Value = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Determina abilitazioen chiusura note
|
|
/// </summary>
|
|
public bool enableClose
|
|
{
|
|
get
|
|
{
|
|
return chkEnableClose.Checked;
|
|
}
|
|
set
|
|
{
|
|
chkEnableClose.Checked = value;
|
|
}
|
|
}
|
|
|
|
protected void lbtAddNew_Click(object sender, EventArgs e)
|
|
{
|
|
divAddNew.Visible = !divAddNew.Visible;
|
|
}
|
|
|
|
protected void lbtAdd_Click(object sender, EventArgs e)
|
|
{
|
|
XPS_data.XPS.obj.taNote.insertQuery(idxObj, "", user_std.UtSn.utente, txtNota.Text.Trim());
|
|
// nascondo ed aggiorno
|
|
resetNote();
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
}
|
|
|
|
protected void lbtCancel_Click(object sender, EventArgs e)
|
|
{
|
|
resetNote();
|
|
}
|
|
|
|
private void resetNote()
|
|
{
|
|
txtNota.Text = "";
|
|
divAddNew.Visible = false;
|
|
}
|
|
/// <summary>
|
|
/// Determina css colore secondo se sia stato chiuso o meno
|
|
/// </summary>
|
|
/// <param name="closed"></param>
|
|
/// <returns></returns>
|
|
public string cssByClosed(object closed)
|
|
{
|
|
string answ = "";
|
|
if ((bool)closed)
|
|
{
|
|
answ = "text-success";
|
|
}
|
|
else
|
|
{
|
|
answ = "text-warning";
|
|
}
|
|
return answ;
|
|
}
|
|
protected void chkEnableClose_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Codice OBJ selezionato (INT)
|
|
/// </summary>
|
|
protected int CodSel
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
string _num = grView.SelectedValue.ToString();
|
|
int.TryParse(_num, out answ);
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// wrapper traduzione
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
public string traduci(object lemma)
|
|
{
|
|
string answ = "";
|
|
if (lemma != null)
|
|
{
|
|
if (lemma.ToString() != "")
|
|
{
|
|
answ = user_std.UtSn.Traduci(lemma.ToString());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
answ = "--";
|
|
}
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// Metodi di select
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
string _comando = "";
|
|
if (memLayer.ML.isInSessionObject("nextObjCommand"))
|
|
{
|
|
_comando = memLayer.ML.StringSessionObj("nextObjCommand");
|
|
memLayer.ML.emptySessionVal("nextObjCommand");
|
|
}
|
|
// verifico il tipo di richiesta (up/down level, clona o update normale
|
|
switch (_comando)
|
|
{
|
|
case "ChiudiNote":
|
|
// chiamo update x chiudere la nota
|
|
XPS_data.XPS.obj.taNote.closeNote(CodSel);
|
|
// aggiorno griView...
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
break;
|
|
default:
|
|
// nulla!
|
|
break;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// salvo in session che il prox comando è togliere priorità URGENTE...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtChiudi_Click(object sender, EventArgs e)
|
|
{
|
|
memLayer.ML.setSessionVal("nextObjCommand", "ChiudiNote");
|
|
}
|
|
|
|
protected void lbtClose_Click(object sender, EventArgs e)
|
|
{
|
|
if (eh_hide != null)
|
|
{
|
|
eh_hide(this, new EventArgs());
|
|
}
|
|
}
|
|
}
|
|
} |