Exemplo n.º 1
0
        public void Insert(string[] values)
        {
            string sQuery = string.Empty;

            sQuery = string.Format("INSERT INTO public.tb_paciente(codigo," +
                                   " nome, data_nasc," +
                                   " logradouro, num_end," +
                                   " complm_end, bairro," +
                                   " cidade, estado, cep, fone,ativo)" +
                                   " VALUES ({0},{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11});"
                                   , values[0], values[1], values[2]
                                   , values[3], values[4], values[5], values[6], values[7]
                                   , values[8], values[9], values[10], values[11]);

            /*
             * this.nome = nome;
             *      this.dataNasc = dataNasc;
             *      this.logradouro=logradouro;
             *      this.num = num;
             *      this.complm = complm;
             *      this.bairro = bairro;
             *      this.cidade = cidade;
             *      this.estado_id = estado_id;
             *      this.cep = cep;
             *      this.fone = fone;
             * this.ativo = ativo;
             */
            var conn = new dbconnect.dbConnect_pg(sQuery);
        }
Exemplo n.º 2
0
        public DataTable Searchbyname_dt(string nome)
        {
            var sQuery = string.Format("SELECT * FROM tb_paciente" +
                                       " WHERE nome = '{0}';", nome);
            var conn  = new dbconnect.dbConnect_pg(sQuery);
            var Table = conn.get_table();

            return(Table);
        }
Exemplo n.º 3
0
        public DataTable Searchbycodigo_dt(int codigo)
        {
            var sQuery = string.Format("SELECT * FROM tb_paciente" +
                                       " WHERE codigo = '{0}';", codigo);
            var conn  = new dbconnect.dbConnect_pg(sQuery);
            var Table = conn.get_table();

            return(Table);
        }
Exemplo n.º 4
0
        public bool existeCodigo(int codigo)
        {
            var sQuery = string.Format("SELECT COUNT(codigo) FROM tb_paciente" +
                                       " WHERE codigo = '{0}';", codigo);
            var    conn   = new dbconnect.dbConnect_pg(sQuery);
            var    Table  = conn.get_table();
            string result = string.Empty;

            result = Table.Rows[0][0].ToString();
            return(result.Equals("1"));
        }
Exemplo n.º 5
0
        public int proximoCodigo()
        {
            int codigo = 0;
            var sQuery = "SELECT MAX(codigo) FROM public.tb_paciente;";
            var conn   = new dbconnect.dbConnect_pg(sQuery);
            var Table  = conn.get_table();

            if (!(Table.Rows.GetType()).Equals(DBNull.Value))
            {
                codigo = Convert.ToInt32(Table.Rows[0].ItemArray[0]);
            }
            return(++codigo);
        }
Exemplo n.º 6
0
        public string Searchbycodigo(int codigo)
        {
            var sQuery = string.Format("SELECT * FROM tb_paciente" +
                                       " WHERE codigo = '{0}';", codigo);
            var    conn  = new dbconnect.dbConnect_pg(sQuery);
            var    Table = conn.get_table();
            string sRow  = string.Empty;

            if (Table.Rows.Count != 0)
            {
                foreach (var item in Table.Rows[0].ItemArray)
                {
                    sRow += item;
                    sRow += " ";
                }
            }
            return(sRow);
        }