コード例 #1
0
 public TicketOpenRes ApriTicket(ContrattoConto conto)
 {
     try {
         ParametriConto par = new ParametriConto(conto);
         if (!String.IsNullOrEmpty(par.idBuonoChiaro))
         {
             log.InfoFormat("Apri Ticket - Ticket già aperto - idBuonoChiaro: {0} - idConto {1} idUtente: {2}", par.idBuonoChiaro, par.IdConto, conto.CassiereLogin);
             return(new TicketOpenRes()
             {
                 COMRES = enumCOMRES.OK.ToString(), ERRMSG = String.Empty, IDTR = par.idBuonoChiaro
             });
         }
         else
         {
             TicketOpenReq apriTicket = new TicketOpenReq();
             apriTicket.Init(conto);
             string request     = apriTicket.ToXML();
             string logFileName = System.IO.Path.Combine(config.AppSettings.Settings["LogPath"].Value
                                                         , conto.DataGestione.Value.ToString("yyMMdd") + "_" + conto.IdGestionale + "_" + apriTicket.TipoOperazione + "_{0}_{1}.xml");
             System.IO.File.WriteAllText(String.Format(logFileName, "request", DateTime.Now.ToString("hhmmss")), request);
             string response = InviaSocket(request);
             System.IO.File.WriteAllText(String.Format(logFileName, "response", DateTime.Now.ToString("hhmmss")), request);
             TicketOpenRes res = (TicketOpenRes) new System.Xml.Serialization.XmlSerializer(typeof(TicketOpenRes)).Deserialize(new System.IO.MemoryStream(Encoding.UTF8.GetBytes(response)));
             return(res);
         }
     }
     catch (Exception ex)
     {
         log.ErrorFormat("Errore Apri Ticket - Origine: {0} - Riga {1} Errore: {2}", System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString().Substring(ex.ToString().LastIndexOf(" ") + 1), ex.Message);
         return(new TicketOpenRes()
         {
             COMRES = enumCOMRES.KO.ToString(), ERRMSG = ex.Message
         });
     }
 }
コード例 #2
0
        public List <TicketVoidRes> AnnullaTuttiTicket(ContrattoConto conto)
        {
            List <TicketVoidRes> res = new List <TicketVoidRes>();

            try
            {
                ParametriConto par = new ParametriConto(conto);
                foreach (var b in par.Codici)
                {
                    res.Add(AnnullaTicket(conto, b.CodiceABarre));
                }
                return(res);
            }
            catch (Exception ex)
            {
                log.ErrorFormat("Errore Valida Ticket - Origine: {0} - Riga {1} Errore: {2}", System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString().Substring(ex.ToString().LastIndexOf(" ") + 1), ex.Message);
                res.Add(new TicketVoidRes()
                {
                    COMRES = enumCOMRES.KO.ToString(), ERRMSG = ex.Message
                });
                return(res);
            }
        }