Exemple #1
0
 private void LoadQuangCaoByNguoiDungID(int NguoiDungID)
 {
     QuangCao qcao = new QuangCao();
     DataSet ds = qcao.SelectByNguoiDungID(NguoiDungID);
     grdAdv.DataSource = ds;
     grdAdv.DataBind();
 }
Exemple #2
0
 private void LoadQuangCao23()
 {
     QuangCao qcao = new QuangCao();
     DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByLoaiNguoiDungID(Common.LoaiNguoiDungID(), 23);
     if (ds.Tables[0].Rows.Count >= 1)
     {
         if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
         {
             spnQuangCao23.InnerHtml = "<object 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=\"100%\" height=\"216\" title=\"Quang Cao\">"
                                       + "<param name=\"movie\" value=\"." + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                       "\" />"
                                       + "<param name=\"quality\" value=\"high\" />"
                                       + "<embed src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                       "\" quality=\"high\""
                                       +
                                       "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                       + "width=\"100%\" height=\"216\"></embed></object>";
         }
         else
         {
             spnQuangCao23.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"]
                                       + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[0]["NoiDungQuangCao"]
                                       + "\" src=\"." + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                       "\" height=\"216px\" width=\"100%\" style=\"border:solid 1px #C9C3C3\"/></a>";
         }
     }
     else
     {
         spnQuangCao23.InnerHtml =
             "<img alt=\"Moi quang cao\" src=\"../images/advblank.jpg\" height=\"216px\" width=\"596px\" style=\"border:none\"/>";
     }
 }
Exemple #3
0
    private void LoadQuangCao22()
    {
        QuangCao qcao = new QuangCao();
        DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByLoaiNguoiDungID(Common.LoaiNguoiDungID(), 22);
        int n = 4;
        if (ds.Tables[0].Rows.Count <= 4) n = ds.Tables[0].Rows.Count;

        for (int i = 0; i < n; i++)
        {
            TableRow tr = new TableRow();
            TableCell td = new TableCell();
            td.Style.Value = "padding-top: 4px;";
            string content = "";
            if (ds.Tables[0].Rows[i]["LoaiAnh"].ToString() == "FLASH")
            {
                content = "<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=\"220\" height=\"155\" title=\"Quang Cao\">"
                          + "<param name=\"movie\" value=\"." + ds.Tables[0].Rows[i]["DuongDanAnh"] + "\" />"
                          + "<param name=\"quality\" value=\"high\" />"
                          + "<embed src=\"." + ds.Tables[0].Rows[i]["DuongDanAnh"] + "\" quality=\"high\""
                          +
                          "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                          + "width=\"220\" height=\"155\"></embed></object></a>";
            }
            else
            {
                content = "<a href=\"" + ds.Tables[0].Rows[i]["DuongDan"]
                          + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[i]["NoiDungQuangCao"]
                          + "\" src=\"." + ds.Tables[0].Rows[i]["DuongDanAnh"]
                          + "\" style=\"border:solid 1px #C9C3C3; width:220px;\">";
            }
            td.Text = content;
            tr.Cells.Add(td);
            tblQuangCao22.Rows.Add(tr);
        }
    }
Exemple #4
0
 private int LoadQuangCaoByKhuVuc(int ViTriQuangCao, int KhuVucID)
 {
     if (Common.LoaiNguoiDungID() == 3)
     {
         //For administrator
         QuangCao qcao = new QuangCao();
         DataSet ds = qcao.SelectAllQuangCaoAtViTriQuangCaoByLoaiNguoiDungID(Common.LoaiNguoiDungID(), ViTriQuangCao);
         ds.Tables[0].Columns.Add("Selected", Type.GetType("System.String"));
         ds.Tables[0].Columns["Selected"].DefaultValue = "false";
         DataRow[] selectedRows = ds.Tables[0].Select("ViTriQuangCao=" + ViTriQuangCao + " AND KhuVucID=" + KhuVucID);
         for (int i = 0; i < selectedRows.Length; i++)
         {
             selectedRows[i]["Selected"] = "true";
         }
         ds.Tables[0].DefaultView.Sort = "QuangCaoID DESC";
         grdAdv.DataSource = ds.Tables[0].DefaultView;
         grdAdv.DataBind();
         return selectedRows.Length;
     }
     else if (Common.LoaiNguoiDungID() == 2)
     {
         //For e-store manager
         QuangCao qcao = new QuangCao();
         DataSet ds = qcao.SelectAllQuangCaoAtViTriQuangCaoByNguoiDungID(Common.NguoiDungID(), ViTriQuangCao);
         ds.Tables[0].Columns.Add("Selected", Type.GetType("System.String"));
         ds.Tables[0].Columns["Selected"].DefaultValue = "false";
         DataRow[] selectedRows = ds.Tables[0].Select("ViTriQuangCao=" + ViTriQuangCao + " AND KhuVucID=" + KhuVucID);
         for (int i = 0; i < selectedRows.Length; i++)
         {
             selectedRows[i]["Selected"] = "true";
         }
         ds.Tables[0].DefaultView.Sort = "QuangCaoID DESC";
         grdAdv.DataSource = ds.Tables[0].DefaultView;
         grdAdv.DataBind();
         return selectedRows.Length;
     }
     return 0;
 }
