Ejemplo n.º 1
0
    private void LoadDanhMuc()
    {
        try
        {
            NhomSanPham nsp = new NhomSanPham();
            DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0);
            ds.Tables[0].DefaultView.Sort = "SapXep ASC";

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    TableRow tr = new TableRow();
                    TableCell td = new TableCell();
                    td.Text = "<a href=\"maincategory.aspx?mcid=" + dr["NhomSanPhamID"] + "\">" + dr["TenNhomSanPham"] +
                              "</a>";
                    tr.Cells.Add(td);
                    tblDanhMuc.Rows.Add(tr);
                }
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Ejemplo n.º 2
0
 private int LoadDanhMuc()
 {
     NhomSanPham nsp = new NhomSanPham();
     DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0);
     DataRow[] selectedRows = ds.Tables[0].Select("Show=true");
     ds.Tables[0].Columns.Add("Selected", Type.GetType("System.String"));
     ds.Tables[0].Columns["Selected"].DefaultValue = "false";
     for (int i = 0; i < selectedRows.Length; i++)
     {
         selectedRows[i]["Selected"] = "True";
     }
     grdCat.DataSource = ds;
     grdCat.DataBind();
     return selectedRows.Length;
 }
Ejemplo n.º 3
0
    protected void LoadDanhMuc3()
    {
        int index = ddlDanhMuc3.SelectedIndex;
        ddlDanhMuc3.Items.Clear();
        if (ddlDanhMuc2.SelectedIndex != 0)
        {
            NhomSanPham nsp = new NhomSanPham();
            DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(int.Parse(ddlDanhMuc2.SelectedValue));
            ddlDanhMuc3.DataSource = ds.Tables[0];
            ddlDanhMuc3.DataTextField = "TenNhomSanPham";
            ddlDanhMuc3.DataValueField = "NhomSanPhamID";
            ddlDanhMuc3.DataBind();

            ddlDanhMuc3.Items.Insert(0, "Tất cả");
            ddlDanhMuc3.Items[0].Value = "0";
        }
        if ((index > 0) && (index < ddlDanhMuc3.Items.Count))
        {
            ddlDanhMuc3.Items[index].Selected = true;
        }
    }
