Beispiel #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());
        }
    }
Beispiel #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int firstCatId = 0;
        foreach (UltraGridRow row in grdCat.Rows)
        {
            int id = int.Parse(row.Cells.FromKey("NhomSanPhamID").Value.ToString());
            NhomSanPham nsp = new NhomSanPham();
            if (Request.QueryString["rid"] != null)
            {
                int rid = int.Parse(Request.QueryString["rid"]);
                if (bool.Parse(row.Cells.FromKey("Selected").Text))
                    nsp.UpdateFields(id, null, null, null, null, null, null, null, null, null, null, rid);
                else
                    nsp.UpdateFields(id, null, null, null, null, null, null, null, null, null, null, 0);
            }
            else
            {
                nsp.UpdateFields(id, null, null, null, bool.Parse(row.Cells.FromKey("Selected").Text), null, null, null,
                                 null, null, null, null);
            }

            if (firstCatId == 0)
            {
                if (bool.Parse(row.Cells.FromKey("Selected").Text)) firstCatId = id;
            }
        }
        Cache.Remove("dmnsp");
        string strScript = "<script language='JavaScript'>" + "window.parent.RefreshProduct04(" + firstCatId +
                           ");</script>";
        ClientScript.RegisterStartupScript(GetType(), "Refresh", strScript);
    }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Common.LoaiNguoiDungID() == 3)
     {
         if (!Page.IsPostBack)
         {
             if (Request.QueryString["mcid"] != null)
             {
                 mcid = int.Parse(Request.QueryString["mcid"]);
             }
             LoadDanhMuc();
             //LoadQuangCao11();
             LoadQuangCao12();
             LoadQuangCao13();
             LoadSanPham11();
             LoadSanPham12();
             LoadSanPham13();
             LoadSanPham14();
             LoadGianHang();
             NhomSanPham nsp = new NhomSanPham();
             DataSet ds = nsp.SelectByID(mcid);
             if (ds.Tables[0].Rows.Count == 1) lblDanhMuc.Text = ds.Tables[0].Rows[0]["TenNhomSanPham"].ToString();
             hidCatId.Value = mcid.ToString();
         }
         else
         {
             mcid = int.Parse(hidCatId.Value);
         }
     }
     else
     {
         Response.Redirect("../message.aspx?msg=Access denied");
     }
 }
Beispiel #4
0
    private void LoadNhomSanPham(int nhomsanphamid)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds1 = nsp.SelectByID(nhomsanphamid);

        if (ds1.Tables[0].Rows.Count > 0)
            txtDanhMucSanPham.Text = ds1.Tables[0].Rows[0]["TenNhomSanPham"].ToString();
    }
 private void LoadDanhMuc(int CuaHangid, int NhomChaID)
 {
     NhomSanPham nsp = new NhomSanPham();
     DataSet ds = nsp.SelectNhomSanPhamNotInCuaHangbyCuaHangID(CuaHangid, NhomChaID);
     DataRow[] selectedRows = ds.Tables[0].Select("Show=true");
     grdCat.DataSource = ds;
     grdCat.DataBind();
     //return selectedRows.Length;
 }
    private void BindToGrid()
    {
        NhomSanPham nsp = new NhomSanPham();

        DataSet ds = nsp.SelectNhomSanPhamByCuaHangID(CuaHangID);

        grvNhomSanPham.DataSource = ds.Tables[0];
        grvNhomSanPham.DataBind();
    }