Exemple #5
0
 private int LoadQuangCao(int ViTriQuangCao, int NhomSanPhamID)
 {
     if (Common.LoaiNguoiDungID() == 3)
     {
         //For administrator (11, 12, 13)
         QuangCao qcao = new QuangCao();
         DataSet ds = qcao.SelectAllQuangCaoAtViTriQuangCaoByNhomSanPhamID(NhomSanPhamID, ViTriQuangCao);
         ds.Tables[0].Columns.Add("Selected", Type.GetType("System.String"));
         ds.Tables[0].Columns["Selected"].DefaultValue = "false";
         DataRow[] selectedRows = ds.Tables[0].Select("KhuVucID is null AND ViTriQuangCao=" + ViTriQuangCao);
         for (int i = 0; i < selectedRows.Length; i++)
         {
             selectedRows[i]["Selected"] = "true";
         }
         ds.Tables[0].DefaultView.Sort = "QuangCaoID DESC";
         grdAdv.DataSource = ds.Tables[0].DefaultView;
         grdAdv.DataBind();
         return selectedRows.Length;
     }
     return 0;
 }
Exemple #6
0
    private int LoadCuaHang(int ViTriCuaHang, int KhuVucID)
    {
        if (Common.LoaiNguoiDungID() == 3)
        {
            //For administrator
            CuaHang ch = new CuaHang();
            DataSet ds = ch.SelectAllCuaHangAtViTriCuaHang(ViTriCuaHang);

            ds.Tables[0].Columns.Add("Selected", Type.GetType("System.String"));
            ds.Tables[0].Columns["Selected"].DefaultValue = "false";
            DataRow[] selectedRows = ds.Tables[0].Select("ViTriCuaHang=" + ViTriCuaHang + " AND KhuVucID=" + KhuVucID);
            for (int i = 0; i < selectedRows.Length; i++)
            {
                selectedRows[i]["Selected"] = "true";
            }
            grdStore.DataSource = ds;
            grdStore.DataBind();
            return selectedRows.Length;
        }
        else if (Common.LoaiNguoiDungID() == 2)
        {
            //For e-store manager
            QuangCao qcao = new QuangCao();
            CuaHang ch = new CuaHang();
            DataSet ds = ch.SelectAllCuaHangAtViTriCuaHangByNguoiDungID(Common.NguoiDungID(), ViTriCuaHang);
            ds.Tables[0].Columns.Add("Selected", Type.GetType("System.String"));
            ds.Tables[0].Columns["Selected"].DefaultValue = "false";
            DataRow[] selectedRows = ds.Tables[0].Select("ViTriCuaHang=" + ViTriCuaHang + " AND KhuVucID=" + KhuVucID);
            for (int i = 0; i < selectedRows.Length; i++)
            {
                selectedRows[i]["Selected"] = "true";
            }
            grdStore.DataSource = ds;
            grdStore.DataBind();
            return selectedRows.Length;
        }
        return 0;
    }
Exemple #7
0
 private void LoadQuangCao(int aid)
 {
     QuangCao qcao = new QuangCao();
     DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByNguoiDungID(ChuCuaHangID, aid);
     switch (aid)
     {
         case 54:
             if (ds.Tables[0].Rows.Count >= 1)
             {
                 if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                 {
                     spnQuangCao54.InnerHtml = "<object style=\"border:none\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                         + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                         + "width=\"598\" height=\"213\" 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=\"598\" height=\"213\"></embed></object>";
                 }
                 else
                 {
                     spnQuangCao54.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"]
                       + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[0]["NoiDungQuangCao"]
                       + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"].ToString() + "\" height=\"213\" width=\"598\" style=\"border:none\"/></a>";
                 }
             }
             break;
     }
 }
Exemple #8
0
 private void LoadQuangCao09()
 {
     QuangCao qcao = new QuangCao();
     DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByLoaiNguoiDungIDAndKhuVuc(3, 9, intKhuVucID);
     int n = ds.Tables[0].Rows.Count;
     spnQuangCao09a.InnerHtml =
         "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"370px\" style=\"border:solid 1px #C9C3C3\"/>";
     spnQuangCao09b.InnerHtml =
         "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"370px\" style=\"border:solid 1px #C9C3C3\"/>";
     //spnQuangCao09c.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"370px\" style=\"border:solid 1px #C9C3C3\"/>";
     if (n >= 1)
     {
         if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
         {
             spnQuangCao09a.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=\"370px\" height=\"122\" title=\"Quang Cao\">"
                                        + "<param name=\"movie\" value=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                        "\" />"
                                        + "<param name=\"quality\" value=\"high\" />"
                                        + "<embed src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                        "\" quality=\"high\""
                                        +
                                        "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                        + "width=\"370px\" height=\"122\"></embed></object>";
         }
         else
         {
             spnQuangCao09a.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"]
                                        + "\" target=\"_blank\"><img alt=\"" +
                                        ds.Tables[0].Rows[0]["NoiDungQuangCao"]
                                        + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                        "\" height=\"122px\" width=\"370px\" style=\"border:solid 1px #C9C3C3\"/></a>";
         }
         if (n >= 2)
         {
             if (ds.Tables[0].Rows[1]["LoaiAnh"].ToString() == "FLASH")
             {
                 spnQuangCao09b.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=\"370px\" height=\"122\" title=\"Quang Cao\">"
                                            + "<param name=\"movie\" value=\"" + ds.Tables[0].Rows[1]["DuongDanAnh"] +
                                            "\" />"
                                            + "<param name=\"quality\" value=\"high\" />"
                                            + "<embed src=\"" + ds.Tables[0].Rows[1]["DuongDanAnh"] +
                                            "\" quality=\"high\""
                                            +
                                            "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                            + "width=\"370px\" height=\"122\"></embed></object>";
             }
             else
             {
                 spnQuangCao09b.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[1]["DuongDan"]
                                            + "\" target=\"_blank\"><img alt=\"" +
                                            ds.Tables[0].Rows[1]["NoiDungQuangCao"]
                                            + "\" src=\"" + ds.Tables[0].Rows[1]["DuongDanAnh"] +
                                            "\" height=\"122px\" width=\"370px\" style=\"border:solid 1px #C9C3C3\"/></a>";
             }
             //if (n >= 3)
             //{
             //    if (ds.Tables[0].Rows[2]["LoaiAnh"].ToString() == "FLASH")
             //    {
             //        spnQuangCao09c.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=\"370px\" 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=\"370px\" height=\"122\"></embed></object>";
             //    }
             //    else
             //    {
             //        spnQuangCao09c.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=\"370px\" style=\"border:solid 1px #C9C3C3\"/></a>";
             //    }
             //}
         }
     }
     else
     {
         tblQuangCao09.Visible = false;
     }
 }