Ejemplo n.º 4
0
    private void LoadDanhMuc(int NhomChaID, int loaddm)
    {
        loaddm++;
        string sign = "";
        switch (loaddm)
        {
            case 1:
                sign = "";
                break;
            case 2:
                sign = "++";
                break;
            case 3:
                sign = "-----";
                break;
            case 4:
                sign = "........";
                break;
        }
        try
        {
            NhomSanPham nhomsanpham = new NhomSanPham();
            DataSet ds = nhomsanpham.SelectNhomSanPhamByNhomChaID(NhomChaID);
            ds.Tables[0].DefaultView.Sort = "SapXep ASC";

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //if (dr["NhomChaID"].ToString() == "" || dr["NhomChaID"].ToString() == "0")
                    //{
                    HtmlTableRow tbr = new HtmlTableRow();
                    tbr.Style.Add("padding-left", (loaddm*15) + "px");
                    HtmlTableCell tbc1 = new HtmlTableCell();
                    HtmlTableCell tbc2 = new HtmlTableCell();
                    //image cells
                    HtmlTableCell tbc3 = new HtmlTableCell();
                    HtmlTableCell tbc4 = new HtmlTableCell();
                    HtmlTableCell tbc5 = new HtmlTableCell();

                    //tbc1.Style.Add("width", "1px");
                    tbc2.InnerText = sign + " " + dr["SapXep"] + "." + dr["TenNhomSanPham"];
                    tbc2.ColSpan = 2;
                    tbc3.Style.Add("width", "16px");
                    tbc4.Style.Add("width", "16px");
                    tbc5.Style.Add("width", "16px");
                    tbc3.Style.Add("padding", "0");
                    tbc3.Style.Add("margin", "0");
                    tbc3.Style.Add("cursor", "hand");
                    tbc4.Style.Add("padding", "0");
                    tbc4.Style.Add("margin", "0");
                    tbc4.Style.Add("cursor", "hand");
                    tbc5.Style.Add("padding", "0");
                    tbc5.Style.Add("margin", "0");
                    tbc5.Style.Add("cursor", "hand");

                    HtmlImage img1 = new HtmlImage();
                    HtmlImage img2 = new HtmlImage();
                    HtmlImage img3 = new HtmlImage();

                    img1.Src = "../images/edit.gif";
                    img2.Src = "../images/delete.gif";
                    img3.Src = "../images/add.gif";
                    img1.Alt = "Sửa danh mục cha";
                    img2.Alt = "Xóa danh mục cha";
                    img3.Alt = "Thêm danh mục con";
                    img1.Attributes.Add("onclick", "Edit(" + dr["NhomSanPhamID"] + ");");
                    img2.Attributes.Add("onclick", "Delete(" + dr["NhomSanPhamID"] + ");");
                    img3.Attributes.Add("onclick", "AddSub(" + dr["NhomSanPhamID"] + ",'" +
                                                   dr["TenNhomSanPham"] + "');");

                    tbc3.Controls.Add(img1);
                    tbc4.Controls.Add(img2);
                    if (loaddm < 3)
                        tbc5.Controls.Add(img3);

                    //tbr.Cells.Add(tbc1);
                    tbr.Cells.Add(tbc2);
                    tbr.Cells.Add(tbc3);
                    tbr.Cells.Add(tbc4);
                    tbr.Cells.Add(tbc5);
                    tblDanhMuc.Rows.Add(tbr);

                    LoadDanhMuc(int.Parse(dr["NhomSanPhamID"].ToString()), loaddm);
                    // }
                }
            }
        //            tblDanhMuc.Controls.Add(tbl);
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Ejemplo n.º 5
0
    //protected override void OnLoad(EventArgs e)
    //{
    //    base.OnLoad(e);
    //}
    private void LoadDanhMucCon(int NhomChaID, int loaddm)
    {
        NhomSanPham nhomsanpham = new NhomSanPham();
        DataSet ds;
        string cachNsp = "nsp" + NhomChaID;
        if (Cache[cachNsp] == null)
        {
            ds = nhomsanpham.SelectNhomSanPhamByNhomChaID(NhomChaID);
            Cache.Insert(cachNsp, ds);
        }
        else
        {
            ds = (DataSet) Cache[cachNsp];
        }

        if (NhomChaID == 0)
            loaddm = 0;
        string indent = "";
        switch (loaddm)
        {
            case 0:
                indent = "+ ";
                break;
            case 1:
                indent = "+...";
                break;
            case 2:
                indent = "+.....";
                break;
            case 3:
                indent = "+.......";
                break;
            case 4:
                indent = "+.........";
                break;
        }

        int n = ddlNhomSanPham.SelectedIndex;
        loaddm++;
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ListItem item = new ListItem(indent + ds.Tables[0].Rows[i]["TenNhomSanPham"],
                                         ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString());
            ddlNhomSanPham.Items.Add(item);
            //item.Enabled = false;
            LoadDanhMucCon(int.Parse(ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString()), loaddm);
            //item.Enabled = true;
        }
    }
Ejemplo n.º 6
0
    private void LoadMenuItems(MenuItem mi, int NhomSanPhamID)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(NhomSanPhamID);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            MenuItem mni = new MenuItem(
                dr["TenNhomSanPham"].ToString(), dr["NhomSanPhamID"].ToString());

            LoadMenuItems(mni, int.Parse(dr["NhomSanPhamID"].ToString()));
            mni.NavigateUrl = "promotion.aspx?pcode=" + promotion_code + "&cid=" +
                              dr["NhomSanPhamID"];

            mi.ChildItems.Add(mni);
        }
    }
Ejemplo n.º 7
0
    private void LoadTreeItems(TreeNode tn, int NhomChaID)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(NhomChaID);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            TreeNode node = new TreeNode(dr["TenNhomSanPham"].ToString(), dr["NhomSanPhamID"].ToString());
            LoadTreeItems(node, int.Parse(dr["NhomSanPhamID"].ToString()));
            tn.ChildNodes.Add(node);
        }
    }