Beispiel #7
0
    protected void tmDanhMuc_Tick(object sender, EventArgs e)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds;

        ds = nsp.SelectRanDomNhomSanPhamShowed();
        if (Cache["dmnsp"] != null)
            Cache.Remove("dmnsp");
        Cache["dmnsp"] = ds;

        LoadSanPham04();
    }
    protected void btnLuu_Click(object sender, EventArgs e)
    {
        try
        {
            if (Common.LoaiNguoiDungID() == 3)
            {
                NhomSanPham nhomsanpham = new NhomSanPham();
                if (Request.QueryString["subid"] == null)
                {
                    nhomsanpham.InsertFields(txtTenNhomCon.Text, null, Convert.ToInt32(Request.QueryString["id"]), false,
                                             Convert.ToInt32(txtThuTu.Text), null, null, null, null, null, null);
                }
                else
                {
                    nhomsanpham.UpdateFields(Convert.ToInt32(Request.QueryString["subid"]), txtTenNhomCon.Text, null,
                                             Convert.ToInt32(Request.QueryString["id"]), null,
                                             Convert.ToInt32(txtThuTu.Text), null, null, null, null, null, null);
                }
            }
            else if (Common.LoaiNguoiDungID()==2)
            {
                NhomSanPhamCuaHang nhomsanpham = new NhomSanPhamCuaHang();
                CuaHangNhomSanPham chnsp = new CuaHangNhomSanPham();
                if (Request.QueryString["id"] == null)
                {
                    int chnspid = chnsp.InsertFields(int.Parse(CuaHangID), int.Parse(ddlNhomSanPham.SelectedValue), null);
                    nhomsanpham.InsertFields(Convert.ToInt32(Request.QueryString["pid"]), int.Parse(ddlNhomSanPham.SelectedValue)
                        , Convert.ToInt32(txtThuTu.Text), int.Parse(CuaHangID), txtTenNhomCon.Text, chnspid);

                }
                else
                {
                    NhomSanPhamCuaHang nsp = new NhomSanPhamCuaHang();
                    DataSet ds = nsp.SelectByID(int.Parse(Request["id"]));
                    int chnspid = int.Parse("0" + ds.Tables[0].Rows[0]["CuaHangNhomSanPhamID"].ToString());
                    //chnsp.UpdateFields();
                    nhomsanpham.UpdateFields(Convert.ToInt32(Request.QueryString["id"]),
                                             null, int.Parse(ddlNhomSanPham.SelectedValue),
                                             Convert.ToInt32(txtThuTu.Text), null, txtTenNhomCon.Text,null);
                    chnsp.UpdateFields(chnspid,int.Parse(CuaHangID),int.Parse(ddlNhomSanPham.SelectedValue),null);
                }
            }
            string strScript = "<script language='JavaScript'>" + "window.parent.RefreshCat();</script>";
            ClientScript.RegisterStartupScript(GetType(), "Refresh", strScript);
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Beispiel #9
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;
 }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["pcode"] != null)
     {
         promotion_code = Request.QueryString["pcode"];
         if (Request.QueryString["cid"] != null)
         {
             try
             {
                 catid = int.Parse(Request.QueryString["cid"]);
                 NhomSanPham nsp = new NhomSanPham();
                 DataSet ds = nsp.SelectByID(catid);
                 if (ds.Tables[0].Rows.Count >= 0)
                 {
                     lblCatName.Text = "&gt;&nbsp;" + ds.Tables[0].Rows[0]["TenNhomSanPham"];
                 }
             }
             catch (Exception ex)
             {
                 Response.Redirect("./message.aspx?msg=" + ex.Message);
             }
         }
     }
     else
     {
         Response.Redirect("./message.aspx?msg=Invalid parameter");
     }
     if (!Page.IsPostBack)
     {
         //LoadDanhMuc();
         LoadMenu(0);
         if (promotion_code == "moi" || promotion_code == "km" || promotion_code == "gg" || promotion_code == "uc")
         {
             if (Request.QueryString["cid"] != null)
             {
                 LoadSanPham(promotion_code, catid, 1);
             }
             else
             {
                 LoadSanPham(promotion_code, 0, 1);
             }
         }
         else
         {
             Response.Redirect("./message.aspx?msg=Invalid parameter");
         }
     }
 }