Exemple #9
0
    private void LoadAllQuangCao()
    {
        QuangCao qcao = new QuangCao();
        DataSet ds;
        if (Cache["dsallquangcao"] == null)
        {
            ds = qcao.SelectQuangCaoAtViTriQuangCaoByLoaiNguoiDungIDForHomePage(3, "1,2,3,4,5,6,7,8,9,10");
            Cache["dsallquangcao"] = ds;
        }
        else
        {
            ds = (DataSet) Cache["dsallquangcao"];
        }
        if (ds.Tables[0].Rows.Count >= 1)
        {
            for (int i = 0; i < 10; i++)
            {
                ds.Tables[0].DefaultView.RowFilter = "ViTriQuangCao = " + (i + 1);
                DataView dv = ds.Tables[0].DefaultView;
                if (dv.Count > 0)
                {
                    switch (i)
                    {
                        case 0:
                            if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                            {
                                spnQuangCao01.InnerHtml = "<object 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=\"100%\" height=\"111\" title=\"Quang Cao\">"
                                                          + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" />"
                                                          + "<param name=\"quality\" value=\"high\" />"
                                                          + "<embed src=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" quality=\"high\""
                                                          +
                                                          "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                          + "width=\"100%\" height=\"111\"></embed></object>";
                            }
                            else
                            {
                                spnQuangCao01.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                          + "\" target=\"_blank\"><img alt=\"" +
                                                          dv[0]["NoiDungQuangCao"]
                                                          + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" height=\"111px\" width=\"100%\" style=\"border:solid 1px #C9C3C3\"/></a>";
                            }
                            break;
                        case 1:
                            if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                            {
                                spnQuangCao02.InnerHtml = "<object style=\"z-index:1\" z-index:1  border:solid 1px #C9C3C3 classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                                                          +
                                                          "z-index=\"0\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                                                          + "width=\"550\" height=\"216\" title=\"Quang Cao\">"
                                                          + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" />"
                                                          + "<param name=\"quality\" value=\"high\" />"
                                                          + "<param name=\"wmode\" value=\"transparent\" />"
                                                          + "<embed wmode=\"transparent\" src=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" quality=\"high\""
                                                          +
                                                          "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                          +
                                                          "width=\"550\" height=\"216\" style=\"z-index:1\"></embed></object>";
                            }
                            else
                            {
                                spnQuangCao02.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                          + "\" target=\"_blank\" style=\"z-index:1\"><img alt=\"" +
                                                          dv[0]["NoiDungQuangCao"]
                                                          + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" height=\"216px\" width=\"550px\" style=\"z-index:1;border:solid 1px #C9C3C3\"/></a>";
                            }
                            break;
                        case 2:
                            int n = dv.Count;
                            spnQuangCao03a.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            spnQuangCao03b.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            //spnQuangCao03c.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            if (n >= 1)
                            {
                                if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                                {
                                    spnQuangCao03a.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                               + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" />"
                                                               + "<param name=\"quality\" value=\"high\" />"
                                                               + "<embed src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" quality=\"high\""
                                                               +
                                                               "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                               + "width=\"365px\" height=\"122\"></embed></object>";
                                }
                                else
                                {
                                    spnQuangCao03a.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                               + "\" target=\"_blank\"><img alt=\"" +
                                                               dv[0]["NoiDungQuangCao"]
                                                               + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" height=\"122px\" width=\"365pxpx\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                }
                                if (n >= 2)
                                {
                                    if (dv[1]["LoaiAnh"].ToString() == "FLASH")
                                    {
                                        spnQuangCao03b.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                                   + "<param name=\"movie\" value=\"" +
                                                                   dv[1]["DuongDanAnh"] + "\" />"
                                                                   + "<param name=\"quality\" value=\"high\" />"
                                                                   + "<embed src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" quality=\"high\""
                                                                   +
                                                                   "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                                   + "width=\"365px\" height=\"122\"></embed></object>";
                                    }
                                    else
                                    {
                                        spnQuangCao03b.InnerHtml = "<a href=\"" + dv[1]["DuongDan"]
                                                                   + "\" target=\"_blank\"><img alt=\"" +
                                                                   dv[1]["NoiDungQuangCao"]
                                                                   + "\" src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                    }
                                }
                            }
                            else
                            {
                                tblQuangCao03.Visible = false;
                            }
                            break;
                        case 3:
                            n = 5;
                            if (dv.Count <= 2) n = dv.Count;

                            for (int j = 0; j < n; j++)
                            {
                                TableRow tr = new TableRow();
                                TableCell td = new TableCell();
                                td.Style.Value = "padding-top: 4px; padding-left:4px";
                                string content = "";
                                if (dv[j]["LoaiAnh"].ToString() == "FLASH")
                                {
                                    content = "<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=\"200\" height=\"155\" title=\"Quang Cao\">"
                                              + "<param name=\"movie\" value=\"" + dv[j]["DuongDanAnh"] + "\" />"
                                              + "<param name=\"quality\" value=\"high\" />"
                                              + "<embed src=\"" + dv[j]["DuongDanAnh"] + "\" quality=\"high\""
                                              +
                                              "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                              + "width=\"200\" height=\"155\"></embed></object>";
                                }
                                else
                                {
                                    content = "<a href=\"" + dv[j]["DuongDan"]
                                              + "\" target=\"_blank\"><img alt=\"" + dv[j]["NoiDungQuangCao"]
                                              + "\" src=\"" + dv[j]["DuongDanAnh"]
                                              + "\" style=\"border:solid 1px #C9C3C3; width:200px;\"></a>";
                                }
                                td.Text = content;
                                tr.Cells.Add(td);
                                tblQuangCao04.Rows.Add(tr);
                            }
                            break;
                        case 4:
                            n = dv.Count;
                            spnQuangCao05a.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            spnQuangCao05b.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            //spnQuangCao05c.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            if (n >= 1)
                            {
                                if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                                {
                                    spnQuangCao05a.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                               + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" />"
                                                               + "<param name=\"quality\" value=\"high\" />"
                                                               + "<embed src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" quality=\"high\""
                                                               +
                                                               "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                               + "width=\"365px\" height=\"122\"></embed></object>";
                                }
                                else
                                {
                                    spnQuangCao05a.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                               + "\" target=\"_blank\"><img alt=\"" +
                                                               dv[0]["NoiDungQuangCao"]
                                                               + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                }
                                if (n >= 2)
                                {
                                    if (dv[1]["LoaiAnh"].ToString() == "FLASH")
                                    {
                                        spnQuangCao05b.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                                   + "<param name=\"movie\" value=\"" +
                                                                   dv[1]["DuongDanAnh"] + "\" />"
                                                                   + "<param name=\"quality\" value=\"high\" />"
                                                                   + "<embed src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" quality=\"high\""
                                                                   +
                                                                   "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                                   + "width=\"365px\" height=\"122\"></embed></object>";
                                    }
                                    else
                                    {
                                        spnQuangCao05b.InnerHtml = "<a href=\"" + dv[1]["DuongDan"]
                                                                   + "\" target=\"_blank\"><img alt=\"" +
                                                                   dv[1]["NoiDungQuangCao"]
                                                                   + "\" src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                    }
                                }
                            }
                            else
                            {
                                tblQuangCao05.Visible = false;
                            }
                            break;
                        case 5:
                            //spn = spnQuangCao06a;
                            //spn1 = spnQuangCao06b;
                            break;
                        case 6:
                            n = dv.Count;
                            spnQuangCao07a.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            spnQuangCao07b.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            //spnQuangCao07c.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            if (n >= 1)
                            {
                                if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                                {
                                    spnQuangCao07a.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                               + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" />"
                                                               + "<param name=\"quality\" value=\"high\" />"
                                                               + "<embed src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" quality=\"high\""
                                                               +
                                                               "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                               + "width=\"365px\" height=\"122\"></embed></object>";
                                }
                                else
                                {
                                    spnQuangCao07a.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                               + "\" target=\"_blank\"><img alt=\"" +
                                                               dv[0]["NoiDungQuangCao"]
                                                               + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                }
                                if (n >= 2)
                                {
                                    if (dv[1]["LoaiAnh"].ToString() == "FLASH")
                                    {
                                        spnQuangCao07b.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                                   + "<param name=\"movie\" value=\"" +
                                                                   dv[1]["DuongDanAnh"] + "\" />"
                                                                   + "<param name=\"quality\" value=\"high\" />"
                                                                   + "<embed src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" quality=\"high\""
                                                                   +
                                                                   "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                                   + "width=\"365px\" height=\"122\"></embed></object>";
                                    }
                                    else
                                    {
                                        spnQuangCao07b.InnerHtml = "<a href=\"" + dv[1]["DuongDan"]
                                                                   + "\" target=\"_blank\"><img alt=\"" +
                                                                   dv[1]["NoiDungQuangCao"]
                                                                   + "\" src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                    }
                                }
                            }
                            else
                            {
                                tblQuangCao07.Visible = false;
                            }
                            break;
                        case 7:
                            n = dv.Count;
                            spnQuangCao08a.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            spnQuangCao08b.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            //spnQuangCao08c.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            if (n >= 1)
                            {
                                if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                                {
                                    spnQuangCao08a.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                               + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" />"
                                                               + "<param name=\"quality\" value=\"high\" />"
                                                               + "<embed src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" quality=\"high\""
                                                               +
                                                               "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                               + "width=\"365px\" height=\"122\"></embed></object>";
                                }
                                else
                                {
                                    spnQuangCao08a.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                               + "\" target=\"_blank\"><img alt=\"" +
                                                               dv[0]["NoiDungQuangCao"]
                                                               + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                }
                                if (n >= 2)
                                {
                                    if (dv[1]["LoaiAnh"].ToString() == "FLASH")
                                    {
                                        spnQuangCao08b.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                                   + "<param name=\"movie\" value=\"" +
                                                                   dv[1]["DuongDanAnh"] + "\" />"
                                                                   + "<param name=\"quality\" value=\"high\" />"
                                                                   + "<embed src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" quality=\"high\""
                                                                   +
                                                                   "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                                   + "width=\"365px\" height=\"122\"></embed></object>";
                                    }
                                    else
                                    {
                                        spnQuangCao08b.InnerHtml = "<a href=\"" + dv[1]["DuongDan"]
                                                                   + "\" target=\"_blank\"><img alt=\"" +
                                                                   dv[1]["NoiDungQuangCao"]
                                                                   + "\" src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                    }
                                }
                            }
                            else
                            {
                                tblQuangCao08.Visible = false;
                            }
                            break;
                        case 8:
                            n = dv.Count;
                            spnQuangCao09a.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            spnQuangCao09b.InnerHtml =
                                "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            //spnQuangCao09c.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/>";
                            if (n >= 1)
                            {
                                if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                                {
                                    spnQuangCao09a.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                               + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" />"
                                                               + "<param name=\"quality\" value=\"high\" />"
                                                               + "<embed src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" quality=\"high\""
                                                               +
                                                               "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                               + "width=\"365px\" height=\"122\"></embed></object>";
                                }
                                else
                                {
                                    spnQuangCao09a.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                               + "\" target=\"_blank\"><img alt=\"" +
                                                               dv[0]["NoiDungQuangCao"]
                                                               + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                               "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                }
                                if (n >= 2)
                                {
                                    if (dv[1]["LoaiAnh"].ToString() == "FLASH")
                                    {
                                        spnQuangCao09b.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=\"365px\" height=\"122\" title=\"Quang Cao\">"
                                                                   + "<param name=\"movie\" value=\"" +
                                                                   dv[1]["DuongDanAnh"] + "\" />"
                                                                   + "<param name=\"quality\" value=\"high\" />"
                                                                   + "<embed src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" quality=\"high\""
                                                                   +
                                                                   "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                                   + "width=\"365px\" height=\"122\"></embed></object>";
                                    }
                                    else
                                    {
                                        spnQuangCao09b.InnerHtml = "<a href=\"" + dv[1]["DuongDan"]
                                                                   + "\" target=\"_blank\"><img alt=\"" +
                                                                   dv[1]["NoiDungQuangCao"]
                                                                   + "\" src=\"" + dv[1]["DuongDanAnh"] +
                                                                   "\" height=\"122px\" width=\"365px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                                    }
                                }
                            }
                            else
                            {
                                tblQuangCao09.Visible = false;
                            }
                            break;
                        case 9:
                            if (dv[0]["LoaiAnh"].ToString() == "FLASH")
                            {
                                spnQuangCao10.InnerHtml = "<object 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=\"980\" height=\"111\" title=\"Quang Cao\">"
                                                          + "<param name=\"movie\" value=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" />"
                                                          + "<param name=\"quality\" value=\"high\" />"
                                                          + "<embed src=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" quality=\"high\""
                                                          +
                                                          "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                          + "width=\"980\" height=\"216\"></embed></object>";
                            }
                            else
                            {
                                spnQuangCao10.InnerHtml = "<a href=\"" + dv[0]["DuongDan"]
                                                          + "\" target=\"_blank\"><img alt=\"" +
                                                          dv[0]["NoiDungQuangCao"]
                                                          + "\" src=\"" + dv[0]["DuongDanAnh"] +
                                                          "\" height=\"111px\" width=\"980px\" style=\"border:solid 1px #C9C3C3\"/></a>";
                            }
                            break;
                    }
                }
            }
        }
    }
Exemple #10
0
 private void LoadQuangCao11()
 {
     QuangCao qcao = new QuangCao();
     DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByNhomSanPhamID(mcid, 11);
     HtmlGenericControl spnQuangCao41 = (HtmlGenericControl) 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"] +
                                       "\" />"
                                       + "<param name=\"quality\" value=\"high\" />"
                                       + "<embed src=\"." + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                       "\" 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"]
                                       + "\" target=\"_blank\"><img alt=\"" + ds.Tables[0].Rows[0]["NoiDungQuangCao"]
                                       + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                       "\" 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 LoadQuangCao(int aid)
    {
        QuangCao qcao = new QuangCao();
        DataSet ds = qcao.SelectQuangCaoAtViTriQuangCaoByNguoiDungID(ChuCuaHangID, aid);
        switch (aid)
        {
            case 51:
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                    {
                        spnQuangCao51.InnerHtml = "<object style=\"border:none\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                                                  +
                                                  "z-index=\"0\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                                                  + "width=\"593\" height=\"117\" title=\"Quang Cao\">"
                                                  + "<param name=\"movie\" value=\"" +
                                                  ds.Tables[0].Rows[0]["DuongDanAnh"] + "\" />"
                                                  + "<param name=\"quality\" value=\"high\" />"
                                                  + "<param name=\"wmode\" value=\"transparent\" />"
                                                  + "<embed wmode=\"transparent\" src=\"" +
                                                  ds.Tables[0].Rows[0]["DuongDanAnh"] + "\" quality=\"high\""
                                                  +
                                                  "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                  + "width=\"593\" height=\"117\"></embed></object>";
                    }
                    else
                    {
                        spnQuangCao51.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"]
                                                  + "\" target=\"_blank\"><img alt=\"" +
                                                  ds.Tables[0].Rows[0]["NoiDungQuangCao"]
                                                  + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                                  "\" height=\"117\" width=\"593\" style=\"border:none\"/></a>";
                    }
                }
                break;
                //case 52:
                //    if (ds.Tables[0].Rows.Count >= 1)
                //    {
                //        if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                //        {
                //            spnQuangCao52.InnerHtml = "<object style=\"border:none\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                //                + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                //                + "width=\"628\" height=\"116\" 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=\"628\" height=\"116\"></embed></object>";
                //        }
                //        else
                //        {
                //            spnQuangCao52.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=\"116px\" width=\"628px\" style=\"border:none\"/></a>";
                //        }
                //    }
                //    break;
                //case 53:
                //    if (ds.Tables[0].Rows.Count >= 1)
                //    {
                //        if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                //        {
                //            spnQuangCao53.InnerHtml = "<object style=\"border:none\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                //                + "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                //                + "width=\"156\" height=\"116\" 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=\"156\" height=\"116\"></embed></object>";
                //        }
                //        else
                //        {
                //            spnQuangCao53.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=\"116px\" width=\"156px\" style=\"border:none\"/></a>";
                //        }
                //    }
                //    //else
                //    //{
                //    //    spnQuangCao53.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"116px\" width=\"156px\" style=\"border:none\"/>";
                //    //}
                //    break;
            case 54:
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                    {
                        spnQuangCao54.InnerHtml = "<object style=\"border:none\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                                                  +
                                                  "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                                                  + "width=\"421\" height=\"212\" title=\"Quang Cao\">"
                                                  + "<param name=\"movie\" value=\"" +
                                                  ds.Tables[0].Rows[0]["DuongDanAnh"] + "\" />"
                                                  + "<param name=\"quality\" value=\"high\" />"
                                                  + "<param name=\"wmode\" value=\"transparent\" />"
                                                  + "<embed src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                                  "\" quality=\"high\""
                                                  +
                                                  "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                  + "width=\"421\" height=\"212\"></embed></object>";
                    }
                    else
                    {
                        spnQuangCao54.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"]
                                                  + "\" target=\"_blank\"><img alt=\"" +
                                                  ds.Tables[0].Rows[0]["NoiDungQuangCao"]
                                                  + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                                  "\" height=\"212\" width=\"421\" style=\"border:none\"/></a>";
                    }
                }
                //else
                //{
                //    spnQuangCao54.InnerHtml = "<img alt=\"Moi quang cao\" src=\"./images/advblank.jpg\" height=\"249px\" width=\"490px\" style=\"border:none\"/>";
                //}
                break;

            case 55:
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    spnQuangCao55.InnerHtml = "";
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                        {
                            spnQuangCao55.InnerHtml += "<object style=\"border:none\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                                                       +
                                                       "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                                                       + "width=\"110px\"  title=\"Quang Cao\">"
                                                       + "<param name=\"movie\" value=\"" +
                                                       ds.Tables[0].Rows[i]["DuongDanAnh"] + "\" />"
                                                       + "<param name=\"quality\" value=\"high\" />"
                                                       + "<embed src=\"" + ds.Tables[0].Rows[i]["DuongDanAnh"] +
                                                       "\" quality=\"high\""
                                                       +
                                                       "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                       + "width=\"110px\" ></embed></object>";
                        }
                        else
                        {
                            spnQuangCao55.InnerHtml += "<a href=\"" + ds.Tables[0].Rows[i]["DuongDan"]
                                                       + "\" target=\"_blank\"><img alt=\"" +
                                                       ds.Tables[0].Rows[i]["NoiDungQuangCao"]
                                                       + "\" src=\"" + ds.Tables[0].Rows[i]["DuongDanAnh"] +
                                                       "\" width=\"110px\" style=\"border:none\"/></a>";
                        }
                    }
                }

                break;

            case 56:
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    spnQuangCao56.InnerHtml = "";
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                        {
                            spnQuangCao56.InnerHtml += "<object style=\"border:none\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
                                                       +
                                                       "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\""
                                                       + "width=\"110\"  title=\"Quang Cao\">"
                                                       + "<param name=\"movie\" value=\"" +
                                                       ds.Tables[0].Rows[i]["DuongDanAnh"] + "\" />"
                                                       + "<param name=\"quality\" value=\"high\" />"
                                                       + "<embed src=\"" + ds.Tables[0].Rows[i]["DuongDanAnh"] +
                                                       "\" quality=\"high\""
                                                       +
                                                       "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                       + "width=\"110\" ></embed></object>";
                        }
                        else
                        {
                            spnQuangCao56.InnerHtml += "<a href=\"" + ds.Tables[0].Rows[i]["DuongDan"]
                                                       + "\" target=\"_blank\"><img alt=\"" +
                                                       ds.Tables[0].Rows[i]["NoiDungQuangCao"]
                                                       + "\" src=\"" + ds.Tables[0].Rows[i]["DuongDanAnh"] +
                                                       "\" width=\"110\" style=\"border:none\"/></a>";
                        }
                    }
                }
                break;

            case 57:
                if (ds.Tables[0].Rows.Count >= 1)
                {
                    if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                    {
                        spnQuangCao57.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=\"150\" height=\"150\" title=\"Quang Cao\">"
                                                  + "<param name=\"movie\" value=\"" +
                                                  ds.Tables[0].Rows[0]["DuongDanAnh"] + "\" />"
                                                  + "<param name=\"quality\" value=\"high\" />"
                                                  + "<embed src=\"." + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                                  "\" quality=\"high\""
                                                  +
                                                  "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                  + "width=\"150\" height=\"150\"></embed></object>";
                    }
                    else
                    {
                        spnQuangCao57.InnerHtml = "<a href=\"" + ds.Tables[0].Rows[0]["DuongDan"]
                                                   + "\" target=\"_blank\"><img alt=\"" +
                                                   ds.Tables[0].Rows[0]["NoiDungQuangCao"]
                                                   + "\" src=\"" + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                                   "\" height=\"150\" width=\"150\" style=\"border:solid 1px #C9C3C3\"/></a>";
                    }
                }

                break;
        }
    }
Exemple #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Common.LoaiNguoiDungID() == 3 || Common.LoaiNguoiDungID() == 2)
     {
         if (!Page.IsPostBack)
         {
             if (Request.QueryString["id"] != null)
             {
                 //Edit, show the data from database
                 int id = int.Parse(Request.QueryString["id"]);
                 QuangCao qcao = new QuangCao();
                 DataSet ds = qcao.SelectByQuangCaoID(id);
                 if (ds.Tables[0].Rows.Count == 1)
                 {
                     int NguoiDungID = int.Parse(ds.Tables[0].Rows[0]["NguoiDungID"].ToString());
                     int LoaiNguoiDungID = int.Parse(ds.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString());
                     if ((Common.LoaiNguoiDungID() == 3 && LoaiNguoiDungID == 3)
                         ||
                         (Common.LoaiNguoiDungID() == 2 && LoaiNguoiDungID == 2 &&
                          Common.NguoiDungID() == NguoiDungID))
                     {
                         txtDuongDan.Text = ds.Tables[0].Rows[0]["DuongDan"].ToString();
                         txtNoiDung.Text = ds.Tables[0].Rows[0]["NoiDungQuangCao"].ToString();
                         imgAnhQuangCao.Src = "." + ds.Tables[0].Rows[0]["DuongDanAnh"];
                         txtGhiChu.Text = ds.Tables[0].Rows[0]["GhiChu"].ToString();
                         if (ds.Tables[0].Rows[0]["LoaiAnh"].ToString() == "FLASH")
                         {
                             rbtFlash.Checked = true;
                             flashQuangCao.Visible = true;
                             flashQuangCao.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=\"300\" height=\"200\" title=\"Quang Cao\">"
                                                       + "<param name=\"movie\" value=\"." +
                                                       ds.Tables[0].Rows[0]["DuongDanAnh"] + "\" />"
                                                       + "<param name=\"quality\" value=\"high\" />"
                                                       + "<embed src=\"." + ds.Tables[0].Rows[0]["DuongDanAnh"] +
                                                       "\" quality=\"high\""
                                                       +
                                                       "pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\""
                                                       + "width=\"300\" height=\"200\"></embed></object> ";
                         }
                         else
                         {
                             rbtImage.Checked = true;
                             imgAnhQuangCao.Visible = true;
                         }
                     }
                     else
                     {
                         Response.Redirect("../message.aspx?msg=Access denied");
                     }
                 }
                 else
                 {
                     Response.Redirect("../message.aspx?msg=Invalid parameter");
                 }
             }
         }
     }
     else
     {
         Response.Redirect("../message.aspx?msg=Access denied");
     }
 }
