internal void IgnoreCharacter(string token, uint id) { try { var user = this.loginService.AuthorizeUser(token); try { this.db.Read((c) => c.BlacklistFind(user.Id, id)); throw new AlreadySubmittedException(); } catch (Database.NotFoundException) { } var character = this.characterService.Find(id); var ignoredCharacter = new BlacklistRecord { UserId = user.Id, ViolatorId = character.Id }; this.db.Write((c) => c.BlacklistInsert(ignoredCharacter)); } catch (CharacterService.NotFoundException) { throw new NotFoundException(); } }
public List <KeyValuePair <string, XElement> > Gerar_BlacklistRecord(BlacklistRecord black) { try { List <KeyValuePair <string, XElement> > retorno = new List <KeyValuePair <string, XElement> >(); foreach (WhitelistRecord_BlackListRecord item in black.Black_WhitelistRecord) { XElement xml = new XElement(black.tSData); xml.Add(new XElement(black.header, new XElement(black.Header.version, black.Header.Version), new XElement(black.Header.iD, black.Header.ID), new XElement(black.Header.issuer, black.Header.Issuer), new XElement(black.Header.receiver, black.Header.Receiver))); xml.Add(new XElement(black.blacklistRecord, new XAttribute(black.expire, black.To.ToString("s")), new XElement(black.action, black.Action), new XElement(black.whitelistRecord, new XAttribute(black.expire, black.To.ToString("s")), new XElement(black.action, black.Action), new XElement(item.utid, item.UTID), new XElement(item.coding, item.Coding), new XElement(item.permission, new XElement(item.Permission.upid, item.Permission.UPID), new XElement(item.tsproperty, new XAttribute(item.TSProperty.type, item.TSProperty.Type_Event), new XElement(item.TSProperty.id, item.TSProperty.EventoID)), new XElement(item.tsproperty, new XAttribute(item.TSProperty.type, item.TSProperty.Type_Area), new XElement(item.TSProperty.id, item.TSProperty.AreaID)), new XElement(item.tsproperty, new XAttribute(item.TSProperty.type, item.TSProperty.Type_TicketType), new XElement(item.TSProperty.id, item.TSProperty.TicketTypeID)), new XElement(item.tsproperty, new XAttribute(item.TSProperty.type, item.TSProperty.Type_SeasonTicket), new XElement(item.TSProperty.id, item.TSProperty.SeasonTicketID), new XElement(item.tsproperty, string.Empty, new XAttribute(item.TSProperty.type, item.TSProperty.Type_Validity), new XAttribute(item.TSProperty.from, item.TSProperty.From.ToString("s")), new XAttribute(item.TSProperty.to, item.TSProperty.To.ToString("s")))))), new XElement(black.blockingtype, black.BlockingType), new XElement(black.blockingreason, black.BlockingReason), new XElement(black.from, black.From.ToString("s")), new XElement(black.to, black.To.ToString("s")), new XElement(black.displaymessage, black.DisplayMessage), new XElement(black.comment, black.Comment))); retorno.Add(new KeyValuePair <string, XElement>(item.UTID, xml)); } return(retorno); } catch (Exception) { throw; } }
public List <KeyValuePair <string, XElement> > Buscar_BlacklistRecord() { BD bd = new BD(); try { EventoIDsBlack = new List <int>(); string SQL = string.Format(@"SELECT DISTINCT te.ID FROM tEvento AS te (NOLOCK) INNER JOIN tApresentacao ta (NOLOCK) ON te.ID = ta.EventoID WHERE te.LocalID IN ({0}) AND ta.Horario >= '{1}%'", this.LocalID, DateTime.Now.AddDays(-1).ToString("yyyyMMdd")); bd.Consulta(SQL); while (bd.Consulta().Read()) { EventoIDsBlack.Add(bd.LerInt("ID")); } bd.FecharConsulta(); if (EventoIDsBlack.Count > 0) { BlacklistRecord black = new BlacklistRecord(); black.Header.Version = Version; black.Header.Issuer = Issuer; black.Header.Receiver = Receiver; black.Header.ID = ID; black.Expire = DateTime.Now; black.Action = "U"; black.BlockingReason = 1; black.BlockingType = 0; black.DisplayMessage = "CANCELADO"; black.Comment = "CANCELLED"; int id = 0; DateTime Horarioinicial = new DateTime(); DateTime Horariofinal = new DateTime(); for (int cont = 0; cont < EventoIDsBlack.Count; cont++) { SQL = string.Format(@"SELECT DISTINCT ticb.ID, ticb.CodigoBarra, SUBSTRING(ta.Horario,1,8) AS Horario, ta.Horario AS HorarioCompleto, tpt.ID AS PrecoTipoID, tash.HorarioInicial, tash.HorarioFinal, ticb.EventoID, tgi.Horario as HoraGerenciada, ISNULL(tgi.PrecoTipoID, 0) AS GerencimanentoID FROM tIngressoCodigoBarra ticb (NOLOCK) INNER JOIN tIngressoLog til (NOLOCK) ON til.CodigoBarra = ticb.CodigoBarra INNER JOIN tIngresso ti (NOLOCK) ON ti.ID = til.IngressoID AND ti.EventoID = ticb.EventoID INNER JOIN tApresentacao ta (NOLOCK) ON ta.ID = ti.ApresentacaoID AND ta.EventoID = ticb.EventoID INNER JOIN tPreco tp (NOLOCK) ON tp.ID = til.PrecoID AND tp.ApresentacaoSetorID = ti.ApresentacaoSetorID LEFT JOIN tPrecoTipo tpt (NOLOCK) ON tpt.ID = tp.PrecoTipoID LEFT JOIN tGerenciamentoIngressos tgi (NOLOCK) ON tgi.ID = ti.GerenciamentoIngressosID LEFT JOIN tAuxiliarSetoresHorario tash (NOLOCK) ON tash.SetorID = ti.SetorID WHERE ticb.EventoID = {0} AND ticb.BlackList = 'T' AND (ticb.Sincronizado = 'T' OR ticb.Sincronizado = 'F')", EventoIDsBlack[cont]); bd.Consulta(SQL); while (bd.Consulta().Read()) { black.From = DateTime.Now; black.To = black.From.AddMonths(1); id = bd.LerInt("ID"); switch (bd.LerInt("GerencimanentoID")) { case GerenciamentoIngressos.PRECOHORAMARCADA: Horarioinicial = Utilitario.String2DateTime(DateTime.Now.ToString("yyyyMMdd") + bd.LerString("HoraGerenciada")); Horariofinal = Horarioinicial.AddHours(1); break; default: string horarioinicial = bd.LerString("HorarioInicial"); if (string.IsNullOrEmpty(horarioinicial)) { Horarioinicial = Utilitario.String2DateTime(bd.LerString("HorarioCompleto")); } else { Horarioinicial = Utilitario.String2DateTime(bd.LerString("Horario") + horarioinicial); } string horariofinal = bd.LerString("HorarioFinal"); if (string.IsNullOrEmpty(horariofinal)) { Horariofinal = Utilitario.String2DateTime(bd.LerString("HorarioCompleto")).AddHours(7.5); } else { Horariofinal = Utilitario.String2DateTime(bd.LerString("Horario") + horariofinal); } break; } black.Black_WhitelistRecord.Add(new WhitelistRecord_BlackListRecord() { Coding = this.Coding, UTID = bd.LerString("CodigoBarra"), Permission = new Permission_BlackListRecord() { UPID = id }, TSProperty = new TSProperty_BlackListRecord() { AreaID = this.AreaID, EventoID = this.EventID == 0 ? bd.LerInt("EventoID").ToString() : this.EventID.ToString("00"), TicketTypeID = this.TicketTypeID == 0 ? bd.LerInt("PrecoTipoID").ToString("00") : this.TicketTypeID.ToString("00"), SeasonTicketID = this.SeassonPassID, From = Horarioinicial, To = Horariofinal } }); } bd.FecharConsulta(); } return(this.Gerar_BlacklistRecord(black)); } else { return(null); } } catch (Exception ex) { throw ex; } finally { bd.Fechar(); } }