Beispiel #11
0
 protected void btnLuu_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtTenNhomSanPham.Text.Trim() != "")
         {
             if (Common.LoaiNguoiDungID() == 3)
             {
                 NhomSanPham nhomsanpham = new NhomSanPham();
                 if (Request.QueryString["id"] == null)
                 {
                     nhomsanpham.InsertFields(txtTenNhomSanPham.Text, "", 0, false, Convert.ToInt32(txtThuTu.Text), null,
                                              null, null, null, null, null);
                 }
                 else
                 {
                     nhomsanpham.UpdateFields(Convert.ToInt32(Request.QueryString["id"]),
                                              txtTenNhomSanPham.Text, null, null, null, Convert.ToInt32(txtThuTu.Text),
                                              null, null, null, null, null, null);
                 }
                 Cache.Remove("dm1");
             }
             else if (Common.LoaiNguoiDungID() == 2)
             {
                 NhomSanPhamCuaHang nhomsanpham = new NhomSanPhamCuaHang();
                 if (Request.QueryString["id"] == null)
                 {
                     nhomsanpham.InsertFields( 0, 0, int.Parse("0" + txtThuTu.Text),int.Parse(cuahangid),txtTenNhomSanPham.Text,null);
                 }
                 else
                 {
                     nhomsanpham.UpdateFields(Convert.ToInt32(Request.QueryString["id"]),
                                               null, null, int.Parse("0" + txtThuTu.Text), null, txtTenNhomSanPham.Text,null);
                 }
             }
             string strScript = "<script language='JavaScript'>" + "window.parent.RefreshCat();</script>";
             ClientScript.RegisterStartupScript(GetType(), "Refresh", strScript);
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.ToString());
     }
 }
Beispiel #12
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;
        }
    }
Beispiel #13
0
    private void LoadUltraMenu()
    {
        NhomSanPham nsp = new NhomSanPham();

        //get Nhomsanpham
        DataSet ds;

        if (Cache["Menu"] == null)
        {
            ds = nsp.SelectAllNhomSanPhamByLevel();
            Cache["menu"] = ds;
        }
        else
        {
            ds = (DataSet) Cache["menu"];
        }

            ds.Relations.Add("menu", ds.Tables[0].Columns["NhomSanPhamID"],
                ds.Tables[1].Columns["NhomChaID"], false);
        ds.Relations.Add("menucon", ds.Tables[1].Columns["NhomSanPhamID"],
            ds.Tables[2].Columns["NhomChaID"], false);
        //ds.WriteXml(Server.MapPath("." + "\\menu.xml"), XmlWriteMode.WriteSchema);
        //ds.WriteXml(Server.MapPath(".") + "\\menu.xml");
        //
        //DataView dv = ds1.Tables[0].DefaultView;
        uwmMenu.DataSource = ds;

        uwmMenu.Levels[0].ColumnName = "TenNhomSanPham";
        // this.uwmMenu.Levels[i].LevelImage = "../../../ig_common/images/dir.png";
        uwmMenu.Levels[0].RelationName = "menu";
        uwmMenu.Levels[0].LevelKeyField = "NhomSanPhamID";
        uwmMenu.Levels[0].TargetUrlName = "TargetUrl";

        uwmMenu.Levels[1].ColumnName = "TenNhomSanPham";
        // this.uwmMenu.Levels[i].LevelImage = "../../../ig_common/images/dir.png";
        uwmMenu.Levels[1].RelationName = "menucon";
        uwmMenu.Levels[1].LevelKeyField = "NhomSanPhamID";
        uwmMenu.Levels[1].TargetUrlName = "TargetUrl";

        uwmMenu.Levels[2].ColumnName = "TenNhomSanPham";
        // this.uwmMenu.Levels[i].LevelImage = "../../../ig_common/images/dir.png";
        //uwmMenu.Levels[1].RelationName = "con";
        uwmMenu.Levels[2].TargetUrlName = "TargetUrl";
        uwmMenu.Levels[2].LevelKeyField = "NhomSanPhamID";

        uwmMenu.DataMember = ds.Tables[0].TableName;
        uwmMenu.DataBind();
    }
Beispiel #14
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);
 }
Beispiel #15
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;
    }
Beispiel #16
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());
        }
    }
 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;
 }