Ejemplo n.º 8
0
 private void LoadDanhMuc(int mcid)
 {
     try
     {
         NhomSanPham nsp = new NhomSanPham();
         DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0);
         ds.Tables[0].DefaultView.Sort = "SapXep ASC";
         if (ds.Tables[0].Rows.Count > 0)
         {
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 TableRow tr = new TableRow();
                 TableCell td = new TableCell();
                 td.Text = "<a href=\"maincategory.aspx?mcid=" + dr["NhomSanPhamID"] + "\">" + dr["TenNhomSanPham"] +
                           "</a>";
                 tr.Cells.Add(td);
                 tblDanhMuc.Rows.Add(tr);
                 if (int.Parse(dr["NhomSanPhamID"].ToString()) == mcid)
                 {
                     //Danh muc con                        ;
                     DataSet sds = nsp.SelectNhomSanPhamByNhomChaID(mcid);
                     sds.Tables[0].DefaultView.Sort = "SapXep ASC";
                     if (sds.Tables[0].Rows.Count > 0)
                     {
                         foreach (DataRow sdr in sds.Tables[0].Rows)
                         {
                             TableRow str = new TableRow();
                             TableCell std = new TableCell();
                             std.Style.Value = "padding-left:20px";
                             std.Text = "<a href=\"subcategory.aspx?mcid=" + dr["NhomSanPhamID"] + "&scid=" +
                                        sdr["NhomSanPhamID"] + "\">" + "+ " + sdr["TenNhomSanPham"] + "</a>";
                             str.Cells.Add(std);
                             tblDanhMuc.Rows.Add(str);
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.ToString());
     }
 }
Ejemplo n.º 9
0
    private void LoadMenu(int NhomChaID)
    {
        try
        {
            NhomSanPham nsp = new NhomSanPham();
            DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(NhomChaID);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                MenuItem mni = new MenuItem(
                    dr["TenNhomSanPham"].ToString(), dr["NhomSanPhamID"].ToString());

                LoadMenuItems(mni, int.Parse(dr["NhomSanPhamID"].ToString()));
                mni.NavigateUrl = "promotion.aspx?pcode=" + promotion_code + "&cid=" +
                                  dr["NhomSanPhamID"];

                mnuNhomSanPham.Items.Add(mni);
                ;
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("../message.aspx?msg=" + ex.ToString().Replace("\r\n", ""));
        }
    }
Ejemplo n.º 10
0
    private void LoadDanhMuc1()
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds;

        if (Cache["dm1"] == null)
        {
            ds = nsp.SelectNhomSanPhamByNhomChaID(0);
            Cache.Insert("dm1", ds);
        }
        else
        {
            ds = (DataSet) Cache["dm1"];
        }

        ddlDanhMuc1.DataSource = ds.Tables[0];
        ddlDanhMuc1.DataTextField = "TenNhomSanPham";
        ddlDanhMuc1.DataValueField = "NhomSanPhamID";
        ddlDanhMuc1.DataBind();

        ddlDanhMuc1.Items.Insert(0, "Tất cả");
        ddlDanhMuc1.Items[0].Value = "0";
    }
Ejemplo n.º 11
0
    private void loadSearchDropdown()
    {
        ddlDanhMuc.Items.Clear();
        NhomSanPham nhomsanpham = new NhomSanPham();
        DataSet ds = nhomsanpham.SelectNhomSanPhamByNhomChaID(0);

        ddlDanhMuc.Items.Insert(0, "Tất cả");
        ddlDanhMuc.Items[0].Value = "";

        int n = ddlDanhMuc.SelectedIndex;

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ListItem item = new ListItem("+ " + ds.Tables[0].Rows[i]["TenNhomSanPham"],
                                         ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString());
            ddlDanhMuc.Items.Add(item);
            DataSet subds =
                nhomsanpham.SelectNhomSanPhamByNhomChaID(int.Parse(ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString()));
            for (int j = 0; j < subds.Tables[0].Rows.Count; j++)
            {
                ListItem subitem = new ListItem("+.... " + subds.Tables[0].Rows[j]["TenNhomSanPham"],
                                                subds.Tables[0].Rows[j]["NhomSanPhamID"].ToString());
                ddlDanhMuc.Items.Add(subitem);
            }
        }

        //NhomSanPham nsp = new NhomSanPham();
        //DataSet dsnsp = nsp.SelectAll();

        //ddlDanhMuc.DataSource = dsnsp.Tables[0];
        //ddlDanhMuc.DataTextField = "TenNhomSanPham";
        //ddlDanhMuc.DataValueField = "NhomSanPhamID";
        //ddlDanhMuc.DataBind();
        //ddlDanhMuc.Items.Insert(0, "Tất cả");
        //ddlDanhMuc.Items[0].Value = "";

        HangSanXuat hangsanxuat = new HangSanXuat();
        DataSet dsHangSanXuat = hangsanxuat.SelectAll();
        if (Cache["hsx"] == null)
        {
            dsHangSanXuat = hangsanxuat.SelectAll();
            Cache.Insert("hsx", dsHangSanXuat);
        }
        else
        {
            dsHangSanXuat = (DataSet) Cache["hsx"];
        }
        DataTable dtHangSanXuat = dsHangSanXuat.Tables[0];

        ddlHangSanXuat.DataSource = dtHangSanXuat;
        ddlHangSanXuat.DataTextField = "TenHangSanXuat";
        ddlHangSanXuat.DataValueField = "HangSanXuatID";
        ddlHangSanXuat.DataBind();

        KhuVuc khuvuc = new KhuVuc();
        DataSet dsKhuVuc;

        if (Cache["kv"] == null)
        {
            dsKhuVuc = khuvuc.SelectAll();
            Cache.Insert("kv", dsKhuVuc);
        }
        else
        {
            dsKhuVuc = (DataSet) Cache["kv"];
        }

        DataTable dtKhuVuc = dsKhuVuc.Tables[0];

        ddlKhuVuc.DataSource = dtKhuVuc;
        ddlKhuVuc.DataTextField = "TenKhuVuc";
        ddlKhuVuc.DataValueField = "KhuVucID";
        ddlKhuVuc.DataBind();
    }
