Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
        {
            Request.Browser.Adapters.Clear();
        }

        if (!IsPostBack)
        {
            DBTool dbTool = new DBTool();
            Category category = new Category();
            DataSet dsCategory = category.GetList();
            DataTable dtCategory = dsCategory.Tables[0];

            Menu1.Items.Add(new MenuItem("Library"));

            foreach (DataRow dr in dtCategory.Rows)
            {
                string CatName = Convert.ToString(dr["name"]);
                string CatId= Convert.ToString(dr["categoryid"]);
                string SubCatId = dbTool.GetOneString("SELECT TOP 1 subcategoryid FROM mst_subcategory WHERE Categoryid =" + CatId);

                MenuItem node = new MenuItem(CatName, "", "", "ViewCat.aspx?Catid=" + CatId + "&SubCatId="+SubCatId, "");
                Menu1.Items[0].ChildItems.Add(node);
            }
        }
        txtSearch.Attributes.Add("onkeypress", "return AnyInput_KeyDown(event,'" + btnSearch.ClientID + "')");
    }
Exemplo n.º 2
0
        public string GetSubcategoryByID(string bookid)
        {
            string SQL = "SELECT subcategoryid from tb_book where bookid='" + bookid + "'";

            DBTool dbTool = new DBTool();

            try
            {
                return dbTool.GetOneString(SQL);
            }
            catch (Exception)
            {
                return "";
            }
        }
Exemplo n.º 3
0
        public string GetName(string subcategoryid)
        {
            string SQL = "SELECT name FROM mst_subcategory WHERE subcategoryid =" + subcategoryid;

            DBTool dbTool = new DBTool();

            try
            {
                return dbTool.GetOneString(SQL);
            }
            catch (Exception)
            {
                return "";
            }
        }