Ejemplo n.º 1
0
        public async Task <ActionResult <Setores> > PostSetores(Setores setores)
        {
            _context.Setores.Add(setores);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSetores", new { id = setores.Id }, setores));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Atualizar setor atual
        /// </summary>
        /// <param name="novoSetor">Novo setor</param>
        private void UpdateSector(Setores novoSetor)
        {
            // Verifica se o novo setor já não está ativo
            if (novoSetor == SetorAtual)
            {
                return;
            }

            // Dispose em todos os controles
            foreach (Control z in Host.Controls)
            {
                z.Dispose();
            }

            // Zerar controles
            Host.Controls.Clear();

            // Percorrer setores
            switch (novoSetor)
            {
            // Setor de shopping
            case Setores.Shop:
                var HostPages = new Hosts.HostPages();
                Host.Controls.Add(HostPages);
                break;

            case Setores.Library:
                // Sair do Cef
                Cef.PreShutdown();
                var HostGames = new Hosts.HostLibrary();
                Host.Controls.Add(HostGames);
                break;
            }
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutSetores(int id, Setores setores)
        {
            if (id != setores.Id)
            {
                return(BadRequest());
            }

            _context.Entry(setores).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SetoresExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 4
0
        public static bool IsnewIndexin(this int vetor, Setores Setor)
        {
            try
            {
                if (Setor.Index.Contains(vetor))
                {
                    return(false);
                }

                if (Setor.Filhos != null || Setor.Filhos.Count > 0)
                {
                    for (int i = 0; i < Setor.Filhos.Count; i++)
                    {
                        if (!vetor.IsnewIndexin(Setor.Filhos[i]))
                        {
                            return(false);
                        }
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
        public IActionResult Cadastrar(Setores setor)
        {
            if (setor == null)
            {
                return(NotFound(new { mensagem = "Erro ao Cadastrar >:" }));
            }

            setoresRepository.Cadastrar(setor);
            return(Ok());
        }
Ejemplo n.º 6
0
        public static int GetAllIndex(this Setores Setor)
        {
            int indexes = Setor.Index.Count;

            if (Setor.Filhos != null || Setor.Filhos.Count > 0)
            {
                for (int i = 0; i < Setor.Filhos.Count; i++)
                {
                    indexes += Setor.Filhos[i].GetAllIndex();
                }
            }

            return(indexes);
        }
Ejemplo n.º 7
0
 public void CriaSetor(Setores setor)
 {
     _conexao.Insert(setor);
 }
Ejemplo n.º 8
0
 public List <ItemSubItem> GetListItemsSubItemBySetor(Setores setor)
 {
     return(_conexao.Table <ItemSubItem>().Where(a => a.RelatoriosId == setor.Idrelatorio && a.Idsetor == setor.Id).ToList());
 }
 public void Cadastrar(Setores setor)
 {
     ctx.Setores.Add(setor);
     ctx.SaveChanges();
 }
        public Setores BuscarPorId(int id)
        {
            Setores setorRetorndo = ctx.Setores.Find(id);

            return(setorRetorndo);
        }