Exemple #13
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (Common.LoaiNguoiDungID() == 3 || Common.LoaiNguoiDungID() == 2)
        {
            QuangCao qcao = new QuangCao();
            if (Request.QueryString["id"] == null)
            {
                //Add new
                string path = Server.MapPath("../Upload/AdvImages");
                string relativePath = "";
                string randomString = "";
                string mediaType = "IMAGE";
                if (rbtFlash.Checked) mediaType = "FLASH";
                if (fileQuangCao.PostedFile.FileName != "")
                {
                    try
                    {
                        if ((fileQuangCao.PostedFile.ContentLength <= 300000) || (Common.LoaiNguoiDungID() == 3))
                        {
                            int pos = fileQuangCao.PostedFile.FileName.LastIndexOf('\\');
                            string absolutePath = path + "\\" + fileQuangCao.PostedFile.FileName.Remove(0, pos + 1);
                            if (File.Exists(absolutePath))
                            {
                                randomString = DateTime.Now.Ticks + "_";
                                absolutePath = path + "\\" + randomString +
                                               fileQuangCao.PostedFile.FileName.Remove(0, pos + 1);
                            }
                            fileQuangCao.PostedFile.SaveAs(absolutePath);
                            relativePath = "./Upload/AdvImages/" + randomString +
                                           fileQuangCao.PostedFile.FileName.Remove(0, pos + 1);
                        }
                        else
                        {
                            Response.Redirect("../message.aspx?msg=File size is bigger than 300KB!");
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("../message.aspx?msg=" + ex.Message);
                        return;
                    }
                }
                qcao.InsertFields(txtDuongDan.Text, txtNoiDung.Text, relativePath, Common.NguoiDungID(), txtGhiChu.Text,
                                  mediaType, null, null, null, null, null);
            }
            else
            {
                //Edit
                int id = int.Parse(Request.QueryString["id"]);
                string path = Server.MapPath("../Upload/AdvImages");
                string randomString = "";
                string relativePath = "";
                string mediaType = "IMAGE";
                if (rbtFlash.Checked) mediaType = "FLASH";
                if (fileQuangCao.PostedFile.FileName != "")
                {
                    try
                    {
                        if ((fileQuangCao.PostedFile.ContentLength <= 300000) || (Common.LoaiNguoiDungID() == 3))
                        {
                            int pos = fileQuangCao.PostedFile.FileName.LastIndexOf('\\');
                            string absolutePath = path + "\\" + fileQuangCao.PostedFile.FileName.Remove(0, pos + 1);
                            if (File.Exists(absolutePath))
                            {
                                randomString = DateTime.Now.Ticks + "_";
                                absolutePath = path + "\\" + randomString +
                                               fileQuangCao.PostedFile.FileName.Remove(0, pos + 1);
                            }

                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            fileQuangCao.PostedFile.SaveAs(absolutePath);
                            //if (rbtFlash.Checked == true)
                            //{
                            //    fileQuangCao.PostedFile.SaveAs(absolutePath);
                            //}
                            //else
                            //{
                            //    Common.ResizeFromStream(absolutePath, 320, fileQuangCao.PostedFile.InputStream);
                            //}
                            //File.Delete(Server.MapPath(imgAnhQuangCao.Src));
                            relativePath = "./Upload/AdvImages/" + randomString +
                                           fileQuangCao.PostedFile.FileName.Remove(0, pos + 1);
                        }
                        else
                        {
                            Response.Redirect("../message.aspx?msg=File size is too big!");
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Redirect("../message.aspx?msg=" + ex.Message);
                        return;
                    }
                }
                if (relativePath != "")
                {
                    qcao.UpdateFields(id, txtDuongDan.Text, txtNoiDung.Text, relativePath, null, txtGhiChu.Text,
                                      mediaType, null, null, null, null, null);
                }
                else
                {
                    qcao.UpdateFields(id, txtDuongDan.Text, txtNoiDung.Text, null, null, txtGhiChu.Text, mediaType, null,
                                      null, null, null, null);
                }
            }
            string strScript = "<script language='JavaScript'>" + "window.parent.Refresh();</script>";
            ClientScript.RegisterStartupScript(GetType(), "Refresh", strScript);
        }
        else
        {
            Response.Redirect("../message.aspx?msg=Access denied");
        }
    }
Exemple #14
0
    protected void btnXoa_Click(object sender, EventArgs e)
    {
        try
        {
            switch (ViewState["TYPE"].ToString())
            {
                case "thuoctinh":
                    if (Common.LoaiNguoiDungID() == 3)
                    {
                        ThuocTinh tt = new ThuocTinh();
                        tt.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "nhomsanpham":
                    if (Common.LoaiNguoiDungID() == 3)
                    {
                        NhomSanPham nhomsanpham = new NhomSanPham();
                        nhomsanpham.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "vitrisanpham":
                    if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2))
                    {
                        ViTriSanPham vtsp = new ViTriSanPham();
                        vtsp.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "cuahangnhomsanpham":
                    if (Common.LoaiNguoiDungID() == 2)
                    {
                        deleteCuaHangNhomSanPham(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "nhomsanphamcuahang":
                    if (Common.LoaiNguoiDungID() == 2)
                    {
                        deleteNhomSanPhamCuaHang(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;

                case "nhanxetsanpham":
                    if (Common.LoaiNguoiDungID() != 1)
                    {
                        NhanXetSanPham nhanxet = new NhanXetSanPham();
                        nhanxet.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "tintuc":
                    if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2))
                    {
                        TinTuc tt = new TinTuc();
                        tt.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "hotrotructuyen":
                    if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2))
                    {
                        HoTroTrucTuyen ht = new HoTroTrucTuyen();
                        ht.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "hoidapsanpham":
                    if (Common.LoaiNguoiDungID() != 1)
                    {
                        HoiDapSanPham hoidap = new HoiDapSanPham();
                        hoidap.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "nguoidung":
                    if (Common.LoaiNguoiDungID() == 3)
                    {
                        if (CheckExistCuaHang(id) != true)
                        {
                            NguoiDung nguoidung = new NguoiDung();
                            nguoidung.Delete(id);
                        }
                        else
                        {
                            Response.Redirect("../message.aspx?msg=Không thể xóa người dùng đã có cửa hàng", false);
                        }
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "hangsanxuat":
                    if (Common.LoaiNguoiDungID() == 3)
                    {
                        HangSanXuat hsx = new HangSanXuat();
                        hsx.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "khuvuc":
                    if (Common.LoaiNguoiDungID() == 3)
                    {
                        KhuVuc kv = new KhuVuc();
                        kv.Delete(id);
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "quangcao":
                    if (Common.LoaiNguoiDungID() == 2 || Common.LoaiNguoiDungID() == 3)
                    {
                        QuangCao qcao = new QuangCao();
                        DataSet ds = qcao.SelectByQuangCaoID(id);
                        if (ds.Tables[0].Rows.Count == 1)
                        {
                            if (Common.LoaiNguoiDungID() == 3)
                            {
                                //Administrator
                                if (ds.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == "3") qcao.Delete(id);
                            }
                            else
                            {
                                //e-Store
                                if (ds.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == "2"
                                    && ds.Tables[0].Rows[0]["NguoiDungID"].ToString() == Common.NguoiDungID().ToString())
                                    qcao.Delete(id);
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
                case "sanpham":
                    {
                        SanPham sanpham = new SanPham();
                        DataSet dssp = sanpham.SelectBySanPhamID(id);
                        if (Common.LoaiNguoiDungID() == 2)
                        {
                            if (dssp.Tables[0].Rows.Count == 1)
                            {
                                //e-Store
                                if (dssp.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() ==
                                    Common.LoaiNguoiDungID().ToString()
                                    &&
                                    dssp.Tables[0].Rows[0]["NguoiDungID"].ToString() == Common.NguoiDungID().ToString())
                                {
                                    sanpham.Delete(id);
                                }
                            }
                        }
                        else if (Common.LoaiNguoiDungID() == 3)
                        {
                            if (dssp.Tables[0].Rows.Count == 1)
                            {
                                sanpham.Delete(id);
                            }
                        }
                        else
                        {
                            Response.Redirect("../message.aspx?msg=Access denied");
                        }
                    }
                    break;
                case "sanphammau":
                    {
                        SanPhamMau sanpham = new SanPhamMau();
                        DataSet dssp = sanpham.SelectByID(id);
                        if (Common.LoaiNguoiDungID() == 3)
                        {
                            if (dssp.Tables[0].Rows.Count == 1)
                            {
                                sanpham.Delete(id);
                            }
                        }
                        else
                        {
                            Response.Redirect("../message.aspx?msg=Access denied");
                        }
                    }
                    break;
                case "anhsanpham":
                    if ((Common.LoaiNguoiDungID() == 2) || (Common.LoaiNguoiDungID() == 3))
                    {
                        Anh anhsanpham = new Anh();
                        DataSet dssp = anhsanpham.SelectByID(id);
                        if (dssp.Tables[0].Rows.Count == 1)
                        {
                            anhsanpham.Delete(id);

                            if (File.Exists(Server.MapPath(Request.QueryString["src"])))
                            {
                                File.Delete(Server.MapPath(Request.QueryString["src"]));
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("../message.aspx?msg=Access denied");
                    }
                    break;
            }
            string strScript = "<script language='JavaScript'>" + "window.parent.Refresh();</script>";
            ClientScript.RegisterStartupScript(Type.GetType("System.String"), "Refresh", strScript);
        }
        catch (Exception ex)
        {
            Response.Write(ex.ToString());
        }
    }