Beispiel #1
0
 public string GetModelClienteJson()
 {
     Pot.DataLayer.Cliente m = new Pot.DataLayer.Cliente();
     m.CodiceFiscale = "CDCFSC16Z21H" + new Random().Next(100, 999).ToString() + "Z";
     //m.PartitaIva = "123456" + new Random().Next(1000, 9999).ToString() + "1";
     m.CodiceUnivoco = "ABC" + new Random().Next(1000, 9999).ToString() + "E";
     m.Cognome       = "Cognome Casuale" + new Random().Next(0, 9999).ToString();
     m.Nome          = "Nome Casuale" + new Random().Next(0, 9999).ToString();
     //m.RagioneSociale = "Ragione Sociale Casuale" + new Random().Next(0, 9999).ToString();
     m.ComuneNascita = "Roma";
     m.Nazionalita   = "ITALIA";
     m.DataNascita   = DateTime.Now.Date;
     m.Indirizzo     = "Via di casa, 29";
     m.Comune        = "Ariccia";
     m.Cap           = "00100";
     m.Provincia     = "ROMA";
     m.Email         = "*****@*****.**";
     m.Iban          = "IT96R0123454321000000012345".Trim();
     return(new JavaScriptSerializer().Serialize(m));
 }
Beispiel #2
0
        public string SetCliente(string token, string ClienteJson)
        {
            try
            {
                string  userAgent = HttpContext.Current.Request.UserAgent;
                string  ip        = HttpContext.Current.Request.UserHostAddress;
                string  message   = String.Empty;
                Boolean result    = false;

                if (Pot.BusinessLayer.Authentication.IsTokenValid(token, ip, userAgent))
                {
                    Pot.DataLayer.Cliente cliente = (Pot.DataLayer.Cliente) new JavaScriptSerializer().Deserialize(ClienteJson, typeof(Pot.DataLayer.Cliente));

                    result = Pot.BusinessLayer.Interface.ExecuteCliente(cliente, out message);
                }

                else
                {
                    message = "Token Expired!";
                    result  = false;
                }

                var response = new { Message = message, Result = result };

                //HTDebug.Debug dbg = new HTDebug.Debug();
                //dbg.DebugLine(String.Format("Configurato Cliente {0} - {1}", message, result), System.Diagnostics.EventLogEntryType.Information, 0);

                return(new JavaScriptSerializer().Serialize(response));
            }
            catch (Exception e)
            {
                //HTDebug.Debug dbg = new HTDebug.Debug();
                //dbg.DebugLine(String.Format("Errore Configurazione Cliente - {0}", e.Message), System.Diagnostics.EventLogEntryType.Error, 0);

                return(e.Message);
            }
        }