Ejemplo n.º 12
0
 private bool CheckNhomCon()
 {
     NhomSanPham nsp = new NhomSanPham();
     DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(
         int.Parse("0" + ddlNhomSanPham.SelectedValue));
     if (ds.Tables[0].Rows.Count > 0)
         return false;
     else
         return true;
 }
Ejemplo n.º 13
0
 private void LoadSanPham04()
 {
     //LoadDanhMuc04
     NhomSanPham nsp = new NhomSanPham();
     DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0);
     DataRow[] dr = ds.Tables[0].Select("Show=true");
     int n = 4;
     if (dr.Length < 4) n = dr.Length;
     TableRow tr = new TableRow();
     for (int i = 0; i < n; i++)
     {
         if ((!Page.IsPostBack && i == 0) || hidCatId.Value == "0")
             hidCatId.Value = dr[0]["NhomSanPhamID"].ToString();
         TableCell td = new TableCell();
         td.Width = Unit.Percentage(100/n);
         if (hidCatId.Value.Trim().Length > 0)
         {
             if (dr[i]["NhomSanPhamID"].ToString() == hidCatId.Value)
             {
                 string content = "";
                 content += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
                 content +=
                     "<tr><td width=\"12\"><img src=\"./images/left_tab.jpg\" width=\"12\" height=\"28\" /></td>";
                 content += "<td style=\"background-color:#AFAFAF;\" class=\"tab_active\">" + dr[i]["TenNhomSanPham"] +
                            "</td>";
                 content +=
                     "<td width=\"12\"><img src=\"./images/right_tab.jpg\" width=\"12\" height=\"28\" /></td></tr></table>";
                 td.VerticalAlign = VerticalAlign.Bottom;
                 td.Text = content;
                 tr.Cells.Add(td);
                 //LoadSanPham04
                 SanPham sp = new SanPham();
                 DataSet sds = sp.SelectSanPhamAtViTriSanPhamInNhomSanPhamID(4,
                                                                             int.Parse(
                                                                                 dr[i]["NhomSanPhamID"].ToString()));
                 int sn = sds.Tables[0].Rows.Count;
                 for (int j = 0; j < 2; j++)
                 {
                     TableRow str = new TableRow();
                     for (int si = 0; si < 6; si++)
                     {
                         TableCell std = new TableCell();
                         string scontent = "";
                         if (j*6 + si < sn)
                         {
                             scontent +=
                                 "<table class=\"product\" width=\"100%\" border=\"0\" cellspacing=\"4\" cellpadding=\"0\">";
                             scontent += "<tr><td align=\"center\"><a href=\"productdetail.aspx?id=" +
                                         sds.Tables[0].Rows[j*6 + si]["SanPhamID"]
                                         + "\"><img src=\"" + sds.Tables[0].Rows[j*6 + si]["AnhSanPham"]
                                         +
                                         "\" alt=\"\" width=\"99\" height=\"89\" border=\"0\" style=\"border:#CCCCCC 1px solid\" /></a></td>";
                             scontent += "</tr><tr><td align=\"center\"><a href=\"productdetail.aspx?id=" +
                                         sds.Tables[0].Rows[j*6 + si]["SanPhamID"]
                                         + "\">" + sds.Tables[0].Rows[j*6 + si]["TenSanPham"]
                                         + "</a><br />";
                             scontent += "Giá: <span class=\"price\">" +
                                         String.Format("{0:0,0}", sds.Tables[0].Rows[j*6 + si]["GiaSanPham"]).Replace
                                             (",", ".")
                                         + "</span><br/>" + sds.Tables[0].Rows[j*6 + si]["DonViTienTe"] +
                                         "</td></tr></table>";
                         }
                         std.Text = scontent;
                         if (j == 0) std.Width = Unit.Percentage(16);
                         str.Cells.Add(std);
                     }
                     tblSanPham04.Rows.Add(str);
                 }
             }
             else
             {
                 string content = "<a href=\"javascript:RefreshProduct04(" + dr[i]["NhomSanPhamID"] + ")\">" +
                                  dr[i]["TenNhomSanPham"] + "</a>";
                 td.CssClass = "tab_noactive";
                 td.Text = content;
                 tr.Cells.Add(td);
             }
         }
         else
         {
             td.Text = "Selected Tab parameter is misisng!";
             tr.Cells.Add(td);
         }
     }
     tblDanhMuc04.Rows.Add(tr);
 }
