public string loadMenu(int pid = 0)
        {
            DAL.Category          c  = new DAL.Category();
            System.Data.DataTable dt = new System.Data.DataTable();
            if (pid <= 0)
            {
                dt = c.Select(" where c.categoryId is null").Tables[0];
            }
            else
            {
                dt = c.Select(" where c.categoryId = " + pid.ToString()).Tables[0];
            }

            if (pid > 0 && dt.Rows.Count > 0)
            {
                s += "<ul>\n\r";
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                s += "<li><a href=\"Shop.aspx?category=" + dt.Rows[i].ItemArray[0] + "\">" + dt.Rows[i].ItemArray[1] + "</a>";
                loadMenu(Convert.ToInt32(dt.Rows[i].ItemArray[0]));
                s += "</li>\n\r";
            }
            if (pid > 0 && dt.Rows.Count > 0)
            {
                s += "</ul>\n\r";
            }
            return(s);
        }
Example #2
0
 private void frmProductNew_Load(object sender, EventArgs e)
 {
     DAL.Brand    b = new DAL.Brand();
     DAL.Category c = new DAL.Category();
     cmbBrand.Source(b.Select());
     cmbCategory.Source(c.Select());
     MyControls.Helper.Numeric(txtDiscount);
 }
 private void loadCategory()
 {
     DAL.Category category = new DAL.Category();
     cmbCategory.DataSource    = category.Select().Tables[0];
     cmbCategory.DisplayMember = "name";
     cmbCategory.ValueMember   = "id";
     cmbCategory.SelectedValue = -1;
 }
Example #4
0
 private void frmProduct_Load(object sender, EventArgs e)
 {
     DAL.Brand b = new DAL.Brand();
     cmbBrand.DataSource    = b.Select().Tables[0];
     cmbBrand.DisplayMember = "name";
     cmbBrand.ValueMember   = "id";
     cmbBrand.SelectedValue = -1;
     DAL.Category c = new DAL.Category();
     cmbCategory.DataSource    = c.Select().Tables[0];
     cmbCategory.DisplayMember = "name";
     cmbCategory.ValueMember   = "id";
     cmbCategory.SelectedValue = -1;
 }
 private void btnSearch_Click(object sender, EventArgs e)
 {
     DAL.Category category = new DAL.Category();
     dgvCategory.DataSource = category.Select().Tables[0];
 }