コード例 #1
0
        public void cadastrarBanco()
        {
            ConexaoStatue c = new ConexaoStatue();

            c.connect("bdStatueStore");
            c.command.CommandText = "INSERT SUBGRUPO VALUES(@NOME, @DESCRICAO, @OBS, @IDGRUPO)";
            c.command.Parameters.Add("@NOME", System.Data.SqlDbType.VarChar).Value      = nome;
            c.command.Parameters.Add("@DESCRICAO", System.Data.SqlDbType.VarChar).Value = descricao;
            c.command.Parameters.Add("@OBS", System.Data.SqlDbType.VarChar).Value       = observacao;
            c.command.Parameters.Add("@IDGRUPO", System.Data.SqlDbType.Int).Value       = idGrupo;
            try {
                c.conexao.Open();
                c.command.ExecuteNonQuery();
                c.conexao.Close();
            } catch (Exception) {
                System.Windows.MessageBox.Show("Cadastro de subgrupo não realizado devido a um problema. Contate o Administrador do Sistema.");
            }
        }
コード例 #2
0
        public void RegLog()
        {
            ConexaoStatue c = new ConexaoStatue();

            try {
                c.connect("bdStatueStore");
                c.command.CommandText = "INSERT LOGS VALUES(@DETALHE, @DATA, @AREA, @IDFUNC)";
                c.command.Parameters.Add("@DETALHE", SqlDbType.VarChar).Value = Detalhe;
                c.command.Parameters.Add("@DATA", SqlDbType.DateTime).Value   = DataAlt;
                c.command.Parameters.Add("@AREA", SqlDbType.VarChar).Value    = AreaAlt;
                c.command.Parameters.Add("@IDFUNC", SqlDbType.Int).Value      = idFunc;
                c.conexao.Open();
                c.command.ExecuteNonQuery();
            } catch (Exception ex) {
                System.Windows.MessageBox.Show("Não foi possível criar um registro desta ação. Por favor notifique o administrador do sistema com a seguinte mensagem: " + ex.Message);
            } finally {
                c.conexao.Close();
            }
        }
コード例 #3
0
 public static int GetID(String sgrupo)
 {
     try {
         ConexaoStatue c = new ConexaoStatue();
         c.connect("bdStatueStore");
         c.conexao.Open();
         c.command.CommandText = "SELECT idSubgrupo FROM SUBGRUPO " +
                                 "WHERE nomeSubgrupo LIKE '" + sgrupo + "'";
         System.Data.SqlClient.SqlDataReader dr = c.command.ExecuteReader();
         if (dr.HasRows)
         {
             dr.Read();
             return(dr.GetInt32(0));
         }
         else
         {
             return(1);
         }
     }
     catch {
         System.Windows.MessageBox.Show("Não foi possível retornar o ID do subgrupo. Contate o Administrador do Sistema.");
         return(1);
     }
 }