primo inserimento modulo navigazioen settimanale in resoconto ore full

This commit is contained in:
Samuele Locatelli
2013-09-12 10:42:39 +02:00
parent 0cc26fd6ba
commit ff88032c3d
8 changed files with 280 additions and 79 deletions
@@ -0,0 +1,22 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_navigaWeek.ascx.cs" Inherits="PROJ_ETS.WebUserControls.mod_navigaWeek" %>
<div class="divSx filtro_2 ui-corner-all" style="padding: 3px; margin-right: 4px; height: 2em;">
Anno:&nbsp;
<asp:DropDownList runat="server" ID="ddlAnno" DataSourceID="odsYear" DataTextField="n" DataValueField="n" AutoPostBack="true" OnSelectedIndexChanged="ddlAnno_SelectedIndexChanged">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsYear" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="ETS_Data.DS_utilsProjEtsTableAdapters.v_selYearTableAdapter"></asp:ObjectDataSource>
</div>
<div class="divSx filtro_2 ui-corner-all" style="padding: 3px; margin-right: 4px; height: 2em;">
Settimana:&nbsp;
<asp:DropDownList runat="server" ID="ddlWeek" DataSourceID="odsWeek" DataTextField="n" DataValueField="n" AutoPostBack="true" OnSelectedIndexChanged="ddlWeek_SelectedIndexChanged">
</asp:DropDownList>
<asp:ObjectDataSource ID="odsWeek" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="ETS_Data.DS_utilsProjEtsTableAdapters.v_selWeekTableAdapter"></asp:ObjectDataSource>
</div>
<div class="divSx filtro_2 ui-corner-all" style="padding: 6px; margin-right: 4px; height: 1.5em; font-weight: bold; width: 2em; vertical-align: middle; text-align: center;">
<asp:LinkButton runat="server" ID="lnkWPrev" CommandArgument="Prev" Text="-1" ToolTip="Vai alla sett precedente" OnClick="lnkW_Click" />
</div>
<div class="divSx filtro_2 ui-corner-all" style="padding: 6px 3px; margin-right: 4px; height: 1.5em; font-weight: bold; width: 2.5em; vertical-align: middle; text-align: center;">
<asp:LinkButton runat="server" ID="lnkW" CommandArgument="Curr" Text="W" ToolTip="Vai alla sett corrente" OnClick="lnkW_Click" />
</div>
<div class="divSx filtro_2 ui-corner-all" style="padding: 6px; margin-right: 4px; height: 1.5em; font-weight: bold; width: 2em; vertical-align: middle; text-align: center;">
<asp:LinkButton runat="server" ID="lnkWNext" CommandArgument="Next" Text="+1" ToolTip="Vai alla sett successiva" OnClick="lnkW_Click" />
</div>
@@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ETS_Data;
using NLog;
namespace PROJ_ETS.WebUserControls
{
public partial class mod_navigaWeek : System.Web.UI.UserControl
{
/// <summary>
/// evento nuovi valori selezionati
/// </summary>
public event EventHandler eh_newWeekSelected;
/// <summary>
/// istante corrente
/// </summary>
public DateTime adesso
{
set
{
utils.obj.setSessionVal("timeImpiego", value);
}
get
{
DateTime answ = DateTime.Now;
try
{
answ = (DateTime)utils.obj.objSessionObj("timeImpiego");
}
catch
{ }
return answ;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
setDdlPeriodo();
//importo sett corrente
lnkW.Text = string.Format("W{0:0#}", datario.WeekOfYearISO8601(DateTime.Now));
}
}
/// <summary>
/// imposta DDL del periodo
/// </summary>
public void setDdlPeriodo()
{
ddlAnno.SelectedValue = adesso.Year.ToString();
ddlWeek.SelectedValue = (datario.WeekOfYearISO8601(adesso)).ToString();
// ricalcolo periodo!
DataProxy_ProjEts.DP.taIR.importSettimana(anno, settimana);
}
/// <summary>
/// anno selezionato
/// </summary>
public int anno
{
get
{
int answ = adesso.Year;
try
{
answ = Convert.ToInt32(ddlAnno.SelectedValue);
}
catch
{ }
return answ;
}
}
/// <summary>
/// settimana selezionato
/// </summary>
public int settimana
{
get
{
int answ = datario.WeekOfYearISO8601(adesso);
try
{
answ = Convert.ToInt32(ddlWeek.SelectedValue);
}
catch
{ }
return answ;
}
}
protected void ddlAnno_SelectedIndexChanged(object sender, EventArgs e)
{
// salvo nuovo anno & nuova week!
int currWeek = datario.WeekOfYearISO8601(adesso);
int currYear = adesso.Year;
adesso = adesso.AddYears(anno - currYear).AddDays(7 * (settimana - currWeek));
if (eh_newWeekSelected != null)
{
eh_newWeekSelected(this, new EventArgs());
}
//doUpdate();
}
protected void ddlWeek_SelectedIndexChanged(object sender, EventArgs e)
{
// salvo nuovo anno & nuova week!
int currWeek = datario.WeekOfYearISO8601(adesso);
int currYear = adesso.Year;
adesso = adesso.AddYears(anno - currYear).AddDays(7 * (settimana - currWeek));
if (eh_newWeekSelected != null)
{
eh_newWeekSelected(this, new EventArgs());
}
//doUpdate();
}
/// <summary>
/// effettua selezione periodo rapida: 0 = corrente (ovvero la PROSSIMA), +1 = successiva (a seleizonata), -1 = precedente (a selezionata)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lnkW_Click(object sender, EventArgs e)
{
// sposto!
LinkButton lnk = (LinkButton)sender;
if (lnk.CommandArgument == "Curr")
{
adesso = DateTime.Now;
}
else if (lnk.CommandArgument == "Prev")
{
adesso = adesso.AddDays(-7);
}
else if (lnk.CommandArgument == "Next")
{
adesso = adesso.AddDays(7);
}
setDdlPeriodo();
if (eh_newWeekSelected != null)
{
eh_newWeekSelected(this, new EventArgs());
}
//doUpdate();
}
}
}
@@ -0,0 +1,78 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PROJ_ETS.WebUserControls {
public partial class mod_navigaWeek {
/// <summary>
/// ddlAnno control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlAnno;
/// <summary>
/// odsYear control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsYear;
/// <summary>
/// ddlWeek control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlWeek;
/// <summary>
/// odsWeek control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsWeek;
/// <summary>
/// lnkWPrev control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lnkWPrev;
/// <summary>
/// lnkW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lnkW;
/// <summary>
/// lnkWNext control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lnkWNext;
}
}
@@ -1,7 +1,9 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_weekRA.ascx.cs" Inherits="PROJ_ETS.WebUserControls.mod_weekRA" %>
<%@ Register src="mod_navigaWeek.ascx" tagname="mod_navigaWeek" tagprefix="uc1" %>
<div class="filtro_1 fontPiccolo ui-corner-all shadowBox" style="white-space: nowrap; height: 2.5em; padding: 4px;">
<div class="divSx filtro_2 ui-corner-all" style="padding: 3px; margin-right: 4px; height: 2em;">
<%--<div class="divSx filtro_2 ui-corner-all" style="padding: 3px; margin-right: 4px; height: 2em;">
Anno:&nbsp;
<asp:DropDownList runat="server" ID="ddlAnno" DataSourceID="odsYear" DataTextField="n" DataValueField="n" AutoPostBack="true" OnSelectedIndexChanged="ddlAnno_SelectedIndexChanged">
</asp:DropDownList>
@@ -21,7 +23,8 @@
</div>
<div class="divSx filtro_2 ui-corner-all" style="padding: 6px; margin-right: 4px; height: 1.5em; font-weight: bold; width: 2em; vertical-align: middle; text-align: center;">
<asp:LinkButton runat="server" ID="lnkWNext" CommandArgument="Next" Text="+1" ToolTip="Vai alla sett successiva" OnClick="lnkW_Click" />
</div>
</div>--%>
<uc1:mod_navigaWeek ID="mod_navigaWeek1" runat="server" />
</div>
<div class="clearDiv">
<div class="divSx fontMini ui-corner-all shadowBox" style="text-align: center; padding: 10px 1px; vertical-align: middle;">
@@ -29,6 +29,7 @@ namespace PROJ_ETS.WebUserControls
protected Ds_ProjEts.ImpiegoRisorseRow rigaIR;
protected Ds_ProjEts.DipendentiRow rigaDip;
protected DS_utilsProjEts.v_selCommesseRow rigaComm;
#if true
/// <summary>
/// istante corrente
/// </summary>
@@ -49,7 +50,8 @@ namespace PROJ_ETS.WebUserControls
{ }
return answ;
}
}
}
#endif
/// <summary>
/// caricamento pagina
/// </summary>
@@ -57,12 +59,14 @@ namespace PROJ_ETS.WebUserControls
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
#if false
if (!Page.IsPostBack)
{
setDdlPeriodo();
//importo sett corrente
lnkW.Text = string.Format("W{0:0#}", datario.WeekOfYearISO8601(DateTime.Now));
}
}
#endif
// carico tabelle: elenco dipendenti (raggruppato x tipo) ed elenco dip in Impiego...
tabDip = DataProxy_ProjEts.DP.taDip.GetData();
tabD2ATR = DataProxy_ProjEts.DP.taD2ATR.getBazOrd();
@@ -71,7 +75,18 @@ namespace PROJ_ETS.WebUserControls
// faccio update!
doUpdate();
}
mod_navigaWeek1.eh_newWeekSelected += mod_navigaWeek1_eh_newWeekSelected;
}
/// <summary>
/// selezioanta nuova sett --> faccio udpate!!!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void mod_navigaWeek1_eh_newWeekSelected(object sender, EventArgs e)
{
doUpdate();
}
#if false
/// <summary>
/// imposta DDL del periodo
/// </summary>
@@ -81,7 +96,8 @@ namespace PROJ_ETS.WebUserControls
ddlWeek.SelectedValue = (datario.WeekOfYearISO8601(adesso)).ToString();
// ricalcolo periodo!
DataProxy_ProjEts.DP.taIR.importSettimana(anno, settimana);
}
}
#endif
/// <summary>
/// esegue update controllo
/// </summary>
@@ -90,6 +106,7 @@ namespace PROJ_ETS.WebUserControls
caricaDatiBlocco();
disegnaTabella();
}
#if true
/// <summary>
/// anno selezionato
/// </summary>
@@ -97,14 +114,7 @@ namespace PROJ_ETS.WebUserControls
{
get
{
int answ = adesso.Year;
try
{
answ = Convert.ToInt32(ddlAnno.SelectedValue);
}
catch
{ }
return answ;
return mod_navigaWeek1.anno;
}
}
/// <summary>
@@ -114,16 +124,10 @@ namespace PROJ_ETS.WebUserControls
{
get
{
int answ = datario.WeekOfYearISO8601(adesso);
try
{
answ = Convert.ToInt32(ddlWeek.SelectedValue);
}
catch
{ }
return answ;
return mod_navigaWeek1.settimana;
}
}
}
#endif
/// <summary>
/// carica i dati del blocco in un oggetto BlockMap (compreso attive/inattive)
@@ -349,6 +353,7 @@ namespace PROJ_ETS.WebUserControls
return answ;
}
#if false
protected void ddlAnno_SelectedIndexChanged(object sender, EventArgs e)
{
// salvo nuovo anno & nuova week!
@@ -389,6 +394,7 @@ namespace PROJ_ETS.WebUserControls
}
setDdlPeriodo();
doUpdate();
}
}
#endif
}
}
+2 -56
View File
@@ -13,67 +13,13 @@ namespace PROJ_ETS.WebUserControls {
public partial class mod_weekRA {
/// <summary>
/// ddlAnno control.
/// mod_navigaWeek1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlAnno;
/// <summary>
/// odsYear control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsYear;
/// <summary>
/// ddlWeek control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlWeek;
/// <summary>
/// odsWeek control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsWeek;
/// <summary>
/// lnkWPrev control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lnkWPrev;
/// <summary>
/// lnkW control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lnkW;
/// <summary>
/// lnkWNext control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.LinkButton lnkWNext;
protected global::PROJ_ETS.WebUserControls.mod_navigaWeek mod_navigaWeek1;
/// <summary>
/// tblBlocco control.
Binary file not shown.
Binary file not shown.