100 lines
2.6 KiB
C#
100 lines
2.6 KiB
C#
using GPW_data;
|
|
using GPW_data.DS_UtilityTableAdapters;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
|
|
namespace GPW_Admin.WebUserControls
|
|
{
|
|
public partial class cmp_dip2gruppi : BaseUserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
public string gruppoSel
|
|
{
|
|
get => hfGruppo.Value;
|
|
set
|
|
{
|
|
hfGruppo.Value = value;
|
|
grView.DataBind();
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public string cssByDip(object idxDip)
|
|
{
|
|
int IdxDip = 0;
|
|
int.TryParse($"{idxDip}", out IdxDip);
|
|
bool attivo = false;
|
|
if (listActive == null || listActive.Count == 0)
|
|
{
|
|
reloadDip();
|
|
}
|
|
if (IdxDip > 0)
|
|
{
|
|
attivo = listActive.Where(x => x.value == IdxDip).Count() > 0;
|
|
}
|
|
// colore da stato attivo
|
|
string answ = attivo ? "text-dark" : "text-secondary text-strike";
|
|
return answ;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Fields
|
|
|
|
protected List<DS_Utility.v_selDipendentiRow> listActive = new List<DS_Utility.v_selDipendentiRow>();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected int idxDipSel
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(ddlDip.SelectedValue, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// aggiunge dipendente al gruppo selezionato
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtAdd_Click(object sender, EventArgs e)
|
|
{
|
|
// eseguo inserimento valore in schema
|
|
DataProxy.DP.taDip2Gruppi.insertQuery(gruppoSel, idxDipSel);
|
|
ddlDip.DataBind();
|
|
grView.DataBind();
|
|
raiseAddNew();
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
reloadDip();
|
|
}
|
|
}
|
|
|
|
protected void reloadDip()
|
|
{
|
|
var rawTab = DataProxy.DP.taVSD.getByConditio(true).OfType<DS_Utility.v_selDipendentiRow>().ToList();
|
|
listActive = rawTab.Where(x => x.conditio == 1).ToList();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |