237 lines
5.6 KiB
C#
237 lines
5.6 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_giornata : System.Web.UI.UserControl
|
|
{
|
|
public event EventHandler eh_newData;
|
|
/// <summary>
|
|
/// solleva evento selezione data
|
|
/// </summary>
|
|
protected void reportEvent()
|
|
{
|
|
// evento!
|
|
if (eh_newData != null)
|
|
{
|
|
eh_newData(this, new EventArgs());
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
lblCodCli.Text = Request.QueryString["CodCliente"];
|
|
if (qsVal("Data") != "")
|
|
{
|
|
data = Convert.ToDateTime(qsVal("Data"));
|
|
}
|
|
DayPilotCalendar1.Days = day2show;
|
|
// controllo SE si tratta di reload faccio update...
|
|
if (memLayer.ML.BoolSessionObj("forceUpdate"))
|
|
{
|
|
memLayer.ML.setSessionVal("forceUpdate", false);
|
|
doUpdate();
|
|
}
|
|
}
|
|
|
|
|
|
public int day2show
|
|
{
|
|
get
|
|
{
|
|
int answ = memLayer.ML.CRI("day2show");
|
|
try
|
|
{
|
|
answ = memLayer.ML.IntSessionObj("day2show");
|
|
if (answ < 1) answ = memLayer.ML.CRI("day2show");
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("day2show", value);
|
|
doUpdate();
|
|
}
|
|
}
|
|
public string CodCliente
|
|
{
|
|
get
|
|
{
|
|
return qsVal("CodCliente");
|
|
}
|
|
}
|
|
public string Indir
|
|
{
|
|
get
|
|
{
|
|
return qsVal("Indir");
|
|
}
|
|
}
|
|
public string Data
|
|
{
|
|
get
|
|
{
|
|
return qsVal("Data");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// recupera valore querystring
|
|
/// </summary>
|
|
/// <param name="nome"></param>
|
|
/// <returns></returns>
|
|
protected string qsVal(string nome)
|
|
{
|
|
return memLayer.ML.QSS(nome);
|
|
}
|
|
protected void DayPilotCalendar1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
|
|
{
|
|
// controllo se sia EFFETTIVO spostamento (altrimenti è edit...)
|
|
if (e.NewStart == e.OldStart && e.NewEnd == e.OldEnd)
|
|
{
|
|
// rimando a edit!!!
|
|
Response.Redirect(string.Format("{0}?Action=EDIT&CodCliente={1}&Indir={2}&Data={3}&IdxImpegno={4}", devicesAuthProxy.pagCorrente, CodCliente, Indir, Data, e.Id));
|
|
}
|
|
else
|
|
{
|
|
// controllo che sia presente matricola altrimenti NON lo permetto...
|
|
if (matrOp != "")
|
|
{
|
|
// sposto evento!
|
|
DtProxy.man.taImp.updStart(Convert.ToInt32(e.Id), e.NewStart, user_std.UtSn.userNameAD, matrOp, DateTime.Now);
|
|
if (memLayer.ML.confReadBool("svuotaMatrOpMove"))
|
|
{
|
|
// rimuovo matrOp
|
|
memLayer.ML.emptySessionVal("matrOp");
|
|
errorMess = "spostamento effettuato";
|
|
}
|
|
doUpdate();
|
|
Response.Redirect(devicesAuthProxy.pagCorrente);
|
|
}
|
|
else
|
|
{
|
|
errorMess = "Attenzione manca matricola! prego selezionare prima di effettuare spostamento.";
|
|
Response.Redirect(devicesAuthProxy.pagCorrente);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// anno selezionato
|
|
/// </summary>
|
|
public int yearSel
|
|
{
|
|
get
|
|
{
|
|
int answ = DateTime.Now.Year;
|
|
if (memLayer.ML.isInSessionObject("yearSel"))
|
|
{
|
|
answ = memLayer.ML.IntSessionObj("yearSel");
|
|
}
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// anno selezionato
|
|
/// </summary>
|
|
public string errorMess
|
|
{
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("errorMess", value);
|
|
|
|
}
|
|
}
|
|
|
|
public void doUpdate()
|
|
{
|
|
DayPilotCalendar1.DataBind();
|
|
DayPilotCalendar1.Update();
|
|
reportEvent();
|
|
}
|
|
/// <summary>
|
|
/// data di riferimento
|
|
/// </summary>
|
|
public DateTime data
|
|
{
|
|
get
|
|
{
|
|
DateTime answ = DateTime.Now;
|
|
try
|
|
{
|
|
answ = DayPilotCalendar1.StartDate;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
DayPilotCalendar1.StartDate = value;
|
|
lblData.Text = value.ToString("yyyy/MM/dd");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// selezione nuova squadra...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void rblSquadre_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// aggiorno controllo...
|
|
}
|
|
|
|
/// <summary>
|
|
/// intercetto e cambio classe CSS...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void DayPilotCalendar1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs e)
|
|
{
|
|
if (e.DataItem.Source != null)
|
|
{
|
|
try
|
|
{
|
|
// this assumes your event object in Events collection has "color" field or property
|
|
e.BackgroundColor = (string)e.DataItem["CssColor"];
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
logger.lg.scriviLog(string.Format("Eccezione in cambio colore evento:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
logger.lg.scriviLog(string.Format("Eccezione DataItem Nullo:{0}{1}", Environment.NewLine, e.DataItem), tipoLog.EXCEPTION);
|
|
}
|
|
}
|
|
|
|
public string matrOp
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("matrOp");
|
|
}
|
|
}
|
|
public string currDoc
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("currDoc");
|
|
}
|
|
}
|
|
public string codSquadra
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.StringSessionObj("elencoSquadre").Split(',')[0].ToString();
|
|
}
|
|
}
|
|
|
|
}
|
|
} |