Ejemplo n.º 1
0
        public void GetBestand()
        {
            string bijdrageID = (String)System.Web.HttpContext.Current.Session["categorie"];

            using (DbConnection con = OracleClientFactory.Instance.CreateConnection())
            {
                if (con == null)
                {
                    //return "Error! No Connection";
                }
                con.ConnectionString = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
                con.Open();
                DbCommand com = OracleClientFactory.Instance.CreateCommand();
                if (com == null)
                {
                    //return "Error! No Command";
                }
                com.Connection  = con;
                com.CommandText = @"SELECT ""bijdrage_id"", ""categorie_id"", ""bestandslocatie"", ""grootte"" FROM BESTAND WHERE ""categorie_id"" =" + bijdrageID;
                DbDataReader reader = com.ExecuteReader();
                try
                {
                    Bestand b;
                    while (reader.Read())
                    {
                        b = new Bestand(reader.GetInt32(0), reader.GetInt32(1), reader.GetString(2), reader.GetInt32(3));
                        bestanden.Add(b);
                    }
                }
                catch (NullReferenceException)
                {
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //ACTIVE DIRECTORY
            SearchResult rs = (SearchResult)Session["directsearch"];

            if (rs.GetDirectoryEntry().Properties["samaccountname"].Value != null)
            {
                lblDbNaam.Text = "Username : "******"samaccountname"].Value.ToString();
            }
            //ACTIVE DIRECTORY
            ab  = new AccountBijdrage();
            b   = new Bijdrage();
            bs  = new Bestand();
            ber = new Bericht();
            c   = new Categorie();

            c.getSUBCategorie();
            foreach (Categorie cat in c.categorieen)
            {
                Button ButtonChange = new Button();
                ButtonChange.Height = 100;
                ButtonChange.Width  = 120;

                ButtonChange.Text                  = cat.Naam;
                ButtonChange.ID                    = "id" + cat.BijdrageID.ToString();
                ButtonChange.Font.Size             = FontUnit.Point(7);
                ButtonChange.ControlStyle.CssClass = "button";
                ButtonChange.Click                += new EventHandler(wbtn_Click);
                //  ButtonChange.OnClientClick = "return false";
                // ButtonChange.CausesValidation = false;

                pnlMappen.Controls.Add(ButtonChange);
            }
            if (!IsPostBack)
            {
                //Toevoegen van de bestand namen in de listbox
                bs.GetBestand();

                foreach (Bestand bstnd in bs.bestanden)
                {
                    lbBestanden.Items.Add(bstnd.ToString());
                }

                ber.GetBericht();

                foreach (Bericht brcht in ber.Berichten)
                {
                    //BUG: Berichten worden opnieuw ingeladen als er op de knop gedrukt wordt.
                    //int eindPos = brcht.ToString().IndexOf("*", 0);
                    //lbPosts.Items.Add(brcht.ToString().Substring(0,eindPos));
                    lbPosts.Items.Add(brcht.ToString());
                }
            }
        }