144 lines
4.4 KiB
C#
144 lines
4.4 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace MP_ADM.WebUserControls
|
|
{
|
|
public partial class mod_approvazioneODL : 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>
|
|
/// reset della selezione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnReset_Click(object sender, EventArgs e)
|
|
{
|
|
resetSelezione();
|
|
}
|
|
|
|
/// <summary>
|
|
/// resetta la selezione dei valori in caso di modifiche su altri controlli
|
|
/// </summary>
|
|
public void resetSelezione()
|
|
{
|
|
grView.SelectedIndex = -1;
|
|
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;
|
|
try
|
|
{
|
|
idxOdl = Convert.ToInt32(grView.SelectedValue);
|
|
}
|
|
catch
|
|
{ }
|
|
MapoDb.DS_ProdTempi.ODLRow rigaOdl = DataLayerObj.taODL.getByIdx(idxOdl, false)[0];
|
|
// gestione buttons approvazione
|
|
string _comando = "";
|
|
if (memLayer.ML.isInSessionObject("nextObjCommand"))
|
|
{
|
|
_comando = memLayer.ML.StringSessionObj("nextObjCommand");
|
|
memLayer.ML.emptySessionVal("nextObjCommand");
|
|
}
|
|
switch (_comando)
|
|
{
|
|
case "Approva":
|
|
DataLayerObj.taODL.approvaTC(idxOdl, string.Format("{0}{1}Approvato da: {2}", rigaOdl.Note, Environment.NewLine, user_std.UtSn.CognomeNome), user_std.UtSn.CognomeNome, true);
|
|
break;
|
|
|
|
case "Rifiuta":
|
|
DataLayerObj.taODL.approvaTC(idxOdl, string.Format("{0}{1}Rifiutato da: {2}", rigaOdl.Note, Environment.NewLine, user_std.UtSn.CognomeNome), user_std.UtSn.CognomeNome, false);
|
|
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>
|
|
/// Classe css colore testo calcolato in abse ai TC
|
|
/// </summary>
|
|
/// <param name="_tcAssegnato"></param>
|
|
/// <param name="_tcAttrezzato"></param>
|
|
/// <returns></returns>
|
|
public string cssFromTempi(object _tcAssegnato, object _tcAttrezzato)
|
|
{
|
|
string answ = "text-dark";
|
|
double tcAssegnato = 0;
|
|
double tcAttrezzato = 0;
|
|
double.TryParse(_tcAssegnato.ToString(), out tcAssegnato);
|
|
double.TryParse(_tcAttrezzato.ToString(), out tcAttrezzato);
|
|
if (tcAttrezzato > tcAssegnato)
|
|
{
|
|
answ = "text-danger";
|
|
}
|
|
else
|
|
if (tcAttrezzato < tcAssegnato)
|
|
{
|
|
answ = "text-success";
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
} |