98 lines
2.4 KiB
C#
98 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace MoonProTablet.WebUserControls
|
|
{
|
|
public partial class cmp_ST_objView : MpTabUserControl
|
|
{
|
|
public string dataType
|
|
{
|
|
get
|
|
{
|
|
return hfType.Value.Trim();
|
|
}
|
|
set
|
|
{
|
|
hfType.Value = value.Trim();
|
|
fixDisplay();
|
|
}
|
|
}
|
|
public string dataLabel
|
|
{
|
|
get
|
|
{
|
|
return hfLabel.Value.Trim();
|
|
}
|
|
set
|
|
{
|
|
hfLabel.Value = value.Trim();
|
|
}
|
|
}
|
|
public string dataValue
|
|
{
|
|
get
|
|
{
|
|
return hfValue.Value.Trim();
|
|
}
|
|
set
|
|
{
|
|
hfValue.Value = value.Trim();
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
private void fixDisplay()
|
|
{
|
|
divImg.Visible = false;
|
|
divTxt.Visible = false;
|
|
switch (dataType)
|
|
{
|
|
case "IMG":
|
|
divImg.Visible = true;
|
|
break;
|
|
|
|
case "TXT":
|
|
divTxt.Visible = true;
|
|
break;
|
|
default:
|
|
divTxt.Visible = true;
|
|
break;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Url immagine SE richiesta
|
|
/// </summary>
|
|
public string imageUrl
|
|
{
|
|
get
|
|
{
|
|
string imgPath = "";
|
|
//check type...
|
|
if (dataType == "IMG")
|
|
{
|
|
imgPath = dataValue;
|
|
if (!Path.IsPathRooted(imgPath))
|
|
{
|
|
// aggiungo base path
|
|
imgPath = $"~\\images\\ST_img\\{imgPath}";
|
|
}
|
|
// verifico esistenza file...
|
|
if (!File.Exists(imgPath))
|
|
{
|
|
// metto segnaposto empty
|
|
imgPath = "~\\images\\ST_img\\Steamware.png";
|
|
}
|
|
}
|
|
return imgPath;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |