public TicketVoidRes AnnullaTicket(ContrattoConto conto, string buono) { try { TicketVoidReq validaTicket = new TicketVoidReq(); validaTicket.Init(conto); validaTicket.CaricaBuono(buono); string request = validaTicket.ToXML(); string logFileName = System.IO.Path.Combine(config.AppSettings.Settings["LogPath"].Value , conto.DataGestione.Value.ToString("yyMMdd") + "_" + conto.IdGestionale + "_" + validaTicket.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")), response); TicketVoidRes res = (TicketVoidRes) new System.Xml.Serialization.XmlSerializer(typeof(TicketVoidRes)).Deserialize(new System.IO.MemoryStream(Encoding.UTF8.GetBytes(response))); 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); return(new TicketVoidRes() { COMRES = enumCOMRES.KO.ToString(), ERRMSG = ex.Message }); } }
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 }); } }
public ParametriConto(ContrattoConto conto) { string exeConfigPath = typeof(ParametriConto).Assembly.Location; ExeConfigurationFileMap configMap = new ExeConfigurationFileMap(); configMap.ExeConfigFilename = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(exeConfigPath), "buonochiaro.config"); config = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None); if (conto.Tool_Parametri == null) { this.idScontrinoElettronico = conto.NumeroScontrinoFiscale; this.IdConto = conto.IdGestionale; this.IdChiamata = conto.Tool_IdTastoCustom; this.Stato = StatoConto.inizio; this.CategoriaPagamento = config.AppSettings.Settings["CategoriaPagamento"].Value; this.CodicePagamento = config.AppSettings.Settings["CodicePagamento"].Value; this._indiceParametri = null; this._codici = new List <BuonoPasto>(); } else if (conto.Tool_Parametri[0] == null) { this.idScontrinoElettronico = conto.NumeroScontrinoFiscale; this.IdConto = conto.IdGestionale; this.IdChiamata = conto.Tool_IdTastoCustom; this.Stato = StatoConto.inizio; this.CategoriaPagamento = config.AppSettings.Settings["CategoriaPagamento"].Value; this.CodicePagamento = config.AppSettings.Settings["CodicePagamento"].Value; this._indiceParametri = 0; this._codici = new List <BuonoPasto>(); } else { for (int i = 0; i < conto.Tool_Parametri.Length; i++) { ParametriConto par = new ParametriConto((conto.Tool_Parametri[i] ?? String.Empty).ToString()); if (par.IdConto != null) { this.idBuonoChiaro = par.idBuonoChiaro; this._codici = par.Codici; this.IdChiamata = par.IdChiamata; this.idScontrinoElettronico = par.idScontrinoElettronico; this.IdConto = par.IdConto; this.Stato = par.Stato; this.Totale = par.Totale; this.UltimaDomanda = par.UltimaDomanda; this.UltimaRisposta = par.UltimaRisposta; this.CategoriaPagamento = par.CategoriaPagamento; this.CodicePagamento = par.CodicePagamento; this._indiceParametri = i; } } } }
public ContrattoConto Reset(ContrattoConto conto) { if (conto.Tool_Parametri.Length <= 1) { conto.Tool_Parametri = new object[1]; } else { var list = conto.Tool_Parametri.ToList(); list.RemoveAt(this._indiceParametri.Value); conto.Tool_Parametri = list.ToArray(); } return(conto); }
public void Init(ContrattoConto conto) { this.IndirizzoIp = config.AppSettings.Settings["IP"].Value; this.Port = config.AppSettings.Settings["PORT"].Value; this.Timeout = config.AppSettings.Settings["TIMEOUT"].Value; this.CodiceIdentificativo = config.AppSettings.Settings["IDAWS"].Value; this.CODCORP = config.AppSettings.Settings["CODCORP"].Value; this.CodiceTransazione = config.AppSettings.Settings["CODTR"].Value; this.CODDEV = (10000 + Convert.ToInt32(config.AppSettings.Settings["CODDEV"].Value.PadLeft(5, '0'))).ToString() + conto.PuntoCassa.PadLeft(5, '0'); this.CODPIC = conto.CassiereLogin; //this.NumeroScontrino = conto.NumeroScontrinoFiscale; this.NumeroScontrino = conto.IdGestionale.Value.ToString(); this.Progressivo = conto.IdGestionale.Value.ToString(); }
public ContrattoConto ToConto(ContrattoConto conto) { if (this._indiceParametri != null) { conto.Tool_Parametri[this._indiceParametri.Value] = this.ToXml(); } else if (conto.Tool_Parametri != null) { var p = conto.Tool_Parametri.ToList(); p.Add(this.ToXml()); conto.Tool_Parametri = p.ToArray(); } else { conto.Tool_Parametri = new object[1] { this.ToXml() }; } return(conto); }
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); } }