Beispiel #18
0
    //private void LoadQuangCao41()
    //{
    //QuangCao qcao = new QuangCao();
    //DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByNguoiDungID(int.Parse(ViewState["NguoiDungID"].ToString()), 41);
    //HtmlGenericControl spnQuangCao41 = (HtmlGenericControl)this.Master.FindControl("spnQuangCao01");
    //if (ds.Tables[0].Rows.Count >= 1)
    //{
    //    if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
    //    {
    //        spnQuangCao41.InnerHtml = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
    //            + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
    //            + "width=\"210\" height=\"75\" title=\"Quang Cao\">"
    //            + "<param name=\"movie\" value=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"].ToString() + "\" />"
    //            + "<param name=\"quality\" value=\"high\" />"
    //            + "<embed src=\"." + ds.Tables[0].Rows[0]["DuongDanAnh"].ToString() + "\" quality=\"high\""
    //            + "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
    //            + "width=\"210\" height=\"75\"></embed></object>";
    //    }
    //    else
    //    {
    //        spnQuangCao41.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"].ToString()
    //            + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[0]["NoiDungQuangCao"].ToString()
    //            + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"].ToString() + "\" height=\"75px\" width=\"210px\" style=\"Border:none\"/></a>";
    //    }
    //}
    //else
    //{
    //    spnQuangCao41.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"75px\" width=\"210px\" style=\"border:none\"/>";
    //}
    //}
    //private void LoadQuangCao42()
    //{
    //QuangCao qcao = new QuangCao();
    //DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByNguoiDungID(int.Parse(ViewState["NguoiDungID"].ToString()), 42);
    //int n = ds.Tables[0].Rows.Count;
    //spnQuangCao42a.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"312px\" style=\"border:solid 1px #C9C3C3\"/>";
    //spnQuangCao42b.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"312px\" style=\"border:solid 1px #C9C3C3\"/>";
    //spnQuangCao42c.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"312px\" style=\"border:solid 1px #C9C3C3\"/>";
    //if (n >= 1)
    //{
    //    if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
    //    {
    //        spnQuangCao42a.InnerHtml = "<object style=\"border:solid 1px #C9C3C3\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
    //            + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
    //            + "width=\"312\" height=\"122\" title=\"Quang Cao\">"
    //            + "<param name=\"movie\" value=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"].ToString() + "\" />"
    //            + "<param name=\"quality\" value=\"high\" />"
    //            + "<embed src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"].ToString() + "\" quality=\"high\""
    //            + "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
    //            + "width=\"312\" height=\"122\"></embed></object>";
    //    }
    //    else
    //    {
    //        spnQuangCao42a.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"].ToString()
    //          + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[0]["NoiDungQuangCao"].ToString()
    //          + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"].ToString() + "\" height=\"122px\" width=\"312px\" style=\"border:solid 1px #C9C3C3\"/></a>";
    //    }
    //    if (n >= 2)
    //    {
    //        if (ds.Tables[0].Rows[1]["LoaiAnh"].ToString() == "FLASH")
    //        {
    //            spnQuangCao42b.InnerHtml = "<object style=\"border:solid 1px #C9C3C3\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
    //                + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
    //                + "width=\"312\" height=\"122\" title=\"Quang Cao\">"
    //                + "<param name=\"movie\" value=\"" + ds.Tables[0].Rows[1]["DuongDanAnh"].ToString() + "\" />"
    //                + "<param name=\"quality\" value=\"high\" />"
    //                + "<embed src=\"" + ds.Tables[0].Rows[1]["DuongDanAnh"].ToString() + "\" quality=\"high\""
    //                + "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
    //                + "width=\"312\" height=\"122\"></embed></object>";
    //        }
    //        else
    //        {
    //            spnQuangCao42b.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[1]["DuongDan"].ToString()
    //              + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[1]["NoiDungQuangCao"].ToString()
    //              + "\" src=\"" + ds.Tables[0].Rows[1]["DuongDanAnh"].ToString() + "\" height=\"122px\" width=\"312px\" style=\"border:solid 1px #C9C3C3\"/></a>";
    //        }
    //        if (n >= 3)
    //        {
    //            if (ds.Tables[0].Rows[2]["LoaiAnh"].ToString() == "FLASH")
    //            {
    //                spnQuangCao42c.InnerHtml = "<object style=\"border:solid 1px #C9C3C3\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
    //                    + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
    //                    + "width=\"312\" height=\"122\" title=\"Quang Cao\">"
    //                    + "<param name=\"movie\" value=\"" + ds.Tables[0].Rows[2]["DuongDanAnh"].ToString() + "\" />"
    //                    + "<param name=\"quality\" value=\"high\" />"
    //                    + "<embed src=\"" + ds.Tables[0].Rows[2]["DuongDanAnh"].ToString() + "\" quality=\"high\""
    //                    + "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
    //                    + "width=\"312\" height=\"122\"></embed></object>";
    //            }
    //            else
    //            {
    //                spnQuangCao42c.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[2]["DuongDan"].ToString()
    //                  + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[2]["NoiDungQuangCao"].ToString()
    //                  + "\" src=\"" + ds.Tables[0].Rows[2]["DuongDanAnh"].ToString() + "\" height=\"122px\" width=\"312px\" style=\"border:solid 1px #C9C3C3\"/></a>";
    //            }
    //        }
    //    }
    //}
    //else
    //{
    //    tblQuangCao42.Visible = false;
    //}
    //}
    private void ShowLink(int NhomSanPhamId)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds2 = nsp.SelectByID(NhomSanPhamId);
        if (ds2.Tables[0].Rows.Count == 1)
        {
            lblDanhMucCon.Text = ds2.Tables[0].Rows[0]["TenNhomSanPham"].ToString();
        }

        DataSet ds1 = nsp.SelectByID(int.Parse(ds2.Tables[0].Rows[0]["NhomChaID"].ToString()));
        if (ds1.Tables[0].Rows.Count == 1)
        {
            lnkDanhMucCha.Text = ds1.Tables[0].Rows[0]["TenNhomSanPham"].ToString();
            lnkDanhMucCha.PostBackUrl = "maincategory.aspx?mcid=" + ds2.Tables[0].Rows[0]["NhomChaID"];
            lblArrow.Visible = true;
        }
        else
        {
            lblArrow.Visible = false;
        }
    }
