131 lines
2.9 KiB
C#
131 lines
2.9 KiB
C#
using CMS_SC_Data;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Web.UI;
|
|
|
|
namespace CMS_SC.WebUserControls
|
|
{
|
|
public partial class mod_selSchedaUrl : System.Web.UI.UserControl
|
|
{
|
|
/// <summary>
|
|
/// valore QueryString x parametro selezionato...
|
|
/// </summary>
|
|
protected string QSName = "CodSchedaVers";
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
doUpdate();
|
|
}
|
|
}
|
|
public void doUpdate()
|
|
{
|
|
// cerco in URL cod scheda, se c'è seleziono...
|
|
if (memLayer.ML.QSS(QSName) != "")
|
|
{
|
|
ddlSelScheda.SelectedValue = memLayer.ML.QSS(QSName);
|
|
}
|
|
else
|
|
{
|
|
try
|
|
{
|
|
if(ddlSelScheda.Items.Count==0)
|
|
{
|
|
ddlSelScheda.DataBind();
|
|
}
|
|
ddlSelScheda.SelectedIndex = 0;
|
|
updateAndRedirect();
|
|
}
|
|
catch
|
|
{ }
|
|
}
|
|
fixUrl();
|
|
}
|
|
private void updateAndRedirect()
|
|
{
|
|
Response.Redirect(string.Format("{0}?{3}={1}&CodFam={2}", devicesAuthProxy.pagCorrente, ddlSelScheda.SelectedValue, memLayer.ML.QSS("CodFam"), QSName));
|
|
}
|
|
|
|
/// <summary>
|
|
/// nome del documento (da DB)
|
|
/// </summary>
|
|
public string docPath
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
try
|
|
{
|
|
answ = DtProxy.man.taASC.getByCodScheda(memLayer.ML.QSS("CodSchedaVers"))[0].Path;
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// path completo documento
|
|
/// </summary>
|
|
protected string docFilePath
|
|
{
|
|
get
|
|
{
|
|
return string.Format(memLayer.ML.confReadString("urlSchede"), docPath);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// sistemazione URL documento...
|
|
/// </summary>
|
|
private void fixUrl()
|
|
{
|
|
hlDoc.Visible = false;
|
|
// se è richiesta visualizzazione doc...
|
|
if (showLinkDoc)
|
|
{
|
|
// se ho un path x il doc della scheda corrente...
|
|
if (docPath != "")
|
|
{
|
|
// cerco il FILE della scheda selezionata
|
|
if (docPresente)
|
|
{
|
|
hlDoc.NavigateUrl = docFilePath;
|
|
hlDoc.ToolTip = docPath;
|
|
hlDoc.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// salvo (con URL) scheda selezionata
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlSelScheda_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
updateAndRedirect();
|
|
}
|
|
/// <summary>
|
|
/// verifica se il documento sia presente
|
|
/// </summary>
|
|
public bool docPresente
|
|
{
|
|
get
|
|
{
|
|
bool answ = false;
|
|
try
|
|
{
|
|
answ = fileMover.obj.fileExist(docFilePath);
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
public bool showLinkDoc { get; set; }
|
|
|
|
protected void ddlSelScheda_DataBound(object sender, EventArgs e)
|
|
{
|
|
doUpdate();
|
|
}
|
|
}
|
|
} |