61 lines
2.3 KiB
C#
61 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using ETS_Data;
|
|
|
|
namespace ETS_DIP
|
|
{
|
|
public partial class getDocByProto : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// controllo ci sia richiesta VALIDA, nel formato numero-anno
|
|
string nrProto = "";
|
|
try
|
|
{
|
|
nrProto = Request.QueryString["nrProto"];
|
|
}
|
|
catch
|
|
{ }
|
|
if (nrProto != null && nrProto.Length > 0 && nrProto.IndexOf('-') >= 0)
|
|
{
|
|
// cerco il protocollo
|
|
int numero = 0;
|
|
int anno = 0;
|
|
try
|
|
{
|
|
numero = Convert.ToInt32(nrProto.Substring(0, nrProto.IndexOf('-')));
|
|
anno = Convert.ToInt32(nrProto.Substring(nrProto.IndexOf('-') + 1, 4));
|
|
}
|
|
catch
|
|
{
|
|
// se non trovo faccio redirect a file errore DocTemplates/NotFound.txt
|
|
//Response.Redirect("~/DocTemplates/NotFound.txt");
|
|
lblNumProto.Text = string.Format("Errore! non è stato possibile trovare il doc con nr. proto {0}", nrProto);
|
|
}
|
|
// cerco il path...
|
|
string docPath = DataProxy_ETS_WS.DP.fullPathDoc(numero, anno);
|
|
// se lo trovo faccio redirect a doc corretto
|
|
if (docPath != "")
|
|
{
|
|
//lblNumProto.Text = string.Format("Trovato! {0}-{1} --> {2}", numero, anno, docPath);
|
|
Response.Redirect(docPath);
|
|
}
|
|
else
|
|
{
|
|
// se non trovo faccio redirect a file errore DocTemplates/NotFound.txt
|
|
//Response.Redirect("~/DocTemplates/NotFound.txt");
|
|
lblNumProto.Text = string.Format("Errore! non è stato possibile trovare il doc con nr. proto {0}", nrProto);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// se non trovo faccio redirect a file errore DocTemplates/NotFound.txt
|
|
Response.Redirect("~/DocTemplates/NotFound.txt");
|
|
}
|
|
}
|
|
}
|
|
} |