Files
WebSCR/WebSCR/Upload/Client.aspx.cs
T

127 lines
4.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SteamWare;
using WebSCR_data;
namespace WebSCR.Upload
{
public partial class Client : System.Web.UI.Page
{
/// <summary>
/// recupera valore querystring
/// </summary>
/// <param name="nome"></param>
/// <returns></returns>
protected string qsVal(string nome)
{
return memLayer.ML.QSS(nome);
}
protected void Page_Load(object sender, EventArgs e)
{
if (memLayer.ML.CRI("_logLevel") > 5)
{
logger.lg.scriviLog("INIZIO esecuzione UPLOAD CLI");
}
string answ = "ND";
/*
* http://webscr.steamware.net/Rigamonti/Upload/Client?CodCliente=C0000&RagSoc=Cognome+Nome&CodFis=ABCDEFGH123456&Tel=035+0000000&Cell333+000000&EnableSMS=1&Email=email.address@dominio.it&Indir=via+dai+piedi&Cap=24999&Localita=Dalmine&Prov=BG&Note=note+se+presenti
http://webscr.steamware.net/Rigamonti/Upload/Client?CodCliente=C63094&RagSoc=CARNE+GIANLUCA&CodFis=&Tel=&Cell=3333438166&EnableSMS=1&Email=&Indir=VIA+CIURLINA+3&Cap=24050&Localita=GHISALBA&Prov=BG&Note=
*/
// legge i get x processare dati input
string CodCliente = "";
string RagSoc = "";
string CodFis = "";
string Tel = "";
string Cell = "";
bool EnableSMS = false;
string Email = "";
string Indir = "";
string Cap = "";
string Localita = "";
string Prov = "";
string Note = "";
try
{
CodCliente = qsVal("CodCliente");
RagSoc = qsVal("RagSoc");
CodFis = qsVal("CodFis");
Tel = qsVal("Tel");
Cell = qsVal("Cell");
EnableSMS = memLayer.ML.QSB("EnableSMS");
Email = qsVal("Email");
Indir = qsVal("Indir");
Cap = qsVal("Cap");
Localita = qsVal("Localita");
Prov = qsVal("Prov");
Note = qsVal("Note");
if (memLayer.ML.CRI("_logLevel") > 6)
{
logger.lg.scriviLog(string.Format("Valori letti:{0}CodCliente: {1}{0}RagSoc: {2}{0}CodFis: {3}{0}Tel: {4}{0}Cell: {5}{0}EnableSMS: {6}{0}Email: {7}{0}Indir: {8}{0}Cap: {9}{0}Localita: {10}{0}Prov: {11}{0}Note: {12}", Environment.NewLine, CodCliente, RagSoc, CodFis, Tel, Cell, EnableSMS, Email, Indir, Cap, Localita, Prov, Note), tipoLog.INFO);
}
}
catch
{ }
// provo a fare insert!!!
if (CodCliente != null && RagSoc != null)
{
if (CodCliente != "" && RagSoc != "")
{
try
{
// ora processo UPSERT...
DtProxy.man.taAC.upsert(CodCliente, RagSoc, CodFis, Tel, Cell, EnableSMS, Email, Indir, Cap, Localita, Prov, Note);
answ = "OK"; // registro in risposta che è andato tutto bene...
}
catch (Exception exc)
{
if (memLayer.ML.confReadInt("_logLevel") > 5)
{
string errore = string.Format("Errore: {0}{1}", Environment.NewLine, exc);
logger.lg.scriviLog(errore, tipoLog.EXCEPTION);
answ = errore;
}
}
}
else
{
// restituisco ultimo COD CLIENTE inserito
try
{
answ = DtProxy.man.taAC.getLast()[0].CodCliente;
}
catch
{
answ = "ko";
}
}
}
else
{
// restituisco ultimo COD CLIENTE inserito
try
{
answ = DtProxy.man.taAC.getLast()[0].CodCliente;
}
catch
{
answ = "ko";
}
}
// ripulisco pagina restituita e tolgo html (solo codice ok/NO)
Response.Clear();
Response.Write(answ);
if (memLayer.ML.CRI("_logLevel") > 5)
{
logger.lg.scriviLog(string.Format("FINE esecuzione UPLOAD CLI, CodCliente: {0}", CodCliente));
}
Context.Response.End();
}
}
}