Ejemplo n.º 14
0
    private void loadSearchDropdown()
    {
        ddlDanhMuc.Items.Clear();
        NhomSanPham nhomsanpham = new NhomSanPham();
        DataSet ds = nhomsanpham.SelectNhomSanPhamByNhomChaID(0);

        ddlDanhMuc.Items.Insert(0, "Tất cả");
        ddlDanhMuc.Items[0].Value = "";

        int n = ddlDanhMuc.SelectedIndex;

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ListItem item = new ListItem("+ " + ds.Tables[0].Rows[i]["TenNhomSanPham"],
                                         ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString());
            ddlDanhMuc.Items.Add(item);
            DataSet subds =
                nhomsanpham.SelectNhomSanPhamByNhomChaID(int.Parse(ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString()));
            for (int j = 0; j < subds.Tables[0].Rows.Count; j++)
            {
                ListItem subitem = new ListItem("+.... " + subds.Tables[0].Rows[j]["TenNhomSanPham"],
                                                subds.Tables[0].Rows[j]["NhomSanPhamID"].ToString());
                ddlDanhMuc.Items.Add(subitem);
            }
        }

        HangSanXuat hsx = new HangSanXuat();
        DataSet dshsx = hsx.SelectAll();

        ddlHangSanXuat.DataSource = dshsx.Tables[0];
        ddlHangSanXuat.DataTextField = "TenHangSanXuat";
        ddlHangSanXuat.DataValueField = "HangSanXuatID";
        ddlHangSanXuat.DataBind();
        ddlHangSanXuat.Items.Insert(0, "Tất cả");
        ddlHangSanXuat.Items[0].Value = "";

        KhuVuc kv = new KhuVuc();
        DataSet dskv = kv.SelectAll();

        ddlKhuVuc.DataSource = dskv.Tables[0];
        ddlKhuVuc.DataTextField = "TenKhuVuc";
        ddlKhuVuc.DataValueField = "KhuVucID";
        ddlKhuVuc.DataBind();
        ddlKhuVuc.Items.Insert(0, "Tất cả");
        ddlKhuVuc.Items[0].Value = "";
    }
