Exemplo n.º 1
0
        /// <summary>
        /// Krijg alle huur objecten de gekoppeld staan aan een huurcontract
        /// </summary>
        /// <param name="id">Huurcontract ID</param>
        /// <returns></returns>
        public static List<Huur> KrijgHuurLijst(int id)
        {
            try
            {
                Openconnecion();
                List<Huur> list = new List<Huur>();
                string str = "select b.* from Boot b join Boot_huurcontract bh on bh.boot_ID = b.naam where b.motor = 0 and bh.huurcontract_ID = "+ id;
                OracleCommand cmd = new OracleCommand(str);
                cmd.Connection = Conn;
                OracleDataReader Read = cmd.ExecuteReader();
                while (Read.Read())
                {
                    Spierboot boot = new Spierboot(Read.GetString(0), Read.GetDecimal(2), Read.GetString(3));
                    list.Add(boot);
                }
                str = "select b.* from Boot b join Boot_huurcontract bh  on bh.boot_ID = b.naam where b.motor = 1 and bh.huurcontract_ID = " + id;
                cmd = new OracleCommand(str);
                cmd.Connection = Conn;
                Read = cmd.ExecuteReader();
                while (Read.Read())
                {
                    Motorboot boot = new Motorboot(Read.GetString(0), Read.GetDecimal(2), Read.GetString(3),
                        Read.GetInt16(1));
                    list.Add(boot);
                }

                str = "select A.* from Artikelen A join Artikelen_huurcontract AH on   AH.Artikelen_ID = A.id where AH.Huurcontract_ID = " + id;
                cmd = new OracleCommand(str);
                cmd.Connection = Conn;
                Read = cmd.ExecuteReader();
                while (Read.Read())
                {
                    Artikel boot = new Artikel(Read.GetInt16(0), Read.GetString(1), Read.GetDecimal(2));
                    list.Add(boot);
                }
                return list;
            }
            catch (Exception)
            {
                return null;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Krijg een lijst van alle objecten die gehuurd kunnen worden
        /// </summary>
        /// <returns></returns>
        public static List<Huur> KrijgHuurLijst()
        {
            try
            {
                Openconnecion();
                List<Huur> list = new List<Huur>();
                string str = "select * from Boot where motor = 0";
                OracleCommand cmd = new OracleCommand(str);
                cmd.Connection = Conn;
                OracleDataReader Read = cmd.ExecuteReader();
                while (Read.Read())
                {
                    Spierboot boot = new Spierboot(Read.GetString(0), Read.GetDecimal(2), Read.GetString(3));
                    list.Add(boot);
                }
                str = "select * from Boot where motor = 1";
                cmd = new OracleCommand(str);
                cmd.Connection = Conn;
                Read = cmd.ExecuteReader();
                while (Read.Read())
                {
                    Motorboot boot = new Motorboot(Read.GetString(0), Read.GetDecimal(2), Read.GetString(3),
                        Read.GetInt16(1));
                    list.Add(boot);
                }

                str = "select * from Artikelen";
                cmd = new OracleCommand(str);
                cmd.Connection = Conn;
                Read = cmd.ExecuteReader();
                while (Read.Read())
                {
                    Artikel boot = new Artikel(Read.GetInt16(0), Read.GetString(1), Read.GetDecimal(2));
                    list.Add(boot);
                }
                return list;
            }
            catch (Exception)
            {
                return null;
            }
        }