public async Task Atualizar(Servidores s) { using Kurosawa_DiaContext context = new Kurosawa_DiaContext(); Servidores servidores = await context.Servidores.SingleOrDefaultAsync(x => x.ID == s.ID); if (s.Prefix != "") { servidores.Prefix = s.Prefix; } if (s.Especial != TiposServidores.Inalterado) { servidores.Especial = s.Especial; } await context.SaveChangesAsync(); //IDbContextTransaction transation = await context.Database.BeginTransactionAsync(IsolationLevel.Snapshot); //await context.Database.ExecuteSqlRawAsync("call AtualizarServidor({0}, {1}, {2})", servidor.ID, servidor.Prefix ?? "", servidor.Especial); //await context.Servidores.FromSqlRaw("call AtualizarServidor({0}, {1}, {2})", servidor.ID, servidor.Prefix ?? "", servidor.Especial).LoadAsync(); //_ = context.Set<Void>().FromSqlRaw("call AtualizarServidor({0}, {1}, {2})", servidor.ID, servidor.Prefix ?? "", servidor.Especial).LoadAsync(); //await context.SaveChangesAsync(); //await transation.CommitAsync(); //MySqlCommand command = await context.GetMysqlCommand(); //command.CommandText = "call AtualizarServidor(@si, @sp, @se)"; //command.Parameters.AddWithValue("@si", servidor.ID); //command.Parameters.AddWithValue("@sp", servidor.Prefix ?? ""); //command.Parameters.AddWithValue("@se", servidor.Especial); //await command.ExecuteNonQueryAsync(); }
public async Task F**k(CommandContext ctx, [Description("Usuário que você quer foder.")][RemainingText] DiscordUser usuario = null) { bool especial = false; if (ctx.Guild != null) { Servidores servidor = await new ServidoresDAO().Get(new Servidores { ID = ctx.Guild.Id }); especial = ((byte)servidor.Especial >= (byte)TiposServidores.LolisEdition); } F**k f**k = await new FuckDAO().Get(new F**k { Explicit = especial }); await ctx.RespondAsync(embed : new DiscordEmbedBuilder { Color = DiscordColor.HotPink, ImageUrl = f**k.Url, Title = (usuario == null) ? $"{ctx.User.Username} está se masturbando." : $"{ctx.User.Username} está fodendo {usuario.Username}." }); }
public async Task <Servidores> Get(Servidores servidor) { using Kurosawa_DiaContext context = new Kurosawa_DiaContext(); return(await context.Servidores.SingleOrDefaultAsync(x => x.ID == servidor.ID)); //return (await context.Servidores.FromSqlRaw("call GetServidor({0})", servidor.ID).ToListAsync()).FirstOrDefault(); }
public string GetServerPrefix(ulong serverId, string defaultPrefix) { var svl = Servidores.Find(x => x.Id == serverId).FirstOrDefault(); if (svl == null) { return(defaultPrefix); } return(svl.Prefix); }
public async Task <string> GetServerPrefixAsync(ulong serverId, string defaultPrefix) { var svl = await Servidores.Find(x => x.Id == serverId).FirstOrDefaultAsync(); if (svl == null) { return(defaultPrefix); } return(svl.Prefix); }
public async Task <Servidores> criarServidor(Servidores serv) { if (serv != null) { _contexto.Update(serv); await _contexto.SaveChangesAsync(); } return(serv); }
public async Task <Servidores> pesquisarServidorPorMatricula(int matricula) { Servidores servidoresLinq = await _contexto .Servidores .AsNoTracking() .Where(reg => reg.Matricula == matricula) .FirstOrDefaultAsync(); return(servidoresLinq); }
private void BtnSave_Click(object sender, EventArgs e) { Servidores n = new Servidores(); int resp = n.Guardar(TxtNombre.Text, Convert.ToBoolean(CmbStatus.SelectedIndex)); if (resp == 1) { MessageBox.Show("Se ha guardado el servidor con exito", "Guardado con exito", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("Error al guardar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmLinksNuevo_Load(object sender, EventArgs e) { Series n = new Series(); IEnumerable <Series> datos = n.Listar(); CmbSerie.DataSource = datos; CmbSerie.DisplayMember = "nombre"; CmbSerie.ValueMember = "idserie"; Servidores lista = new Servidores(); CmbServidor.DataSource = lista.Listar(); CmbServidor.DisplayMember = "nombre"; CmbServidor.ValueMember = "idservidor"; }
public async Task <Servidores> Add(Servidores_Usuarios su) { Kurosawa_DiaContext context = new Kurosawa_DiaContext(); Servidores servidor = await context.Servidores.AsNoTracking().SingleOrDefaultAsync(x => x.ID == su.Servidor.ID); if (servidor == null) { await context.Servidores.AddAsync(servidor = new Servidores { ID = su.Servidor.ID, Nome = su.Servidor.Nome }); await context.SaveChangesAsync(); } Usuarios usuario = await context.Usuarios.AsNoTracking().SingleOrDefaultAsync(x => x.ID == su.Usuario.ID); if (usuario == null) { await context.Usuarios.AddAsync(usuario = new Usuarios { ID = su.Usuario.ID, Nome = su.Usuario.Nome }); await context.SaveChangesAsync(); } Servidores_Usuarios servidor_usuario = await context.Servidores_Usuarios.AsNoTracking().SingleOrDefaultAsync(x => x.Servidor.ID == su.Servidor.ID && x.Usuario.ID == su.Usuario.ID); if (servidor_usuario == null) { await context.Servidores_Usuarios.AddAsync(servidor_usuario = new Servidores_Usuarios { Servidor = servidor, Usuario = usuario }); } return(servidor); //using (Kurosawa_DiaContext context = new Kurosawa_DiaContext()) //{ // return (await context.Servidores.FromSqlRaw("call CadastrarUsuarioServidor({0}, {1}, {2}, {3})", su.Servidor.ID, su.Usuario.ID, su.Servidor.Nome, su.Usuario.Nome).ToListAsync()).FirstOrDefault(); //} }
internal static async Task <string> GetPrefix(DiscordMessage msg) { if (!msg.Channel.IsPrivate) { Servidores s = await new Usuarios_ServidoresDAO().Add(new Servidores_Usuarios { Servidor = new Servidores { ID = msg.Channel.GuildId, Nome = msg.Channel.Guild.Name }, Usuario = new Usuarios { ID = msg.Author.Id, Nome = $"{msg.Author.Username} #{msg.Author.Discriminator}" } }) ?? new Servidores(); return(s.Prefix ?? DefaultPrefix); } return(DefaultPrefix); }
public async Task <IActionResult> Consultar( [FromServices] IServidoresDal servidoresDal, int matricula ) { try { Servidores retorno = await servidoresDal.pesquisarServidorPorMatricula(matricula); if (retorno != null) { return(Ok(retorno)); } else { return(NotFound(new { message = "Servidor não foi encontrado." })); } } catch (System.Exception ex) { throw ex; } }
public async Task <IActionResult> Inserir( [FromServices] IServidoresDal servidoresDal, [FromBody] Servidores body ) { try { Servidores retorno = await servidoresDal.criarServidor(body); if (retorno.Matricula != 0) { return(Ok(retorno)); } else { return(Ok(new { message = "Nenhuma servidor inserido." })); } } catch (System.Exception ex) { return(BadRequest(new { message = ex.Message })); } }
public string ActualizarServidorApp(Servidores server, System.Data.DataTable Discos, string Srv_Observaciones) { DLSoftware odlSoftware = new DLSoftware(); return(odlSoftware.ActualizarServidorApp(server, Discos, Srv_Observaciones)); }