Ejemplo n.º 15
0
    private void LoadUltraMenuItems(Item mi, int NhomSanPhamID)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(NhomSanPhamID);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            Item mni = new Item();
            mni.Text = dr["TenNhomSanPham"].ToString().Length > 25
                           ? dr["TenNhomSanPham"].ToString().Substring(0, 25) + "..."
                           : dr["TenNhomSanPham"].ToString();
            mni.Tag = dr["NhomSanPhamID"].ToString();
            //mni.ToolTip = dr["TenNhomSanPham"].ToString();
            LoadUltraMenuItems(mni, int.Parse(dr["NhomSanPhamID"].ToString()));
            mni.TargetUrl = "EstoreHome.aspx?cid=" + dr["NhomSanPhamID"];
            mi.Items.Add(mni);
        }
    }
Ejemplo n.º 16
0
    private void LoadUltraMenu(int NhomChaID)
    {
        try
        {
            NhomSanPham nsp = new NhomSanPham();
            DataSet ds;

            if (Cache["nsp" + NhomChaID] == null)
            {
                ds = nsp.SelectNhomSanPhamByNhomChaID(NhomChaID);
                Cache["nsp" + NhomChaID] = ds;
            }
            else
            {
                ds = (DataSet) Cache["nsp" + NhomChaID];
            }

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Item mni = new Item();
                mni.Text = dr["TenNhomSanPham"].ToString().Length > 20
                               ? dr["TenNhomSanPham"].ToString().Substring(0, 20) + "..."
                               : dr["TenNhomSanPham"].ToString();
                mni.Tag = dr["NhomSanPhamID"].ToString();
                //mni.ToolTip = dr["TenNhomSanPham"].ToString();

                LoadUltraMenuItems(mni, int.Parse(dr["NhomSanPhamID"].ToString()));
                mni.TargetUrl = "EstoreHome.aspx?cid=" +
                                dr["NhomSanPhamID"];
                uwmMenu.Items.Add(mni);
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("../message.aspx?msg=" + ex.ToString().Replace("\r\n", ""));
        }
    }
Ejemplo n.º 17
0
    private void LoadMenuItems(MenuItem mi, int NhomSanPhamID)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(NhomSanPhamID);

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            MenuItem mni = new MenuItem(
                dr["TenNhomSanPham"].ToString().Length > 30
                    ? dr["TenNhomSanPham"].ToString().Substring(0, 30) + "..."
                    : dr["TenNhomSanPham"].ToString(),
                dr["NhomSanPhamID"].ToString());
            //mni.ToolTip = dr["TenNhomSanPham"].ToString();

            LoadMenuItems(mni, int.Parse(dr["NhomSanPhamID"].ToString()));
            mni.NavigateUrl = "subcategory.aspx?mcid=" + NhomSanPhamID + "&scid=" +
                              dr["NhomSanPhamID"];
            mi.ChildItems.Add(mni);
        }
    }