Beispiel #19
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);
        }
    }
Beispiel #20
0
    private void LoadData(string Id)
    {
        try
        {
            NhomSanPham nhomsanpham = new NhomSanPham();
            DataSet ds = nhomsanpham.SelectByID(Convert.ToInt32(Id));

            if (ds.Tables[0].Rows.Count > 0)
            {
                txtTenNhomCon.Text = ds.Tables[0].Rows[0]["TenNhomSanPham"].ToString();
                txtThuTu.Text = ds.Tables[0].Rows[0]["SapXep"].ToString();
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }
Beispiel #21
0
    private void AddNhomSanPhamToCuaHang(int NhomSanPhamID, int CuaHangID)
    {
        CuaHangNhomSanPham chnsp = new CuaHangNhomSanPham();
        DataSet dschnsp = chnsp.SelectByNhomSanPhamCuaHangID(CuaHangID, NhomSanPhamID);

        if (dschnsp.Tables[0].Rows.Count <= 0)
        {
            chnsp.Insert(CuaHangID, NhomSanPhamID, "");

            NhomSanPham nsp = new NhomSanPham();
            DataSet ds = nsp.SelectByID(NhomSanPhamID);
            int NhomChaID = int.Parse(ds.Tables[0].Rows[0]["NhomChaID"].ToString());
            if (NhomChaID != 0)
                AddNhomSanPhamToCuaHang(NhomChaID, CuaHangID);
        }
    }
Beispiel #22
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);
        }
    }
    //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;
        }
    }
Beispiel #24
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", ""));
        }
    }
