Inizio pagina approvazione richieste dipendenti
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_gestRichDip.ascx.cs" Inherits="GPW_Admin.WebUserControls.cmp_gestRichDip" %>
|
||||
|
||||
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_periodoAnalisi.ascx" TagPrefix="uc1" TagName="cmp_periodoAnalisi" %>
|
||||
|
||||
<div class="row small table-secondary">
|
||||
<div class="col-5">
|
||||
<uc1:cmp_periodoAnalisi runat="server" ID="cmp_periodoAnalisi" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
Anno:
|
||||
<asp:TextBox runat="server" ID="txtAnno"></asp:TextBox>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<asp:LinkButton runat="server" ID="lbtSetupYear" CssClass="btn btn-sm btn-primary btn-block" OnClick="lbtSetupYear_Click"><i class="fa fa-calendar-check-o" aria-hidden="true"></i> ADD FESTIVITA' (Anno)</asp:LinkButton>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<asp:LinkButton runat="server" ID="lbtShowFerie" CssClass="btn btn-sm btn-info btn-block" OnClick="lbtShowFerie_Click">
|
||||
<i class="fa fa-calendar-check-o" aria-hidden="true"></i>
|
||||
<asp:Label runat="server" ID="lblTestoFerie" />
|
||||
</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row small table-warning" runat="server" id="divInsFerie" visible="false">
|
||||
<div class="col">
|
||||
Inizio:
|
||||
<asp:TextBox runat="server" ID="txtInizio" TextMode="Date"></asp:TextBox>
|
||||
</div>
|
||||
<div class="col">
|
||||
Fine:
|
||||
<asp:TextBox runat="server" ID="txtFine" TextMode="Date"></asp:TextBox>
|
||||
</div>
|
||||
<div class="col">
|
||||
<asp:DropDownList runat="server" ID="ddlCodGiustInsNew">
|
||||
<asp:ListItem Value="FER" Text="FERIE"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="col">
|
||||
Descrizione:
|
||||
<asp:TextBox runat="server" ID="txtDescrizione"></asp:TextBox>
|
||||
</div>
|
||||
<div class="col">
|
||||
<asp:LinkButton runat="server" ID="lbtSave" CssClass="btn btn-sm btn-block btn-success" OnClick="lbtSave_Click"><i class="fa fa-check" aria-hidden="true"></i> Aggiungi Ferie</asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row small">
|
||||
<div class="col-6">
|
||||
<asp:GridView ID="grView" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="IdxRegRich" DataSourceID="ods" CssClass="table table-sm table-striped table-condensed" AllowSorting="True">
|
||||
<SelectedRowStyle CssClass="table-info" />
|
||||
<Columns>
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="lbtUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Aggiorna" CssClass="btn btn-sm btn-success"><i class="fa fa-check" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton ID="lbtCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Annulla" CssClass="btn btn-sm btn-warning"><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbtSel" runat="server" CausesValidation="False" CommandName="Select" Text="Seleziona" CssClass="btn btn-sm btn-info"><i class="fa fa-search" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton ID="lbtEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Modifica" CssClass="btn btn-sm btn-primary" Visible='<%# chkLicOk %>'><i class="fa fa-pencil" aria-hidden="true"></i></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Dipendente" SortExpression="IdxDipendente">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblIdxDipendente" runat="server" Text='<%# datiDip(Eval("IdxDipendente")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Periodo" SortExpression="DtStart">
|
||||
<ItemTemplate>
|
||||
<div class="small">
|
||||
<div>
|
||||
<asp:Label ID="lblDtStart" runat="server" Text='<%# Eval("DtStart","{0:yyyy-MM-dd HH:mm}") %>'></asp:Label>
|
||||
</div>
|
||||
<div>
|
||||
<asp:Label ID="lblDtEnd" runat="server" Text='<%# Eval("DtEnd","{0:yyyy-MM-dd HH:mm}") %>'></asp:Label>
|
||||
</div>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<%--<asp:BoundField DataField="DtStart" HeaderText="Inizio" ReadOnly="True" SortExpression="DtStart" DataFormatString="{0:yyyy-MM-dd HH:mm}" />
|
||||
<asp:BoundField DataField="DtEnd" HeaderText="Fine" ReadOnly="True" SortExpression="DtEnd" DataFormatString="{0:yyyy-MM-dd HH:mm}" />--%>
|
||||
<asp:TemplateField HeaderText="Giust" SortExpression="CodGiust">
|
||||
<EditItemTemplate>
|
||||
<asp:DropDownList runat="server" ID="ddlCodGiust" SelectedValue='<%# Bind("CodGiust") %>'>
|
||||
<asp:ListItem Value="104" Text="104"></asp:ListItem>
|
||||
<asp:ListItem Value="FER" Text="FERIE"></asp:ListItem>
|
||||
<asp:ListItem Value="PERM" Text="PERMESSO"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Eval("CodGiust") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="Note" HeaderText="Note" SortExpression="Note" />
|
||||
<asp:CheckBoxField DataField="Conf" HeaderText="Conf" SortExpression="Conf" />
|
||||
<asp:TemplateField ShowHeader="False">
|
||||
<EditItemTemplate>
|
||||
<asp:LinkButton ID="lbtUpdate2" runat="server" CausesValidation="True" CommandName="Update" Text="Aggiorna" CssClass="btn btn-sm btn-success"><i class="fa fa-check" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:LinkButton ID="lbtCancel2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Annulla" CssClass="btn btn-sm btn-warning"><i class="fa fa-ban" aria-hidden="true"></i></asp:LinkButton>
|
||||
</EditItemTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="lbtDel" runat="server" CausesValidation="False" CommandName="Delete" Text="Elimina" CssClass="btn btn-sm btn-danger" Visible='<%# chkLicOk %>'><i class="fa fa-trash" aria-hidden="true"></i></asp:LinkButton>
|
||||
<asp:ConfirmButtonExtender ID="cbeDelete" runat="server" ConfirmText='<%# traduci("confermaDel")%>' TargetControlID="lbtDel"></asp:ConfirmButtonExtender>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="getPeriod" TypeName="GPW_data.DS_ApplicazioneTableAdapters.RegistroRichiesteTableAdapter" DeleteMethod="deleteQuery" UpdateMethod="updateQuery" OnDeleted="ods_Deleted" OnUpdated="ods_Updated">
|
||||
<DeleteParameters>
|
||||
<asp:Parameter Name="Original_IdxRegRich" Type="Int32" />
|
||||
</DeleteParameters>
|
||||
<SelectParameters>
|
||||
<asp:Parameter Name="idxDipendente" Type="Int32" DefaultValue="0" />
|
||||
<asp:SessionParameter Name="dataInizio" SessionField="_inizio" Type="DateTime" />
|
||||
<asp:SessionParameter Name="dataFine" SessionField="_fine" Type="DateTime" />
|
||||
</SelectParameters>
|
||||
<UpdateParameters>
|
||||
<asp:Parameter Name="Original_IdxRegRich" Type="Int32" />
|
||||
<asp:Parameter Name="Conf" Type="Boolean" />
|
||||
<asp:Parameter Name="CodGiust" Type="String" />
|
||||
<asp:Parameter Name="Note" Type="String" />
|
||||
</UpdateParameters>
|
||||
</asp:ObjectDataSource>
|
||||
</div>
|
||||
<div class="col-6 text-center">
|
||||
<div class="row my-2">
|
||||
<div class="col-4 bg-danger text-warning">
|
||||
FESTIVITA'
|
||||
</div>
|
||||
<div class="col-4 bg-warning">
|
||||
FERIE
|
||||
</div>
|
||||
<div class="col-4 bg-secondary text-light">
|
||||
WEEK-END
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<asp:Repeater runat="server" ID="repCal" DataSourceID="odsMesi" OnPreRender="repCal_PreRender">
|
||||
<ItemTemplate>
|
||||
<div class="col-4 mb-2">
|
||||
<asp:Calendar runat="server" ID="calDisplay" VisibleDate='<%# Container.DataItem %>' OnDayRender="calDisplay_DayRender" ShowNextPrevMonth="false" SelectionMode="None" OtherMonthDayStyle-CssClass="text-light"></asp:Calendar>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:Repeater>
|
||||
</div>
|
||||
<asp:ObjectDataSource runat="server" ID="odsMesi" TypeName="GPW_Admin.WebUserControls.mod_gestCalendario" SelectMethod="elencoMesi"></asp:ObjectDataSource>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,263 @@
|
||||
using GPW_data;
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
public partial class cmp_gestRichDip : BaseUserControl
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string testoFerie
|
||||
{
|
||||
get => divInsFerie.Visible ? "NASCONDI ADD Ferie" : "MOSTRA ADD Ferie";
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void doUpdate()
|
||||
{
|
||||
// aggiorno!
|
||||
grView.PageSize = utils.pageSize;
|
||||
grView.DataBind();
|
||||
repCal.DataBind();
|
||||
}
|
||||
|
||||
public List<DateTime> elencoMesi()
|
||||
{
|
||||
List<DateTime> listaMesi = new List<DateTime>();
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
listaMesi.Add(new DateTime(anno, 1 + i, 1));
|
||||
}
|
||||
return listaMesi;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Anno corrente
|
||||
/// </summary>
|
||||
protected int anno
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (txtAnno != null && !string.IsNullOrEmpty(txtAnno.Text))
|
||||
{
|
||||
_ = int.TryParse(txtAnno.Text, out answ);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = DateTime.Today.Year;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtAnno.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
protected List<DS_Applicazione.CalendFesteFerieRow> listCFF { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void calDisplay_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
|
||||
{
|
||||
bool isFest = false;
|
||||
// coloro se fa parte delle festività/ferie...
|
||||
if (listCFF != null && listCFF.Count > 0)
|
||||
{
|
||||
// cerco riga...
|
||||
var thisDate = listCFF.Where(x => x.data == e.Day.Date).FirstOrDefault();
|
||||
if (thisDate != null && e.Cell.CssClass != "text-light")
|
||||
{
|
||||
isFest = true;
|
||||
e.Cell.CssClass = thisDate.codGiust == "FEST" ? "bg-danger text-warning" : "bg-warning";
|
||||
}
|
||||
}
|
||||
// se sab/dom --> grigio
|
||||
if (!isFest && e.Cell.CssClass != "text-light")
|
||||
{
|
||||
if (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday)
|
||||
{
|
||||
e.Cell.CssClass = "bg-secondary text-light";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void doUpdateCal()
|
||||
{
|
||||
listCFF = CffListByAnno(anno);
|
||||
}
|
||||
|
||||
protected void lbtSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
int numGG = (int)fineFerie.Subtract(inizioFerie).TotalDays;
|
||||
DateTime currDate = inizioFerie;
|
||||
int currYear = DateTime.Today.Year;
|
||||
// aggiungo ferie x periodo selezionato...
|
||||
for (int i = 0; i <= numGG; i++)
|
||||
{
|
||||
var currDay = inizioFerie.AddDays(i).DayOfWeek;
|
||||
// controllo che NON SIA sabato/domenica...
|
||||
if (currDay != DayOfWeek.Saturday && currDay != DayOfWeek.Sunday)
|
||||
{
|
||||
DataProxy.DP.taCFF.upsertQuery(inizioFerie.AddDays(i), ddlCodGiustInsNew.SelectedValue, txtDescrizione.Text);
|
||||
}
|
||||
}
|
||||
// rieseguo insert festività x anno del periodo...
|
||||
setupFestAnno(inizioFerie.Year);
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtSetupYear_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
setupFestAnno(anno);
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtShowFerie_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
divInsFerie.Visible = !divInsFerie.Visible;
|
||||
}
|
||||
lblTestoFerie.Text = testoFerie;
|
||||
}
|
||||
|
||||
protected void ods_Deleted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
protected void ods_Updated(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
anno = DateTime.Now.Year;
|
||||
intervalloDate currAnno = new intervalloDate
|
||||
{
|
||||
inizio = DateTime.Today.AddYears(-2),
|
||||
fine = DateTime.Today.AddYears(1)
|
||||
};
|
||||
cmp_periodoAnalisi.intervalloAnalisi = currAnno;
|
||||
lbtSetupYear.DataBind();
|
||||
DateTime oggi = DateTime.Today;
|
||||
inizioFerie = oggi.AddDays(1);
|
||||
fineFerie = oggi.AddDays(2);
|
||||
doUpdateCal();
|
||||
}
|
||||
listaDip = licenzeGPW.getDipAttivi();
|
||||
lbtSetupYear.Visible = chkLicOk;
|
||||
lbtShowFerie.Visible = chkLicOk;
|
||||
lblTestoFerie.Text = testoFerie;
|
||||
}
|
||||
|
||||
protected DS_Applicazione.DipendentiDataTable listaDip { get; set; }
|
||||
|
||||
protected void repCal_PreRender(object sender, EventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DateTime fineFerie
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today;
|
||||
_ = DateTime.TryParse(txtFine.Text, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtFine.Text = value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime inizioFerie
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime answ = DateTime.Today;
|
||||
_ = DateTime.TryParse(txtInizio.Text, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtInizio.Text = value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Festività / Ferie x anno
|
||||
/// </summary>
|
||||
/// <param name="reqYear"></param>
|
||||
private List<DS_Applicazione.CalendFesteFerieRow> CffListByAnno(int reqYear)
|
||||
{
|
||||
DateTime inizio = new DateTime(reqYear, 1, 1);
|
||||
DateTime fine = inizio.AddYears(1);
|
||||
List<DS_Applicazione.CalendFesteFerieRow> result = DataProxy.DP.taCFF.getPeriod(inizio, fine).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
private void setupFestAnno(int reqYear)
|
||||
{
|
||||
// recupero elenco festività
|
||||
List<EventDetail> elencoFest = SteamWare.calendarMan.elencoFestAnno(reqYear);
|
||||
// inserisco 1:1
|
||||
if (elencoFest.Count > 0)
|
||||
{
|
||||
foreach (var item in elencoFest)
|
||||
{
|
||||
DataProxy.DP.taCFF.upsertQuery(item.when, "FEST", item.what);
|
||||
}
|
||||
}
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
protected string datiDip(object idxDip)
|
||||
{
|
||||
int idxDipendente = 0;
|
||||
int.TryParse($"{idxDip}", out idxDipendente);
|
||||
string answ = "NA";
|
||||
var rigaDip = listaDip.FirstOrDefault(x => x.idxDipendente == idxDipendente);
|
||||
if (rigaDip != null)
|
||||
{
|
||||
answ = $"{rigaDip.Cognome} {rigaDip.Nome}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 GPW_Admin.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_gestRichDip
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// cmp_periodoAnalisi control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::GPW_Admin.WebUserControls.cmp_periodoAnalisi cmp_periodoAnalisi;
|
||||
|
||||
/// <summary>
|
||||
/// txtAnno 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.TextBox txtAnno;
|
||||
|
||||
/// <summary>
|
||||
/// lbtSetupYear 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 lbtSetupYear;
|
||||
|
||||
/// <summary>
|
||||
/// lbtShowFerie 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 lbtShowFerie;
|
||||
|
||||
/// <summary>
|
||||
/// lblTestoFerie 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.Label lblTestoFerie;
|
||||
|
||||
/// <summary>
|
||||
/// divInsFerie control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divInsFerie;
|
||||
|
||||
/// <summary>
|
||||
/// txtInizio 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.TextBox txtInizio;
|
||||
|
||||
/// <summary>
|
||||
/// txtFine 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.TextBox txtFine;
|
||||
|
||||
/// <summary>
|
||||
/// ddlCodGiustInsNew 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 ddlCodGiustInsNew;
|
||||
|
||||
/// <summary>
|
||||
/// txtDescrizione 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.TextBox txtDescrizione;
|
||||
|
||||
/// <summary>
|
||||
/// lbtSave 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 lbtSave;
|
||||
|
||||
/// <summary>
|
||||
/// grView 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.GridView grView;
|
||||
|
||||
/// <summary>
|
||||
/// ods 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 ods;
|
||||
|
||||
/// <summary>
|
||||
/// repCal 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.Repeater repCal;
|
||||
|
||||
/// <summary>
|
||||
/// odsMesi 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 odsMesi;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row small">
|
||||
<div class="col-7">
|
||||
<div class="col-6">
|
||||
<asp:GridView ID="grView" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="data" DataSourceID="ods" CssClass="table table-sm table-striped table-condensed" AllowSorting="True">
|
||||
<SelectedRowStyle CssClass="table-info" />
|
||||
<Columns>
|
||||
@@ -102,7 +102,7 @@
|
||||
</UpdateParameters>
|
||||
</asp:ObjectDataSource>
|
||||
</div>
|
||||
<div class="col-5 text-center">
|
||||
<div class="col-6 text-center">
|
||||
<div class="row my-2">
|
||||
<div class="col-4 bg-danger text-warning">
|
||||
FESTIVITA'
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Web.UI;
|
||||
|
||||
@@ -10,6 +9,177 @@ namespace GPW_Admin.WebUserControls
|
||||
{
|
||||
public partial class mod_gestCalendario : BaseUserControl
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string testoFerie
|
||||
{
|
||||
get => divInsFerie.Visible ? "NASCONDI ADD Ferie" : "MOSTRA ADD Ferie";
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void doUpdate()
|
||||
{
|
||||
// aggiorno!
|
||||
grView.PageSize = utils.pageSize;
|
||||
grView.DataBind();
|
||||
repCal.DataBind();
|
||||
}
|
||||
|
||||
public List<DateTime> elencoMesi()
|
||||
{
|
||||
List<DateTime> listaMesi = new List<DateTime>();
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
listaMesi.Add(new DateTime(anno, 1 + i, 1));
|
||||
}
|
||||
return listaMesi;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Anno corrente
|
||||
/// </summary>
|
||||
protected int anno
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (txtAnno != null && !string.IsNullOrEmpty(txtAnno.Text))
|
||||
{
|
||||
_ = int.TryParse(txtAnno.Text, out answ);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = DateTime.Today.Year;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtAnno.Text = value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
protected List<DS_Applicazione.CalendFesteFerieRow> listCFF { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void calDisplay_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
|
||||
{
|
||||
bool isFest = false;
|
||||
// coloro se fa parte delle festività/ferie...
|
||||
if (listCFF != null && listCFF.Count > 0)
|
||||
{
|
||||
// cerco riga...
|
||||
var thisDate = listCFF.Where(x => x.data == e.Day.Date).FirstOrDefault();
|
||||
if (thisDate != null && e.Cell.CssClass != "text-light")
|
||||
{
|
||||
isFest = true;
|
||||
e.Cell.CssClass = thisDate.codGiust == "FEST" ? "bg-danger text-warning" : "bg-warning";
|
||||
}
|
||||
}
|
||||
// se sab/dom --> grigio
|
||||
if (!isFest && e.Cell.CssClass != "text-light")
|
||||
{
|
||||
if (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday)
|
||||
{
|
||||
e.Cell.CssClass = "bg-secondary text-light";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void doUpdateCal()
|
||||
{
|
||||
listCFF = CffListByAnno(anno);
|
||||
}
|
||||
|
||||
protected void lbtSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
int numGG = (int)fineFerie.Subtract(inizioFerie).TotalDays;
|
||||
DateTime currDate = inizioFerie;
|
||||
int currYear = DateTime.Today.Year;
|
||||
// aggiungo ferie x periodo selezionato...
|
||||
for (int i = 0; i <= numGG; i++)
|
||||
{
|
||||
var currDay = inizioFerie.AddDays(i).DayOfWeek;
|
||||
// controllo che NON SIA sabato/domenica...
|
||||
if (currDay != DayOfWeek.Saturday && currDay != DayOfWeek.Sunday)
|
||||
{
|
||||
DataProxy.DP.taCFF.upsertQuery(inizioFerie.AddDays(i), ddlCodGiustInsNew.SelectedValue, txtDescrizione.Text);
|
||||
}
|
||||
}
|
||||
// rieseguo insert festività x anno del periodo...
|
||||
setupFestAnno(inizioFerie.Year);
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtSetupYear_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
setupFestAnno(anno);
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtShowFerie_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
divInsFerie.Visible = !divInsFerie.Visible;
|
||||
}
|
||||
lblTestoFerie.Text = testoFerie;
|
||||
}
|
||||
|
||||
protected void ods_Deleted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
protected void ods_Updated(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
anno = DateTime.Now.Year;
|
||||
intervalloDate currAnno = new intervalloDate
|
||||
{
|
||||
inizio = DateTime.Today.AddYears(-2),
|
||||
fine = DateTime.Today.AddYears(1)
|
||||
};
|
||||
cmp_periodoAnalisi.intervalloAnalisi = currAnno;
|
||||
lbtSetupYear.DataBind();
|
||||
DateTime oggi = DateTime.Today;
|
||||
inizioFerie = oggi.AddDays(1);
|
||||
fineFerie = oggi.AddDays(2);
|
||||
doUpdateCal();
|
||||
}
|
||||
lbtSetupYear.Visible = chkLicOk;
|
||||
lbtShowFerie.Visible = chkLicOk;
|
||||
lblTestoFerie.Text = testoFerie;
|
||||
}
|
||||
|
||||
protected void repCal_PreRender(object sender, EventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DateTime fineFerie
|
||||
@@ -42,36 +212,20 @@ namespace GPW_Admin.WebUserControls
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Anno corrente
|
||||
/// Elenco Festività / Ferie x anno
|
||||
/// </summary>
|
||||
protected int anno
|
||||
/// <param name="reqYear"></param>
|
||||
private List<DS_Applicazione.CalendFesteFerieRow> CffListByAnno(int reqYear)
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (txtAnno != null && !string.IsNullOrEmpty(txtAnno.Text))
|
||||
{
|
||||
_ = int.TryParse(txtAnno.Text, out answ);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = DateTime.Today.Year;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtAnno.Text = value.ToString();
|
||||
}
|
||||
DateTime inizio = new DateTime(reqYear, 1, 1);
|
||||
DateTime fine = inizio.AddYears(1);
|
||||
List<DS_Applicazione.CalendFesteFerieRow> result = DataProxy.DP.taCFF.getPeriod(inizio, fine).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void setupFestAnno(int reqYear)
|
||||
{
|
||||
// recupero elenco festività
|
||||
@@ -86,157 +240,7 @@ namespace GPW_Admin.WebUserControls
|
||||
}
|
||||
doUpdate();
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco Festività / Ferie x anno
|
||||
/// </summary>
|
||||
/// <param name="reqYear"></param>
|
||||
private List<DS_Applicazione.CalendFesteFerieRow> CffListByAnno(int reqYear)
|
||||
{
|
||||
DateTime inizio = new DateTime(reqYear, 1, 1);
|
||||
DateTime fine = inizio.AddYears(1);
|
||||
List<DS_Applicazione.CalendFesteFerieRow> result = DataProxy.DP.taCFF.getPeriod(inizio, fine).ToList();
|
||||
return result;
|
||||
}
|
||||
|
||||
public string testoFerie
|
||||
{
|
||||
get => divInsFerie.Visible ? "NASCONDI ADD Ferie" : "MOSTRA ADD Ferie";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void lbtSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
int numGG = (int)fineFerie.Subtract(inizioFerie).TotalDays;
|
||||
DateTime currDate = inizioFerie;
|
||||
int currYear = DateTime.Today.Year;
|
||||
// aggiungo ferie x periodo selezionato...
|
||||
for (int i = 0; i <= numGG; i++)
|
||||
{
|
||||
var currDay = inizioFerie.AddDays(i).DayOfWeek;
|
||||
// controllo che NON SIA sabato/domenica...
|
||||
if (currDay != DayOfWeek.Saturday && currDay != DayOfWeek.Sunday)
|
||||
{
|
||||
DataProxy.DP.taCFF.upsertQuery(inizioFerie.AddDays(i), ddlCodGiustInsNew.SelectedValue, txtDescrizione.Text);
|
||||
}
|
||||
}
|
||||
// rieseguo insert festività x anno del periodo...
|
||||
setupFestAnno(inizioFerie.Year);
|
||||
}
|
||||
}
|
||||
|
||||
public List<DateTime> elencoMesi()
|
||||
{
|
||||
List<DateTime> listaMesi = new List<DateTime>();
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
listaMesi.Add(new DateTime(anno, 1 + i, 1));
|
||||
}
|
||||
return listaMesi;
|
||||
}
|
||||
|
||||
protected void lbtSetupYear_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
setupFestAnno(anno);
|
||||
}
|
||||
}
|
||||
|
||||
protected void lbtShowFerie_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (chkLicOk)
|
||||
{
|
||||
divInsFerie.Visible = !divInsFerie.Visible;
|
||||
}
|
||||
lblTestoFerie.Text = testoFerie;
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
grView.PageSize = utils.pageSize;
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
anno = DateTime.Now.Year;
|
||||
intervalloDate currAnno = new intervalloDate
|
||||
{
|
||||
inizio = DateTime.Today.AddYears(-2),
|
||||
fine = DateTime.Today.AddYears(1)
|
||||
};
|
||||
cmp_periodoAnalisi.intervalloAnalisi = currAnno;
|
||||
lbtSetupYear.DataBind();
|
||||
DateTime oggi = DateTime.Today;
|
||||
inizioFerie = oggi.AddDays(1);
|
||||
fineFerie = oggi.AddDays(2);
|
||||
doUpdateCal();
|
||||
}
|
||||
lbtSetupYear.Visible = chkLicOk;
|
||||
lbtShowFerie.Visible = chkLicOk;
|
||||
lblTestoFerie.Text = testoFerie;
|
||||
}
|
||||
|
||||
protected List<DS_Applicazione.CalendFesteFerieRow> listCFF { get; set; }
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void doUpdate()
|
||||
{
|
||||
// aggiorno!
|
||||
grView.PageSize = utils.pageSize;
|
||||
grView.DataBind();
|
||||
repCal.DataBind();
|
||||
}
|
||||
|
||||
protected void doUpdateCal()
|
||||
{
|
||||
listCFF = CffListByAnno(anno);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
protected void calDisplay_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
|
||||
{
|
||||
bool isFest = false;
|
||||
// coloro se fa parte delle festività/ferie...
|
||||
if (listCFF != null && listCFF.Count > 0)
|
||||
{
|
||||
// cerco riga...
|
||||
var thisDate = listCFF.Where(x => x.data == e.Day.Date).FirstOrDefault();
|
||||
if (thisDate != null && e.Cell.CssClass != "text-light")
|
||||
{
|
||||
isFest = true;
|
||||
e.Cell.CssClass = thisDate.codGiust == "FEST" ? "bg-danger text-warning" : "bg-warning";
|
||||
}
|
||||
}
|
||||
// se sab/dom --> grigio
|
||||
if (!isFest && e.Cell.CssClass != "text-light")
|
||||
{
|
||||
if (e.Day.Date.DayOfWeek == DayOfWeek.Saturday || e.Day.Date.DayOfWeek == DayOfWeek.Sunday)
|
||||
{
|
||||
e.Cell.CssClass = "bg-secondary text-light";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void ods_Deleted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
protected void ods_Updated(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
|
||||
protected void repCal_PreRender(object sender, EventArgs e)
|
||||
{
|
||||
doUpdateCal();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user