Ejemplo n.º 18
0
    private void LoadMenu(int NhomChaID)
    {
        try
        {
            NhomSanPham nsp = new NhomSanPham();
            DataSet ds;

            if (Cache["nsp" + NhomChaID] == null)
            {
                ds = nsp.SelectNhomSanPhamByNhomChaID(NhomChaID);
                Cache["nsp" + NhomChaID] = ds;
            }
            else
            {
                ds = (DataSet) Cache["nsp" + NhomChaID];
            }

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                MenuItem mni = new MenuItem(
                    dr["TenNhomSanPham"].ToString().Length > 30
                        ? dr["TenNhomSanPham"].ToString().Substring(0, 30) + "..."
                        : dr["TenNhomSanPham"].ToString(),
                    dr["NhomSanPhamID"].ToString());
                //mni.ToolTip = dr["TenNhomSanPham"].ToString();

                LoadMenuItems(mni, int.Parse(dr["NhomSanPhamID"].ToString()));
                mni.NavigateUrl = "subcategory.aspx?mcid=" + NhomChaID + "&scid=" +
                                  dr["NhomSanPhamID"];
                mnuNhomSanPham.Items.Add(mni);
                ;
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("../message.aspx?msg=" + ex.ToString().Replace("\r\n", ""));
        }
    }
Ejemplo n.º 19
0
    private void LoadDanhMuc1()
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0);

        ddlDanhMuc1.DataSource = ds.Tables[0];
        ddlDanhMuc1.DataTextField = "TenNhomSanPham";
        ddlDanhMuc1.DataValueField = "NhomSanPhamID";
        ddlDanhMuc1.DataBind();

        ddlDanhMuc1.Items.Insert(0, "Tất cả");
        ddlDanhMuc1.Items[0].Value = "0";

        if (Request.QueryString["cid"] != null)
        {
            ddlDanhMuc1.SelectedValue = Request.QueryString["cid"];
            ddlDanhMuc1.Enabled = false;
        }
        else
            ddlDanhMuc1.Enabled = true;
    }
Ejemplo n.º 20
0
    private void LoadNhomSanPham()
    {
        NhomSanPham nhomsanpham = new NhomSanPham();

        DataSet ds = nhomsanpham.SelectNhomSanPhamByNhomChaID(0);

        ddlNhomSanPham.Items.Insert(0, "Danh mục sản phẩm");
        ddlNhomSanPham.Items[0].Value = "0";

        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            ListItem item = new ListItem("+ " + ds.Tables[0].Rows[i]["TenNhomSanPham"],
                                         ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString());
            ddlNhomSanPham.Items.Add(item);
            DataSet subds =
                nhomsanpham.SelectNhomSanPhamByNhomChaID(int.Parse(ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString()));
            for (int j = 0; j < subds.Tables[0].Rows.Count; j++)
            {
                ListItem subitem = new ListItem("+.... " + subds.Tables[0].Rows[j]["TenNhomSanPham"],
                                                subds.Tables[0].Rows[j]["NhomSanPhamID"].ToString());
                ddlNhomSanPham.Items.Add(subitem);
            }
        }
    }
Ejemplo n.º 21
0
 private void LoadDanhMuc()
 {
     NhomSanPham nsp = new NhomSanPham();
     DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0);
     ds.Tables[0].DefaultView.Sort = "SapXep ASC";
     if (ds.Tables[0].Rows.Count > 0)
     {
         //Set default category
         if (mcid == 0) mcid = int.Parse(ds.Tables[0].Rows[0]["NhomSanPhamID"].ToString());
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             TableRow tr = new TableRow();
             TableCell td = new TableCell();
             td.Text = "<a href=\"cat1config.aspx?mcid=" + dr["NhomSanPhamID"] + "\">" + dr["TenNhomSanPham"] +
                       "</a>";
             tr.Cells.Add(td);
             tblDanhMuc.Rows.Add(tr);
         }
     }
 }
Ejemplo n.º 22
0
    private void LoadDanhMuc1()
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds = nsp.SelectNhomSanPhamByNhomChaID(0);

        ddlDanhMuc1.DataSource = ds.Tables[0];
        ddlDanhMuc1.DataTextField = "TenNhomSanPham";
        ddlDanhMuc1.DataValueField = "NhomSanPhamID";
        ddlDanhMuc1.DataBind();

        ddlDanhMuc1.Items.Insert(0, "Tất cả");
        ddlDanhMuc1.Items[0].Value = "0";
    }