protected void Page_Load(object sender, EventArgs e)
        {
            int link = -1;
            try
            {
                link = Convert.ToInt32(Request.QueryString["c"]);

            }
            catch { Response.Redirect("Pricewatch.aspx"); }
            cat = dbmngr.GetCategorie(link);
            TitleCat.Text = cat.Naam;
            ItemTable.DataSource = dbmngr.GetCatProducts(link);
            ItemTable.DataBind();
        }
示例#2
0
        public Categorie GetCategorie(int id)
        {
            int       idcat   = -1;
            string    naam    = null;
            int       childof = -1;
            Categorie cat     = null;

            try
            {
                if (id < 0)
                {
                    throw new NoNullAllowedException();
                }
                string sql = @"SELECT * FROM Categorie WHERE ID= :CatID";
                conn.Open();
                OracleCommand cmd = new OracleCommand(sql, conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("CatID", OracleDbType.Int32, id, ParameterDirection.Input);
                OracleDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    idcat = reader.GetInt32(0);
                    naam  = reader.GetOracleString(1).ToString();
                    string temp = reader.GetValue(3).ToString();
                    if (!int.TryParse(temp, out childof))
                    {
                        childof = -1;
                    }
                }
                cat = new Categorie(idcat, naam, null, childof);
            }
            catch { }
            finally
            {
                conn.Close();
            }
            return(cat);
        }
示例#3
0
 public Categorie GetCategorie(int id)
 {
     int idcat = -1;
     string naam = null;
     int childof = -1;
     Categorie cat = null;
     try
     {
         if (id < 0)
         { throw new NoNullAllowedException(); }
         string sql = @"SELECT * FROM Categorie WHERE ID= :CatID";
         conn.Open();
         OracleCommand cmd = new OracleCommand(sql, conn);
         cmd.CommandType = CommandType.Text;
         cmd.Parameters.Add("CatID", OracleDbType.Int32, id, ParameterDirection.Input);
         OracleDataReader reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             idcat = reader.GetInt32(0);
             naam = reader.GetOracleString(1).ToString();
             string temp = reader.GetValue(3).ToString();
             if (!int.TryParse(temp, out childof))
             {
                 childof = -1;
             }
         }
         cat = new Categorie(idcat, naam, null, childof);
     }
     catch { }
     finally
     {
         conn.Close();
     }
     return cat;
 }