Exemple #1
0
        private void carregarDados()
        {
            try
            {
                ChamadoService       chamadoService = new ChamadoService();
                UsuarioService       usuarioService = new UsuarioService();
                List <ChamadoEntity> chamados       = chamadoService.listarTodos();

                foreach (ChamadoEntity chamado in chamados)
                {
                    DataGridViewRow row = (DataGridViewRow)gridChamados.Rows[0].Clone();
                    row.Cells[0].Value = chamado.id.ToString();
                    row.Cells[1].Value = chamado.titulo;
                    row.Cells[2].Value = chamado.criacaoData;
                    row.Cells[3].Value = chamado.criacaoHora;
                    row.Cells[4].Value = chamado.status;
                    row.Cells[5].Value = usuarioService.obterPorId(chamado.criacaoUserId).login;
                    if (chamado.userId != 0)
                    {
                        row.Cells[6].Value = usuarioService.obterPorId(chamado.userId).login;
                    }
                    else
                    {
                        row.Cells[6].Value = "SEM ATENDIMENTO";
                    }
                    gridChamados.Rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
 public ChamadosController(ChamadoService chamadoService, ServicoService servicoService, DepartamentoService departamentoService, HistoricoChamadoService historicoChamadoService)
 {
     _chamadoService          = chamadoService;
     _servicoService          = servicoService;
     _departamentoService     = departamentoService;
     _historicoChamadoService = historicoChamadoService;
 }
 public ChamadosController(RelProdContext context, UsuarioServices usuarioService, BuscaService buscaService, ExportService exportService, ChamadoService chamadoService)
 {
     _context         = context;
     _usuarioServices = usuarioService;
     _buscaService    = buscaService;
     _exportService   = exportService;
     _ChamadoService  = chamadoService;
 }
Exemple #4
0
 private void btnEncerrar_Click(object sender, EventArgs e)
 {
     try
     {
         ChamadoService chamadoService = new ChamadoService();
         chamadoService.fechaChamado(this.id);
         btnAtender.Enabled  = false;
         btnEncerrar.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #5
0
 private void btnAtender_Click(object sender, EventArgs e)
 {
     try
     {
         ChamadoService chamadoService = new ChamadoService();
         chamadoService.atendeChamado(this.id, this.parnet.GetUsuarioEntity().id);
         btnAtender.Enabled  = false;
         btnEncerrar.Enabled = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool retorno = false;

            try
            {
                ChamadoService chamadoService = new ChamadoService();
                UsuarioEntity  usuario        = this.parent.GetUsuarioEntity();

                retorno = chamadoService.criarChamado(txtTitulo.Text, txtDescricao.Text, usuario.id);
                MessageBox.Show("Chamado aberto com Sucesso");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #7
0
        private void ChamadoDetalhes_Load(object sender, EventArgs e)
        {
            try
            {
                ChamadoService chamadoService = new ChamadoService();
                UsuarioService usuarioService = new UsuarioService();
                txtTitulo.Enabled    = false;
                txtDescricao.Enabled = false;

                var chamadoEntity = chamadoService.obterPorId(this.id);

                txtTitulo.Text    = chamadoEntity.titulo;
                txtDescricao.Text = chamadoEntity.descricao;
                lblData.Text      = chamadoEntity.criacaoData;
                lblHora.Text      = chamadoEntity.criacaoHora;
                this.status       = chamadoEntity.status;
                var userCriacao = usuarioService.obterPorId(chamadoEntity.criacaoUserId);

                lblCriacaoUser.Text = userCriacao.login;

                if (status != "aberto")
                {
                    var userAtendimento = usuarioService.obterPorId(chamadoEntity.userId);
                    lblUser.Text       = userAtendimento.login;
                    btnAtender.Enabled = false;
                    if (status == "encerrado")
                    {
                        btnEncerrar.Enabled = false;
                    }
                }
                else
                {
                    btnEncerrar.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                this.Close();
            }
        }
Exemple #8
0
 public ChamadoController(ChamadoService chamadoService)
 {
     _chamadoService = chamadoService;
 }