Ejemplo n.º 1
0
        internal DataSet getAdress()
        {
            DataSet ds = new DataSet();
            // Instancia a conexao com o banco de dados
            Connection conn = new Connection();
            using (SqlConnection sqlConn = conn.connection())
            {
                using (SqlCommand cmd = new SqlCommand("Get Address", sqlConn))
                {
                    using (SqlDataAdapter adp = new SqlDataAdapter(cmd))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@cpf", SqlDbType.VarChar).Value = this.CPF;
                        sqlConn.Open();
                        adp.Fill(ds);
                    }
                }
            }

            return ds;
        }
Ejemplo n.º 2
0
        internal int insertClient()
        {
            int affectedLines = 0;

            Connection conn = new Connection();
            using (SqlConnection connection = conn.connection())
            {
                using (SqlCommand cmd = new SqlCommand("Insert Client", connection))
                {
                    using (SqlDataAdapter adp = new SqlDataAdapter(cmd))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@CPF", SqlDbType.VarChar).Value = this.CPF;
                        cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = this.Name;
                        cmd.Parameters.Add("@email", SqlDbType.VarChar).Value = this.Email;
                        cmd.Parameters.Add("@marital_status", SqlDbType.Int).Value = this.MaritalStatus;

                        connection.Open();
                        affectedLines = cmd.ExecuteNonQuery();
                    }
                }
            }
            return affectedLines;
        }
Ejemplo n.º 3
0
        internal int updatePhoneNumber()
        {
            int affectedLines = 0;

            Connection conn = new Connection();
            using (SqlConnection connection = conn.connection())
            {
                using (SqlCommand cmd = new SqlCommand("Update Phone Number", connection))
                {
                    using (SqlDataAdapter adp = new SqlDataAdapter(cmd))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@CPF", SqlDbType.VarChar).Value = this.CPF;
                        cmd.Parameters.Add("@id", SqlDbType.VarChar).Value = this.Id;
                        cmd.Parameters.Add("@description", SqlDbType.VarChar).Value = this.Description;
                        cmd.Parameters.Add("@number", SqlDbType.VarChar).Value = this.Number;

                        connection.Open();
                        affectedLines = cmd.ExecuteNonQuery();
                    }
                }
            }
            return affectedLines;
        }
Ejemplo n.º 4
0
        internal int insertAddress()
        {
            int affectedLines = 0;

            Connection conn = new Connection();
            using (SqlConnection connection = conn.connection())
            {
                using (SqlCommand cmd = new SqlCommand("Insert Adress", connection))
                {
                    using (SqlDataAdapter adp = new SqlDataAdapter(cmd))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@CPF", SqlDbType.VarChar).Value = this.CPF;
                        cmd.Parameters.Add("@country", SqlDbType.VarChar).Value = this.Country;
                        cmd.Parameters.Add("@state", SqlDbType.VarChar).Value = this.State;
                        cmd.Parameters.Add("@city", SqlDbType.VarChar).Value = this.City;
                        cmd.Parameters.Add("@address", SqlDbType.Int).Value = this.ClientAddress;
                        connection.Open();
                        affectedLines = cmd.ExecuteNonQuery();
                    }
                }
            }
            return affectedLines;
        }