Beispiel #25
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);
            }
        }
    }
Beispiel #26
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);
         }
     }
 }
Beispiel #27
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";
    }
Beispiel #28
0
    private void LoadDanhMucConForDropDown(int NhomChaID, int CuaHangID, int loaddm)
    {
        NhomSanPham nsp = new NhomSanPham();
        DataSet ds = nsp.SelectNhomSanPhamByNhomChaAndCuaHangID(CuaHangID, NhomChaID);
        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;
        }

        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;

            LoadDanhMucConForDropDown(int.Parse(ds.Tables[0].Rows[i]["NhomSanPhamID"].ToString()), CuaHangID, loaddm);
        }
    }
Beispiel #29
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());
     }
 }
    private void LoadDanhMuc()
    {
        try
        {
            NhomSanPham nhomsanpham = new NhomSanPham();
            DataSet ds = nhomsanpham.SelectAll();
            ds.Tables[0].DefaultView.Sort = "SapXep ASC";

            //Table tbl = new Table();
            // tbl.CssClass = "ListCat";

            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("margin", "0");
                        //tbr.Style.Add("padding", "0");
                        //tbr.Style.Add("padding", "0");

                        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", "3%");
                        tbc2.InnerText = 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);
                        tbc5.Controls.Add(img3);

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

                        ds.Tables[0].DefaultView.RowFilter = "NhomChaID=" + dr["NhomSanPhamID"];
                        DataView dv = ds.Tables[0].DefaultView;

                        if (dv.Count > 0)
                        {
                            img2.Disabled = true;
                        }
                        tblDanhMuc.Rows.Add(tbr);

                        for (int i = 0; i < dv.Count; i++)
                        {
                            HtmlTableRow tvr = new HtmlTableRow();

                            HtmlTableCell tvc1 = new HtmlTableCell();
                            HtmlTableCell tvc2 = new HtmlTableCell();
                            HtmlTableCell tvc3 = new HtmlTableCell();
                            HtmlTableCell tvc4 = new HtmlTableCell();
                            HtmlTableCell tvc5 = new HtmlTableCell();
                            //HtmlTableCell tvc6 = new HtmlTableCell();

                            HtmlImage imgv1 = new HtmlImage();
                            HtmlImage imgv2 = new HtmlImage();

                            tvc4.Style.Add("padding", "0");
                            tvc4.Style.Add("margin", "0");
                            tvc5.Style.Add("padding", "0");
                            tvc5.Style.Add("margin", "0");
                            tvc4.Style.Add("cursor", "hand");
                            tvc5.Style.Add("cursor", "hand");

                            //HtmlImage img3 = new HtmlImage();
                            imgv1.Src = "../images/Edit.gif";
                            imgv2.Src = "../images/Delete.gif";
                            imgv1.Attributes.Add("onclick", "EditSub(" + dr["NhomSanPhamID"] + ",'" +
                                                            dr["TenNhomSanPham"] + "'," + dv[i]["NhomSanPhamID"] + ");");
                            imgv2.Attributes.Add("onclick", "Delete(" + dv[i]["NhomSanPhamID"] + ");");
                            //img3.Src = "../images/AddSub.gif";
                            imgv1.Alt = "Sửa danh mục con";
                            imgv2.Alt = "Xóa danh mục con";

                            tvc4.Controls.Add(imgv1);
                            tvc5.Controls.Add(imgv2);
                            //tbc5.Controls.Add(img3);

                            tvr.Cells.Add(tvc1);
                            tvr.Cells.Add(tvc2);
                            tvr.Cells.Add(tvc3);
                            tvr.Cells.Add(tvc4);
                            tvr.Cells.Add(tvc5);
                            //tvr.Cells.Add(tvc6);

                            tvc3.InnerText = dv[i]["SapXep"] + "." + dv[i]["TenNhomSanPham"];
                            tblDanhMuc.Rows.Add(tvr);
                        }
                    }
                }
            }
            //tblDanhMuc.Controls.Add(tbl);
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }