568 lines
16 KiB
C#
568 lines
16 KiB
C#
using GPW_data;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace GPW_Admin.WebUserControls
|
|
{
|
|
public partial class mod_spostaOre : BaseUserControl
|
|
{
|
|
#region Protected Properties
|
|
|
|
/// <summary>
|
|
/// uid base
|
|
/// </summary>
|
|
protected string sessionUid
|
|
{
|
|
get
|
|
{
|
|
return this.UniqueID.Replace("$", "-");
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// abilitato editing fase
|
|
/// </summary>
|
|
public bool editFase
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
try
|
|
{
|
|
answ = memLayer.ML.BoolSessionObj("enableEditFase");
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal("enableEditFase", value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// idx del cliente selezionato
|
|
/// </summary>
|
|
public int idxCliente
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj(string.Format("idxCli_{0}", sessionUid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("idxCli_{0}", sessionUid), value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// idx del cliente selezionato x destinazione spostamento
|
|
/// </summary>
|
|
public int idxClienteDest
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj(string.Format("idxCliDest_{0}", sessionUid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("idxCliDest_{0}", sessionUid), value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// idx della fase selezionata
|
|
/// </summary>
|
|
public int idxFase
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj(string.Format("idxFase_{0}", sessionUid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("idxFase_{0}", sessionUid), value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// idx della fase selezionata x destinazione spostamento
|
|
/// </summary>
|
|
public int idxFaseDest
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj(string.Format("idxFaseDest_{0}", sessionUid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("idxFaseDest_{0}", sessionUid), value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// idx del progetto selezionato
|
|
/// </summary>
|
|
public int idxProgetto
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj(string.Format("idxProj_{0}", sessionUid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("idxProj_{0}", sessionUid), value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// idx del progetto selezionato x destinazione spostamento
|
|
/// </summary>
|
|
public int idxProgettoDest
|
|
{
|
|
get
|
|
{
|
|
return memLayer.ML.IntSessionObj(string.Format("idxProjDest_{0}", sessionUid));
|
|
}
|
|
set
|
|
{
|
|
memLayer.ML.setSessionVal(string.Format("idxProjDest_{0}", sessionUid), value);
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// imposto ODS
|
|
/// </summary>
|
|
private void checkFixOds()
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// cambio sel cliente --> aggiorno progetti
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void filtroCli_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
saveFilterCli();
|
|
salveFilterPrj();
|
|
//salveFilterFasi();
|
|
}
|
|
|
|
private void filtroCliDest_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
saveFilterCliDest();
|
|
salveFilterPrjDest();
|
|
}
|
|
|
|
/// <summary>
|
|
/// seleziono
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void filtroDip_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
// imposto ods
|
|
checkFixOds();
|
|
}
|
|
|
|
/// <summary>
|
|
/// aggiorno filtraggio!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void filtroFase_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
salveFilterFasi();
|
|
}
|
|
|
|
private void filtroFaseDest_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
fixBtnSposta();
|
|
}
|
|
|
|
/// <summary>
|
|
/// aggiorno visualizzazione fasi!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void filtroPrj_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
salveFilterPrj();
|
|
//salveFilterFasi();
|
|
}
|
|
|
|
private void filtroPrjDest_eh_selValore(object sender, EventArgs e)
|
|
{
|
|
salveFilterPrjDest();
|
|
}
|
|
|
|
/// <summary>
|
|
/// imposto label corretta x btn sposta
|
|
/// </summary>
|
|
private void fixBtnSposta()
|
|
{
|
|
if (pnlFaseDest.Visible)
|
|
{
|
|
btnEnableSposta.Text = traduci("chiudiSposta");
|
|
}
|
|
else
|
|
{
|
|
btnEnableSposta.Text = traduci("mostraSposta");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// salva filtro fasi
|
|
/// </summary>
|
|
private void salveFilterFasi()
|
|
{
|
|
idxFase = filtroFase.valoreInt;
|
|
//grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// salva filtro prj
|
|
/// </summary>
|
|
private void salveFilterPrj()
|
|
{
|
|
idxProgetto = filtroPrj.valoreInt;
|
|
filtroFase.ods = odsFasi;
|
|
filtroFase.reselFirst();
|
|
//grView.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// salva filtro prj
|
|
/// </summary>
|
|
private void salveFilterPrjDest()
|
|
{
|
|
idxProgettoDest = filtroPrjDest.valoreInt;
|
|
try
|
|
{
|
|
ddlFaseDest.SelectedIndex = 1;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
|
|
/// <summary>
|
|
/// salva filtro cliente
|
|
/// </summary>
|
|
private void saveFilterCli()
|
|
{
|
|
// salvo filtro cliente
|
|
idxCliente = filtroCli.valoreInt;
|
|
filtroPrj.ods = odsProj;
|
|
filtroPrj.reselFirst();
|
|
}
|
|
|
|
/// <summary>
|
|
/// salva filtro cliente
|
|
/// </summary>
|
|
private void saveFilterCliDest()
|
|
{
|
|
// salvo filtro cliente
|
|
idxClienteDest = filtroCliDest.valoreInt;
|
|
filtroPrjDest.ods = odsProjDest;
|
|
filtroPrjDest.reselFirst();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// attiva/disattiva pannello spostamento
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnEnableSposta_Click(object sender, EventArgs e)
|
|
{
|
|
pnlFaseDest.Visible = !pnlFaseDest.Visible;
|
|
fixBtnSposta();
|
|
checkFixOds();
|
|
}
|
|
|
|
/// <summary>
|
|
/// seleziona/deseleziona le righe indicate...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSelAll_Click(object sender, EventArgs e)
|
|
{
|
|
if (sender != null)
|
|
{
|
|
// seleziono tutti i valori visibili nel datagrid
|
|
CheckBox chkbox = ((CheckBox)sender);
|
|
bool isChecked = chkbox.Checked;
|
|
if (!isChecked)
|
|
{
|
|
chkbox.ToolTip = "Seleziona tutti";
|
|
}
|
|
else
|
|
{
|
|
chkbox.ToolTip = "Deseleziona tutti";
|
|
}
|
|
foreach (GridViewRow riga in grView.Rows)
|
|
{
|
|
((CheckBox)riga.FindControl("chkSelect")).Checked = isChecked;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettua spostamento registrazioni indicate
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSpostaSel_Click(object sender, EventArgs e)
|
|
{
|
|
// prende valori selezioanti e sposta su fase destinazione impostata
|
|
int idxRA = 0;
|
|
// sposto i files selezionati secondo i dati in sessione
|
|
foreach (GridViewRow riga in grView.Rows)
|
|
{
|
|
if (((CheckBox)riga.FindControl("chkSelect")).Checked)
|
|
{
|
|
// devo salvare file con le info relative...
|
|
idxRA = Convert.ToInt32(((Label)riga.FindControl("lblIdxRa")).Text);
|
|
DataProxy.DP.taRAExpl.updateFase(Convert.ToInt32(ddlFaseDest.SelectedValue), idxRA);
|
|
}
|
|
}
|
|
checkFixOds();
|
|
}
|
|
|
|
protected void chkshowAll_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
filtroDip.ods = odsDip;
|
|
filtroDip.reselFirst();
|
|
}
|
|
|
|
protected void chkshowAllCli_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
// in base a selezione cambio metodo ods
|
|
filtroCli.ods = odsClienti;
|
|
filtroCli.reselFirst();
|
|
}
|
|
|
|
/// <summary>
|
|
/// sistemo eventuali "headers"
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlFase_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (sender != null)
|
|
{
|
|
// cerco eventuali controlli tipo "ancestor" e li disattivo!
|
|
DropDownList ddlFase_int = (DropDownList)sender;
|
|
ListItem li = new ListItem();
|
|
while (li != null)
|
|
{
|
|
li = ddlFase_int.Items.FindByValue("0");
|
|
try
|
|
{
|
|
li.Attributes.Add("style", "color:gray;");
|
|
li.Attributes.Add("disabled", "true");
|
|
li.Value = "-1";
|
|
li.Text = string.Format("[ {0} ]", li.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
try
|
|
{
|
|
ddlFase_int.SelectedIndex = 1;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// sistemo eventuali "headers"
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlFaseDest_DataBound(object sender, EventArgs e)
|
|
{
|
|
if (sender != null)
|
|
{
|
|
// cerco eventuali controlli tipo "ancestor" e li disattivo!
|
|
DropDownList ddlFase_int = (DropDownList)sender;
|
|
ListItem li = new ListItem();
|
|
while (li != null)
|
|
{
|
|
li = ddlFase_int.Items.FindByValue("0");
|
|
try
|
|
{
|
|
li.Attributes.Add("style", "color:gray;");
|
|
li.Attributes.Add("disabled", "true");
|
|
li.Value = "-1";
|
|
li.Text = string.Format("[ {0} ]", li.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
try
|
|
{
|
|
ddlFase_int.SelectedIndex = 1;
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// aggiorno ods fasi...
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlProgetto_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
checkFixOds();
|
|
}
|
|
|
|
protected void grView_PageIndexChanged(object sender, EventArgs e)
|
|
{
|
|
checkFixOds();
|
|
}
|
|
|
|
/// <summary>
|
|
/// generico comando riga
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// riga popolata
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (grView.Rows.Count > 0)
|
|
{
|
|
LinkButton lb;
|
|
// aggiorno gli headers
|
|
foreach (TableCell cella in grView.HeaderRow.Cells)
|
|
{
|
|
try
|
|
{
|
|
lb = (LinkButton)cella.Controls[0];
|
|
lb.Text = traduci(lb.Text);
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
int totRecord = grView.Rows.Count + grView.PageSize * (grView.PageCount - 1);
|
|
lblNumRec.Text = string.Format("{0} records of ~ {1}", grView.Rows.Count, totRecord);
|
|
}
|
|
else
|
|
{
|
|
lblNumRec.Text = "";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// riga eliminata
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowDeleted(object sender, GridViewDeletedEventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// riga in edit
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// effettuato update
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_RowUpdated(object sender, GridViewUpdatedEventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// intercetto update!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void odsRA_Updating(object sender, ObjectDataSourceMethodEventArgs e)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// avvio pagina!
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
grView.PageSize = utils.pageSize;
|
|
if (!Page.IsPostBack)
|
|
{
|
|
filtroDip.ods = odsDip;
|
|
filtroCli.ods = odsClienti;
|
|
filtroPrj.ods = odsProj;
|
|
filtroFase.ods = odsFasi;
|
|
|
|
filtroDip.reselFirst();
|
|
|
|
// filtro x spostamento
|
|
filtroCliDest.ods = odsClienti;
|
|
filtroPrjDest.ods = odsProjDest;
|
|
|
|
// btn sposta!
|
|
pnlFaseDest.Visible = false;
|
|
fixBtnSposta();
|
|
checkFixOds();
|
|
}
|
|
filtroDip.eh_selValore += new EventHandler(filtroDip_eh_selValore);
|
|
filtroCli.eh_selValore += new EventHandler(filtroCli_eh_selValore);
|
|
filtroPrj.eh_selValore += new EventHandler(filtroPrj_eh_selValore);
|
|
filtroFase.eh_selValore += new EventHandler(filtroFase_eh_selValore);
|
|
filtroCliDest.eh_selValore += new EventHandler(filtroCliDest_eh_selValore);
|
|
filtroPrjDest.eh_selValore += new EventHandler(filtroPrjDest_eh_selValore);
|
|
ddlFaseDest.SelectedIndexChanged += new EventHandler(filtroFaseDest_eh_selValore);
|
|
hlExportComm.Visible = chkLicOk;
|
|
btnEnableSposta.Visible = chkLicOk;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
public void doUpdate()
|
|
{
|
|
grView.PageSize = utils.pageSize;
|
|
grView.DataBind();
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |