204 lines
6.0 KiB
C#
204 lines
6.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SteamWare;
|
|
using WebSCR_data;
|
|
|
|
namespace WebSCR.WebUserControls
|
|
{
|
|
public partial class mod_Interventi : System.Web.UI.UserControl
|
|
{
|
|
public event EventHandler eh_selData;
|
|
/// <summary>
|
|
/// solleva evento selezione data
|
|
/// </summary>
|
|
protected void reportEvent()
|
|
{
|
|
// evento!
|
|
if (eh_selData != null)
|
|
{
|
|
eh_selData(this, new EventArgs());
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// numero giorni selezionati
|
|
/// </summary>
|
|
public int numGG
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
try
|
|
{
|
|
answ = Convert.ToInt32(txtNumGG.Text.Trim());
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
int newVal = 0;
|
|
if (value >= newVal) newVal = value;
|
|
txtNumGG.Text = newVal.ToString();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// data riferimento
|
|
/// </summary>
|
|
public DateTime dataFrom
|
|
{
|
|
get
|
|
{
|
|
DateTime answ = DateTime.Now.Date;
|
|
try
|
|
{
|
|
answ = Convert.ToDateTime(txtDataFrom.Text.Trim());
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
txtDataFrom.Text = value.ToString("yyyy-MM-dd");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// data selezionata (da query string o inizializzata...
|
|
/// </summary>
|
|
protected DateTime dataSel
|
|
{
|
|
get
|
|
{
|
|
DateTime answ = DateTime.Now;
|
|
if (memLayer.ML.isInSessionObject("DataRif"))
|
|
{
|
|
try
|
|
{
|
|
answ = Convert.ToDateTime(memLayer.ML.StringSessionObj("DataRif"));
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
else if (memLayer.ML.getCookieVal("DataRif") != "")
|
|
{
|
|
try
|
|
{
|
|
answ = Convert.ToDateTime(memLayer.ML.getCookieVal("DataRif"));
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("DataRif", value);
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
dataFrom = dataSel;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// ultimo comando letto da link button
|
|
/// </summary>
|
|
public string lastCmd { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// aggiungo/tolgo all'intervallo selezione
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbNumGg_Click(object sender, EventArgs e)
|
|
{
|
|
int diff = 0;
|
|
try
|
|
{
|
|
LinkButton lb = (LinkButton)sender;
|
|
diff = Convert.ToInt32(lb.CommandArgument);
|
|
}
|
|
catch
|
|
{ }
|
|
numGG = numGG + diff;
|
|
reportEvent();
|
|
}
|
|
|
|
protected void txtDataFrom_TextChanged(object sender, EventArgs e)
|
|
{
|
|
dataSel = Convert.ToDateTime(txtDataFrom.Text);
|
|
reportEvent();
|
|
}
|
|
|
|
protected void txtNumGG_TextChanged(object sender, EventArgs e)
|
|
{
|
|
reportEvent();
|
|
}
|
|
/// <summary>
|
|
/// selezione nuova squadra...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void rblSquadre_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// aggiorno controllo...
|
|
}
|
|
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
|
|
{
|
|
// salvo il command argument...
|
|
lastCmd = e.CommandArgument.ToString();
|
|
}
|
|
/// <summary>
|
|
/// verifica se valore passato è NON NULLO
|
|
/// </summary>
|
|
/// <param name="dataInizio"></param>
|
|
/// <returns></returns>
|
|
public bool notNull(object dataInizio)
|
|
{
|
|
bool answ = false;
|
|
try
|
|
{
|
|
answ = dataInizio.ToString() != "";
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// evento selezione paziente...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// recupero dati paziente...
|
|
int IdxImpegno = 0;
|
|
DS_Applicazione.ImpegniRow riga;// = DtProxy.man.taImp.GetData()[0];
|
|
try
|
|
{
|
|
IdxImpegno = Convert.ToInt32(grView.SelectedDataKey["IdxImpegno"]);
|
|
memLayer.ML.setSessionVal("IdxImpegno", IdxImpegno);
|
|
riga = DtProxy.man.taImp.getByKey(IdxImpegno)[0];
|
|
memLayer.ML.setSessionVal("Cliente", string.Format("{0}", riga.RagSoc));
|
|
memLayer.ML.setSessionVal("CodCliente", riga.CodCliente);
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
logger.lg.scriviLog(string.Format("Errore in rimando clienti --> interventi: {0}{1}", Environment.NewLine, exc));
|
|
riga = DtProxy.man.taImp.GetData()[0];
|
|
}
|
|
// rimando su pagina!
|
|
Response.Redirect(string.Format("{0}?CodCliente={1}&Indir={2}&Data={3:yyyy-MM-dd}&IdxImpegno={4}", "Pianificazione", riga.CodCliente, riga.Indir, riga.DataOra, IdxImpegno));
|
|
}
|
|
|
|
}
|
|
} |