示例#1
0
        public void Incluir(ProtocoloDTO protBllCrud)
        {
            /*     if (protBllCrud.Prot_tipo.Trim().Length == 0) //verifica se foi informado
             *   {
             *       throw new Exception("O tipo de exame é obrigatório");
             *   }
             * /*/
            ProtocoloDAL dalObj = new ProtocoloDAL(conexao);

            dalObj.Incluir(protBllCrud);
        }
示例#2
0
        public void Incluir(ProtocoloDTO protDalCrud)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conexao.Conexao;
            cmd.CommandText = "insert into tbProtocolo(pro_atendimento, pro_tipo, pro_aplicaçao, pro_data, pro_intervalo) values (@pro_atendimento, @pro_tipo, @pro_aplicaçao, @pro_data, @pro_intervalo);select @@identity;";
            cmd.Parameters.AddWithValue("@pro_atendimento", protDalCrud.Prot_atendimento);
            cmd.Parameters.AddWithValue("@pro_tipo", protDalCrud.Prot_tipo);
            cmd.Parameters.AddWithValue("@pro_aplicaçao", protDalCrud.Prot_aplicaçao);
            cmd.Parameters.AddWithValue("@pro_data", protDalCrud.Prot_data);
            cmd.Parameters.AddWithValue("@pro_intervalo", protDalCrud.Prot_intervalo);

            conexao.Conectar();

            protDalCrud.Prot_id = Convert.ToInt32(cmd.ExecuteScalar());

            conexao.Desconectar();
        }//incluir
示例#3
0
        }//incluir

        public void Alterar(ProtocoloDTO protDalCrud)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conexao.Conexao;
            cmd.CommandText = "update tbProtocolo set pro_atendimento = @pro_atendimento, pro_tipo = @pro_tipo, pro_aplicaçao = @pro_aplicaçao, pro_data = @pro_data, pro_intervalo = @pro_intervalo where pro_id = @pro_id;";

            cmd.Parameters.AddWithValue("@pro_id", protDalCrud.Prot_id);
            cmd.Parameters.AddWithValue("@pro_atendimento", protDalCrud.Prot_atendimento);
            cmd.Parameters.AddWithValue("@pro_tipo", protDalCrud.Prot_tipo);
            cmd.Parameters.AddWithValue("@pro_aplicaçao", protDalCrud.Prot_aplicaçao);
            cmd.Parameters.AddWithValue("@pro_data", protDalCrud.Prot_data);
            cmd.Parameters.AddWithValue("@pro_intervalo", protDalCrud.Prot_intervalo);

            conexao.Conectar();
            cmd.ExecuteNonQuery(); //não retorna parametro algum
            conexao.Desconectar();
        }//alterar
示例#4
0
        private void btnSalvarPT_Click(object sender, EventArgs e)
        {
            try
            {
                //leitura dos dados
                ProtocoloDTO prot = new ProtocoloDTO();

                prot.Prot_atendimento = Convert.ToInt32(prot_atendimentoTextBox.Text);
                prot.Prot_tipo        = Convert.ToInt32(prot_tipoComboBox.SelectedValue);
                prot.Prot_aplicaçao   = Convert.ToInt32(prot_tipoComboBox.SelectedValue);
                //        prot.Prot_data = prot_dataTextBox.Text;
                prot.Prot_data      = prot_dataTextBox.Text;
                prot.Prot_intervalo = prot_intervaloTextBox.Text;

                //obj para gravar dados no bd
                ConexaoDAL   conexao = new ConexaoDAL(DadosConexaoDAL.StringDeConexão);
                ProtocoloBLL bll     = new ProtocoloBLL(conexao);

                if (this.operacao == "inserir") /// alterar salvar para inserir
                {
                    bll.Incluir(prot);

                    MessageBox.Show("Cadastrado com Sucesso: Código: " + prot.Prot_id.ToString());

                    pnInfo.Show();
                }
                else
                {
                    prot.Prot_id = Convert.ToInt32(prot_idTextBox.Text);
                    bll.Alterar(prot);
                    MessageBox.Show("Cadastrado Alterado com Sucesso: Código: " + prot.Prot_id.ToString());
                }
                this.LimpaTelaPT();
                this.alterarBotoesPT(1);
            } //try

            catch (Exception erro)
            {
                MessageBox.Show(erro.Message);
            }
        }
示例#5
0
        }//pesquisar

        public ProtocoloDTO CarregaProtocoloDTO(int pro_id) //tipo + o campo do banco
        {
            ProtocoloDTO prot = new ProtocoloDTO();
            SqlCommand   cmd  = new SqlCommand();

            cmd.Connection  = conexao.Conexao;
            cmd.CommandText = "select * from tbProtocolo where pro_id = @pro_id;";
            cmd.Parameters.AddWithValue("@pro_id", pro_id);
            conexao.Conectar();
            SqlDataReader registro = cmd.ExecuteReader();

            if (registro.HasRows)
            {
                registro.Read();
                prot.Prot_id          = Convert.ToInt32(registro["pro_id"]);
                prot.Prot_atendimento = Convert.ToInt32(registro["pro_atendimento"]);
                prot.Prot_tipo        = Convert.ToInt32(registro["pro_tipo"]);
                prot.Prot_aplicaçao   = Convert.ToInt32(registro["pro_aplicaçao"]);
                prot.Prot_data        = Convert.ToString(registro["pro_data"]);
                prot.Prot_intervalo   = Convert.ToString(registro["pro_intervalo"]);
            }
            conexao.Desconectar();
            return(prot);
        } //carrega