Exemple #1
0
        private void btnAbrirChamado_Click(object sender, EventArgs e)
        {
            bool retorno;

            if (txtTitulo.Text == "" && cbxCriticidade.Text == "" && rtxtDescricao.Text == "")
            {
                MessageBox.Show("Há campo não preenchido, por favor, preencha todos para poder abrir o chamado corretamente.");
                return;
            }

            _mdlChamado.SetTitulo(txtTitulo.Text);
            _mdlChamado.SetCategoria(Convert.ToInt32(cbxCriticidade.SelectedValue));
            _mdlChamado.SetDescricao(rtxtDescricao.Text);

            retorno = _ctlChamadoSolicitante.abrirChamado(_mdlChamado);
            if (retorno)
            {
                MessageBox.Show("Funcionário cadastrado com sucesso.");
                foreach (Control item in Controls)
                {
                    if (item.GetType().Name == "TextBox" || item.GetType().Name == "ComboBox" || item.GetType().Name == "MaskedTextBox")
                    {
                        item.ResetText();
                    }
                }
            }
        }
        public MdlChamado getChamado(MdlChamado _mdlChamado)
        {
            comando = "PROC_BUSCA_CHAMADO";
            MdlChamado chamado = new MdlChamado();

            using (SqlCommand cmd = new SqlCommand(comando, sql))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("ID_CHAMADO", _mdlChamado.GetCodigo());
                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    chamado.SetTitulo(reader["NOME_CHAMADO"].ToString());
                    chamado.SetCategoria(Convert.ToInt32(reader["ID_NIVEL_CHAMADO"]));
                    chamado.SetDescricao(reader["DESCRICAO"].ToString());
                }
            }
            return(chamado);
        }
Exemple #3
0
        private void btnPesquisarChamado_Click(object sender, EventArgs e)
        {
            int chamadoID;

            if (txtChamadoID.Text == "" && cbxStatusChamado.Text == "" && mskDataInicial.Text == "" && cbxCriticidade.Text == "" &&
                txtTitulo.Text == "")
            {
                MessageBox.Show("Por favor, preencher um dos campos para poder realizar a pesquisa.");
                return;
            }

            //status = (cbxStatusChamado.SelectedItem.ToString() == "ATIVO") ? 1 : 0;
            chamadoID = (txtChamadoID.Text == "") ? 0 : Convert.ToInt32(txtChamadoID.Text);

            grdChamados.DataSource = -1;
            _mdlChamado.SetCodigo(chamadoID);
            _mdlChamado.SetTitulo(txtTitulo.Text);
            _mdlChamado.SetStatus(Convert.ToInt32(cbxStatusChamado.SelectedValue));
            _mdlChamado.SetDataHoraAbertura(Convert.ToDateTime(mskDataInicial.Text));
            _mdlChamado.SetCategoria(Convert.ToInt32(cbxCriticidade.SelectedValue));

            grdChamados.DataSource = ctlChamados.pesquisarChamados(_mdlChamado);
        }