214 lines
6.9 KiB
C#
214 lines
6.9 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 GPW_data;
|
|
|
|
namespace GPW.WebUserControls
|
|
{
|
|
public partial class mod_commAttivita : System.Web.UI.UserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
// controllo se ho una data selezionata da URL
|
|
if (memLayer.ML.QSS("dataRif") != "")
|
|
{
|
|
dataRif = memLayer.ML.QSD("dataRif");
|
|
}
|
|
setupPage();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// pagina di return a fine editing
|
|
/// </summary>
|
|
public string returnPage
|
|
{
|
|
get
|
|
{
|
|
string answ = memLayer.ML.confReadString("baseUrl");
|
|
try
|
|
{
|
|
answ = memLayer.ML.StringSessionObj("returnPage");
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("returnPage", value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// data riferimento (selezionata) da session
|
|
/// </summary>
|
|
public DateTime dataRif
|
|
{
|
|
get
|
|
{
|
|
DateTime answ = DateTime.Now;
|
|
// cerco in session...
|
|
if(memLayer.ML.isInSessionObject("dataRif"))
|
|
{
|
|
try
|
|
{
|
|
|
|
answ = Convert.ToDateTime(memLayer.ML.objSessionObj("dataRif"));
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
// altrimenti cerco in URL e salvo in session...
|
|
else if (memLayer.ML.QSS("dataRif")!="")
|
|
{
|
|
answ = memLayer.ML.QSD("dataRif");
|
|
dataRif = answ;
|
|
}
|
|
// restituisco!
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("dataRif", value);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// imposta la pagina
|
|
/// </summary>
|
|
private void setupPage()
|
|
{
|
|
// salvo dataFrom/To x visualizzazione attivita
|
|
lblDataRif.Text = dataRif.ToString("dd.MM.yy");
|
|
// recupero dati della commessa utente giornaliera...
|
|
try
|
|
{
|
|
int maxErrMinus = memLayer.ML.confReadInt("maxErrMinus");
|
|
int maxErrPlus = memLayer.ML.confReadInt("maxErrPlus");
|
|
DS_Applicazione.v_logCommUtRow rigaLog = DataProxy.DP.taLCU.getByIdxDipDate(memLayer.ML.IntSessionObj("idxDipendente"), dataRif, dataRif.AddDays(1), maxErrMinus, maxErrPlus)[0];
|
|
lblTotOreRA.Text = string.Format("{0:0.##} h / {1:0.##} h", rigaLog.h_com, rigaLog.h_lav);
|
|
}
|
|
catch
|
|
{
|
|
lblTotOreRA.Text = "...";
|
|
}
|
|
memLayer.ML.setSessionVal("dataFromRA", dataRif.Date);
|
|
memLayer.ML.setSessionVal("dataToRA", dataRif.AddDays(1).Date);
|
|
}
|
|
/// <summary>
|
|
/// recupera cliente da idxFase
|
|
/// </summary>
|
|
/// <param name="idxFase"></param>
|
|
/// <returns></returns>
|
|
public string cliByIdxFase(object _idxFase)
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
int idxFase = Convert.ToInt32(_idxFase);
|
|
DS_Applicazione.AnagFasiRow fase = DataProxy.DP.taAF.getByIdx(idxFase)[0];
|
|
int idxPrj = Convert.ToInt32(fase.idxProgetto);
|
|
DS_Applicazione.AnagProgettiRow progetto = DataProxy.DP.taAP.getByIdxPrj(idxPrj)[0];
|
|
answ = DataProxy.DP.taAnCli.getByIdx(progetto.idxCliente)[0].RagSociale;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// recupera progetto da idxFase
|
|
/// </summary>
|
|
/// <param name="idxFase"></param>
|
|
/// <returns></returns>
|
|
public string prjByIdxFase(object _idxFase)
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
int idxFase = Convert.ToInt32(_idxFase);
|
|
DS_Applicazione.AnagFasiRow fase = DataProxy.DP.taAF.getByIdx(idxFase)[0];
|
|
int idxPrj = Convert.ToInt32(fase.idxProgetto);
|
|
DS_Applicazione.AnagProgettiRow progetto = DataProxy.DP.taAP.getByIdxPrj(idxPrj)[0];
|
|
answ = progetto.nomeProj;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// recupera descrizione e nome fase da idxFase
|
|
/// </summary>
|
|
/// <param name="idxFase"></param>
|
|
/// <returns></returns>
|
|
public string faseByIdx(object _idxFase)
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
int idxFase = Convert.ToInt32(_idxFase);
|
|
DS_Applicazione.AnagFasiRow fase = DataProxy.DP.taAF.getByIdx(idxFase)[0];
|
|
answ = string.Format("{0} <i>({1})</i>", fase.nomeFase, fase.descrizioneFase);
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// rimanda ad edit
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lnkEdit_Click(object sender, EventArgs e)
|
|
{
|
|
// salvo
|
|
LinkButton lbtn = (LinkButton)sender;
|
|
memLayer.ML.setSessionVal("idxRASel", lbtn.CommandArgument);
|
|
// redirect!
|
|
Response.Redirect("attivitaIns.aspx");
|
|
}
|
|
/// <summary>
|
|
/// rimanda ad edit
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lnkClona_Click(object sender, EventArgs e)
|
|
{
|
|
// salvo
|
|
LinkButton lbtn = (LinkButton)sender;
|
|
int idxRa=0;
|
|
try
|
|
{
|
|
idxRa = Convert.ToInt32(lbtn.CommandArgument);
|
|
}
|
|
catch
|
|
{ }
|
|
// chiamo clona!
|
|
DataProxy.DP.taRA.clonaRecord(idxRa);
|
|
//update!
|
|
setupPage();
|
|
repRegAtt.DataBind();
|
|
}
|
|
protected void lnkCreateNew_Click(object sender, EventArgs e)
|
|
{
|
|
memLayer.ML.emptySessionVal("idxRASel");
|
|
// redirect!
|
|
Response.Redirect("attivitaIns.aspx");
|
|
}
|
|
/// <summary>
|
|
/// aggiorno data selezionata!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void calDataRif_SelectionChanged(object sender, EventArgs e)
|
|
{
|
|
dataRif = calDataRif.SelectedDate;
|
|
setupPage();
|
|
repRegAtt.DataBind();
|
|
}
|
|
}
|
|
} |