示例#1
0
        public List <Address> getCityStore(Connection connection)
        {
            try
            {
                if (connection._connection.State == System.Data.ConnectionState.Closed)
                {
                    connection.Open();
                }

                var command = new OracleCommand("getCities", connection._connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                List <Address>  addressList = new List <Address>();
                OracleParameter output      = command.Parameters.Add("l_cursor", OracleDbType.RefCursor);
                output.Direction = System.Data.ParameterDirection.ReturnValue;
                command.ExecuteNonQuery();

                Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Address address = new Address(
                        reader.GetInt32(0),
                        reader.GetString(1));
                    addressList.Add(address);
                }
                connection.Close();
                return(addressList);
                //  return null;
            }
            catch (Exception e)
            {
                connection.Close();
                throw;
            }
        }
示例#2
0
        public List <Products_Info> GetDbProductsList(Connection connection, int id)
        {
            try
            {
                if (connection._connection.State == System.Data.ConnectionState.Closed)
                {
                    connection.Open();
                }
                var command = new Oracle.ManagedDataAccess.Client.OracleCommand("returnCartPro", connection._connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                List <Products_Info> products_Info_list = new List <Products_Info>();

                command.Parameters.Add("ID_INPUT", OracleDbType.Int32, System.Data.ParameterDirection.Input).Value = id;
                Oracle.ManagedDataAccess.Client.OracleParameter p_rc = command.Parameters.Add("rc", OracleDbType.RefCursor,
                                                                                              DBNull.Value,
                                                                                              System.Data.ParameterDirection.Output);
                // Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("rc", OracleDbType.RefCursor);
                // output.Direction = System.Data.ParameterDirection.ReturnValue;
                command.ExecuteNonQuery();

                Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    Products_Info products_Info = new Products_Info(
                        reader.GetInt32(0),
                        reader.GetString(1),
                        reader.GetInt32(2),
                        reader.GetInt32(3),
                        reader.GetString(4),
                        reader.GetString(5));
                    products_Info_list.Add(products_Info);
                }
                connection.Close();
                return(products_Info_list);
                //  return null;
            }
            catch (Exception e)
            {
                connection.Close();
                throw;
            }
        }
示例#3
0
        private void previousOrdersBtn_Click(object sender, EventArgs e)
        {
            string[] words = greetingLabel.Text.Split(' ');

            string name    = words[1];
            string surname = words[2];

            Connection connection = new Connection();

            if (connection._connection.State == System.Data.ConnectionState.Closed)
            {
                connection.Open();
            }
            var command = new Oracle.ManagedDataAccess.Client.OracleCommand("GETUSERORDERS1", connection._connection);

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.Parameters.Add("nume", OracleDbType.Varchar2, System.Data.ParameterDirection.Input).Value    = name;
            command.Parameters.Add("prenume", OracleDbType.Varchar2, System.Data.ParameterDirection.Input).Value = surname;
            List <Order> orders_list = new List <Order>();

            Oracle.ManagedDataAccess.Client.OracleParameter output = command.Parameters.Add("l_cursor", OracleDbType.RefCursor);
            output.Direction = System.Data.ParameterDirection.ReturnValue;
            command.ExecuteNonQuery();

            Oracle.ManagedDataAccess.Client.OracleDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Order order = new Order(reader.GetInt32(0));
                orders_list.Add(order);
            }

            connection.Close();

            seeOrdersForm seeOrdersForm = new seeOrdersForm(connection, orders_list);
        }