Example #1
0
 public Addmapform(Filesharingform parent, Categorie selected_map)
 {
     InitializeComponent();
     bt_accept.Image = parent.imagelist_icons48x48.Images[6];
     this.parent = parent;
     this.selected_map = selected_map;
 }
Example #2
0
        // haalt uit de database alle submappen en files in de geselecteerde map en laat deze netjes zien
        private void Treeview_categories_NodeMouseClick_1(object sender, TreeNodeMouseClickEventArgs e)
        {
            try
            {
                // root gedeelte
                if (e.Node.Text == "Mijn Bestanden")
                {
                    File[] files = DatabaseKoppeling.searchUserFiles(RFID).ToArray();
                    listv_files.Items.Clear();
                    listv_files.Items.AddRange(files);
                    bt_verwijdermap.Enabled = false;
                    bt_nieuwemap.Enabled = false;
                    bt_upload.Enabled = false;
                }
                else
                {
                    Categorie current = e.Node as Categorie;
                    current.Nodes.Clear();
                    Categorie[] lijst = DatabaseKoppeling.getFolders(current.Map_id).ToArray();
                    current.Nodes.AddRange(lijst);
                    current.Expand();
                    folder_selection = current;
                    if (type == type_gebruiker.Medewerker)
                    {
                        bt_nieuwemap.Enabled = true;
                        if (current.Map_id != 0)
                        {
                            bt_verwijdermap.Enabled = true;
                        }
                        else
                        {
                            bt_verwijdermap.Enabled = false;
                        }
                    }
                    bt_upload.Enabled = true;
                    //

                    // files gedeelte
                    File[] files = DatabaseKoppeling.getFiles(current.Map_id).ToArray();
                    listv_files.Items.Clear();
                    listv_files.Items.AddRange(files);
                }

                // general gedeelte
                listv_files.Visible = true;
                bt_download.Enabled = false;
                bt_remove.Enabled = false;
                //
            }
            catch
            {
                MessageBox.Show("Ongeldige database actie. \nEr heeft zich een database restrictie voorgedaan of de connectie is verbroken.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        public static Categorie newFolder(string map_naam, int id_parent)
        {
            Categorie map;
            string map_id = "";

            string sql = "SELECT seq_map.nextval FROM dual";
            OracleCommand cmd = new OracleCommand(sql, conn);

            try
            {
                conn.Open();
                OracleDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    map_id = reader["nextval"].ToString();
                }

                cmd = new OracleCommand();
                cmd.Parameters.Add(new OracleParameter("map_naam", map_naam));
                cmd.CommandText = "INSERT INTO MAP VALUES (" + map_id + ", :map_naam, " + id_parent.ToString() + ")";
                cmd.Connection = conn;
                cmd.ExecuteNonQuery();

                map = new Categorie(Convert.ToInt32(map_id), map_naam, id_parent);
            }
            catch (OracleException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
            return map;
        }
Example #4
0
        public static List<Categorie> getFolders(int id_parent)
        {
            List<Categorie> categorien = new List<Categorie>();

            string sql = "SELECT * FROM MAP WHERE Parent_id = " + id_parent.ToString();
            OracleCommand cmd = new OracleCommand(sql, conn);

            try
            {
                conn.Open();
                OracleDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Categorie ca = new Categorie(Convert.ToInt32(reader["MAP_ID"]), reader["MAP_NAAM"].ToString(), Convert.ToInt32(reader["PARENT_ID"]));
                    if (ca.Parent_id != ca.Map_id)
                    {
                        categorien.Add(ca);
                    }
                }
            }
            catch (OracleException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }

            return categorien;
        }