158 lines
4.7 KiB
C#
158 lines
4.7 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.TimeRangeSelected += DayPilotCalendar1_TimeRangeSelected;
|
|
DayPilotCalendar1.EventMove += DayPilotCalendar1_EventMove;
|
|
}
|
|
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);
|
|
}
|
|
void DayPilotCalendar1_EventMove(object sender, DayPilot.Web.Ui.Events.EventMoveEventArgs e)
|
|
{
|
|
// sposto evento!
|
|
DtProxy.man.taImp.updStart(Convert.ToInt32(e.Id), e.NewStart);
|
|
doUpdate();
|
|
}
|
|
|
|
/// <summary>
|
|
/// evento selezione periodo inizio
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
void DayPilotCalendar1_TimeRangeSelected(object sender, DayPilot.Web.Ui.Events.TimeRangeSelectedEventArgs e)
|
|
{
|
|
// se ho squadra selezionata...
|
|
if (rblSquadre.SelectedIndex >= 0)
|
|
{
|
|
// recupero indirizzo e cliente !!FARE!!!
|
|
// selezionato periodo, salvo evento inizio...
|
|
DtProxy.man.taImp.insertQuery(e.Start, "INDIC", rblSquadre.SelectedValue, "OC00000000");
|
|
}
|
|
doUpdate();
|
|
}
|
|
|
|
private void doUpdate()
|
|
{
|
|
//ods.DataBind();
|
|
//rblSquadre.SelectedIndex = -1;
|
|
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...
|
|
}
|
|
|
|
protected void btnAllSquadre_Click(object sender, EventArgs e)
|
|
{
|
|
// resetto sel rbl
|
|
rblSquadre.SelectedIndex = -1;
|
|
}
|
|
/// <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)
|
|
{
|
|
try
|
|
{
|
|
// this assumes your event object in Events collection has "color" field or property
|
|
e.BackgroundColor = (string)e.DataItem["CssColor"];
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
|
|
protected void DayPilotCalendar1_EventClick(object sender, DayPilot.Web.Ui.Events.EventClickEventArgs e)
|
|
{
|
|
#if false
|
|
Response.Redirect(string.Format("{0}?CodCliente={1}&Indir={2}&Data={3:yyyy-MM-dd}&IdxImpegno={4}", devicesAuthProxy.pagCorrente, qsVal("CodCliente"), qsVal("Indir"), qsVal("Data"), e.Id));
|
|
#endif
|
|
}
|
|
}
|
|
} |