public void ContarCedulas(int valor)
        {
            try
            {
                var conexao = ConexaoMysql.getConexao();
                SelectCedulas = "";

                var comando = new MySqlCommand("SELECT `HANDLE`, `VALOR`, `QUANTIDADE`, `QUANTIDADEMINIMA` FROM `cedula` WHERE QUANTIDADE > QUANTIDADEMINIMA", conexao);
                comando.CommandText = SelectCedulas;

                var SelecionaCedulas = comando.ExecuteReader();

                //ArrayList Cedulas = new ArrayList();

                var cedulaSelecionada = new CedulaSelecionada();

                while (SelecionaCedulas.Read())
                {
                    cedulaSelecionada.Valor = Convert.ToInt32(SelecionaCedulas["VALOR"];
                    cedulaSelecionada.Quantidade = Convert.ToInt32(SelecionaCedulas["QUANTIDADE"];
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
        public void GravarDados(int valor, int conta)
        {
            try
            {
                var conexao = ConexaoMysql.getConexao();
                InsertSaque = "INSERT INTO `saque`(`VALOR`, `CONTA`, `DATAHORA`, `AUTORIZADO`) VALUES (@VALOR, @CONTA, now(), true)";

                var comando = new MySqlCommand("", conexao);
                comando.CommandText = InsertSaque;


#pragma warning disable CS0618 // Type or member is obsolete
                comando.Parameters.Add("@VALOR", valor);
                comando.Parameters.Add("@CONTA", conta);
#pragma warning restore CS0618 // Type or member is obsolete

                var ExecutaSaque = comando.ExecuteReader();

                var SaqueEfetuado = new Saque();


            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                ConexaoMysql.fecharConexao();
            }
        }
Пример #3
0
        protected void ShowDataGridCedulas()
        {
            ConexaoMysql conexao = new ConexaoMysql();

            selectGridCedulas = "SELECT `HANDLE`, `VALOR`, `QUANTIDADE`, `DATAHORA`, `QUANTIDADEMINIMA` FROM `cedula`";

            MySqlCommand comando = new MySqlCommand(selectGridCedulas, ConexaoMysql.getConexao());

            DataTable tabela = new DataTable();

            GridCedulas.DataSource = comando.ExecuteReader();
            GridCedulas.DataBind();

            ConexaoMysql.fecharConexao();
        }
Пример #4
0
        protected void GridCedulas_RowUpdating(object sender, System.Web.UI.WebControls.GridViewUpdateEventArgs e)
        {
            Label   id = GridCedulas.Rows[e.RowIndex].FindControl("lbl_ID") as Label;
            TextBox QuantidadeMinima = GridCedulas.Rows[e.RowIndex].FindControl("txt_QuantidadeMinima") as TextBox;
            TextBox Quantidade       = GridCedulas.Rows[e.RowIndex].FindControl("txt_Quantidade") as TextBox;

            ConexaoMysql conexao = new ConexaoMysql();

            updateGridCedulas = "UPDATE `cedula` SET QUANTIDADE = '" + Quantidade.Text + "', QUANTIDADEMINIMA = '" + QuantidadeMinima.Text + "', DATAHORA = now() WHERE HANDLE = " + Convert.ToInt32(id.Text);

            MySqlCommand comando = new MySqlCommand(updateGridCedulas, ConexaoMysql.getConexao());

            comando.ExecuteNonQuery();
            ConexaoMysql.fecharConexao();

            GridCedulas.EditIndex = -1;
            ShowDataGridCedulas();
        }