90 lines
2.4 KiB
C#
90 lines
2.4 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace Data
|
|
{
|
|
/// <summary>
|
|
/// Base class for action-enabled user controls
|
|
/// It is not meant to be be used directly.
|
|
/// </summary>
|
|
public class ActionUserControl : System.Web.UI.UserControl
|
|
{
|
|
protected int _idxRichiesta = 0;
|
|
/// <summary>
|
|
/// Richiesta di cui mostrare la history
|
|
/// </summary>
|
|
public int idxRichiesta
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(Request.QueryString["idxRichiesta"], out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Pagina corrente x redirect
|
|
/// </summary>
|
|
string currPage
|
|
{
|
|
get
|
|
{
|
|
return HttpContext.Current.Request.Url.PathAndQuery;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Record della richiesta corrente
|
|
/// </summary>
|
|
protected DS_app.ElencolRichRow ER_curr
|
|
{
|
|
get
|
|
{
|
|
DS_app.ElencolRichRow answ = null;
|
|
try
|
|
{
|
|
answ = DtProxy.man.taElRich.getByKey(idxRichiesta)[0];
|
|
}
|
|
catch
|
|
{ }
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Esegue l'azione richiesta e salva/invia email secondo parametri
|
|
/// </summary>
|
|
/// <param name="oggetto"></param>
|
|
/// <param name="bodyTpl"></param>
|
|
/// <param name="codAzione"></param>
|
|
/// <param name="doRedirect"></param>
|
|
public void eseguiAzione(string oggetto, string bodyTpl, string codAzione, bool doRedirect)
|
|
{
|
|
// recupero dati della richiesta corrente
|
|
var riga = ER_curr;
|
|
// invio email SOLLECITO al fornitore...
|
|
string destinatario = "";
|
|
try
|
|
{
|
|
destinatario = DtProxy.man.taAF.getByKey(riga.idxFornitore)[0].indirizzo_email;
|
|
}
|
|
catch
|
|
{
|
|
destinatario = memLayer.ML.CRS("_adminEmail");
|
|
}
|
|
string corpo = string.Format(bodyTpl, riga.nom_cond, riga.genContatto, riga.telContatto, riga.messaggio);
|
|
// salvo azione
|
|
DtProxy.man.taER_Acts.InsertQuery(idxRichiesta, DateTime.Now, codAzione, devicesAuthProxy.stObj.utente, corpo);
|
|
// invio!
|
|
utils.inviaEmail(destinatario, oggetto, corpo, 3); //!!!HARD CODED a 3 tutto
|
|
// se richiesto redireziona...
|
|
if (doRedirect) Response.Redirect(currPage);
|
|
}
|
|
}
|
|
}
|
|
|