public MySqlDataReader GetPagamentosByIdDate() { clsConexao instancia_conexao = new clsConexao(); MySqlCommand sql_cmd = new MySqlCommand(); sql_cmd.CommandType = CommandType.Text; sql_cmd.CommandText = "SELECT * FROM tb_pagamentos WHERE id_data =" + Id_Data.ToString(); MySqlDataReader sql_dr = instancia_conexao.selecionar(sql_cmd); return(sql_dr); }
public MySqlDataReader GetAllMoradores() { clsConexao instancia_cnx = new clsConexao(); MySqlCommand sql_cmd = new MySqlCommand(); sql_cmd.CommandType = CommandType.Text; string sql_query = "SELECT id_morador, nome, ativo FROM tb_moradores"; sql_cmd.CommandText = sql_query; MySqlDataReader sql_dr = instancia_cnx.selecionar(sql_cmd); return(sql_dr); }
public MySqlDataReader GetAllData() { clsConexao instancia_cnx = new clsConexao(); MySqlCommand sql_cmd = new MySqlCommand(); sql_cmd.CommandType = CommandType.Text; string sql_query = "SELECT id_data, mes, ano, quantia_Recebida FROM tb_data"; sql_cmd.CommandText = sql_query; MySqlDataReader sql_dr = instancia_cnx.selecionar(sql_cmd); return(sql_dr); }
public MySqlDataReader GetContasByFiltro(string filtro) { clsConexao instancia_cnx = new clsConexao(); MySqlCommand sql_cmd = new MySqlCommand(); sql_cmd.CommandType = CommandType.Text; string sql_query = "SELECT id_conta, nome_conta, valor_conta, paga FROM tb_contas " + filtro; sql_cmd.CommandText = sql_query; MySqlDataReader sql_dr = instancia_cnx.selecionar(sql_cmd); return(sql_dr); }
public int GetIdByData(int mes, int ano) { int id = 0; clsConexao instancia_cnx = new clsConexao(); MySqlCommand sql_cmd = new MySqlCommand(); sql_cmd.CommandType = CommandType.Text; string sql_query = "SELECT id_data FROM tb_data where mes = " + mes.ToString() + " and ano = " + ano.ToString(); sql_cmd.CommandText = sql_query; MySqlDataReader sql_dr = instancia_cnx.selecionar(sql_cmd); if (sql_dr.Read()) { id = Convert.ToInt32(sql_dr["id_data"]); } return(id); }
public int GetId() { int id = 0; clsConexao instancia_cnx = new clsConexao(); MySqlCommand sql_cmd = new MySqlCommand(); sql_cmd.CommandType = CommandType.Text; string valor = Valor_Conta.Replace(',', '.'); string sql_query = "SELECT id_conta FROM tb_contas where nome_conta = '" + Nome_Conta + "' and round(valor_conta,2) = " + valor + " and id_data = " + Id_Data; sql_cmd.CommandText = sql_query; MySqlDataReader sql_dr = instancia_cnx.selecionar(sql_cmd); if (sql_dr.Read()) { id = int.Parse(sql_dr["id_conta"].ToString()); } return(id); }
/*public void AddConta(float valor, int idData) * { * float quantia_total; * clsConexao instancia_conexao = new clsConexao(); * MySqlCommand sql_cmd2 = new MySqlCommand("select quantia_total from tb_data where id_data = " + idData); * MySqlDataReader sql_dr = instancia_conexao.selecionar(sql_cmd2); * if (sql_dr.Read()) * { * quantia_total = float.Parse(sql_dr["quantia_total"].ToString()); * string query = "update tb_data set quantia_total = " + (quantia_total + valor).ToString().Replace(',', '.') + " where id_data = " + idData; * MySqlCommand sql_cmd = new MySqlCommand(query); * sql_dr.Close(); * instancia_conexao.CRUD(sql_cmd); * } * * }*/ public string insertAno() { clsConexao instancia = new clsConexao(); MySqlCommand sql_cmd2 = new MySqlCommand("select id_data from tb_data where ano = " + Ano); MySqlDataReader sql_dr = instancia.selecionar(sql_cmd2); if (!sql_dr.Read()) { try { clsConexao instancia_conexao = new clsConexao(); string query = "insert into tb_data values" + "(0, 1, " + Ano + ", 0, 0)," + "(0, 2, " + Ano + ", 0, 0)," + "(0, 3, " + Ano + ", 0, 0)," + "(0, 4, " + Ano + ", 0, 0)," + "(0, 5, " + Ano + ", 0, 0)," + "(0, 6, " + Ano + ", 0, 0)," + "(0, 7, " + Ano + ", 0, 0)," + "(0, 8, " + Ano + ", 0, 0)," + "(0, 9, " + Ano + ", 0, 0)," + "(0, 10, " + Ano + ", 0, 0)," + "(0, 11, " + Ano + ", 0, 0)," + "(0, 12, " + Ano + ", 0, 0);"; MySqlCommand sql_cmd = new MySqlCommand(query); instancia_conexao.CRUD(sql_cmd); ds_msg = "Ano inserido com sucesso!"; } catch (Exception ex) { ds_msg = "Erro ao inserir Ano!" + ex.Message; } } else { ds_msg = "O ano já existe no banco de dados!"; } return(ds_msg); }