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
{
///
/// valore QueryString x parametro selezionato...
///
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));
}
///
/// nome del documento (da DB)
///
public string docPath
{
get
{
string answ = "";
try
{
answ = DtProxy.man.taASC.getByCodScheda(memLayer.ML.QSS("CodSchedaVers"))[0].Path;
}
catch
{ }
return answ;
}
}
///
/// path completo documento
///
protected string docFilePath
{
get
{
return string.Format(memLayer.ML.confReadString("urlSchede"), docPath);
}
}
///
/// sistemazione URL documento...
///
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;
}
}
}
}
///
/// salvo (con URL) scheda selezionata
///
///
///
protected void ddlSelScheda_SelectedIndexChanged(object sender, EventArgs e)
{
updateAndRedirect();
}
///
/// verifica se il documento sia presente
///
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();
}
}
}