コード例 #1
0
 private void LoadAgentCat()
 {
     try
     {
         string             Lang      = "VI";
         AgentCat           obj       = new AgentCat();
         DataSet            ds        = obj.GetAllAgentCat("AgentCat");
         DropDownListHelper ddlHelper = new DropDownListHelper();
         ddlHelper.FillData(ddlAgentCat, ds, "AgentNameVI", "ID", "---Chọn công ty---");
     }
     catch { }
 }
コード例 #2
0
    public void LoadAds()
    {
        try
        {
            string         Lang    = Globals.GetLang();
            OtherFunctions objFunc = new OtherFunctions();
            if (_isAgentCat)
            {
                _agentCatID = Globals.AgentCatID;
            }

            string   html  = "";
            AgentCat agent = new AgentCat();
            Link     obj   = new Link();
            DataSet  ds    = new DataSet();
            if (_position == "All")
            {
                ds = obj.GetAllLink("AgentLink", _agentCatID, _contentType);
            }
            else
            {
                ds = obj.GetLinkByPosition("AgentLink", _agentCatID, _position, _contentType);
            }
            string link       = "";
            string logotype   = "";
            string linkname   = "";
            string logosource = "";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                link       = DataObject.GetString(ds, i, "Link");
                logotype   = DataObject.GetString(ds, i, "LogoType");
                linkname   = DataObject.GetString(ds, i, "LinkName");
                logosource = Globals.GetUploadsUrl() + DataObject.GetString(ds, i, "Logo");

                if (link == "" || link == "#")
                {
                    html += "<a href=\"javascript:;\">";
                }
                else
                {
                    if (link.Contains("http://") == false)
                    {
                        html += "<a target=\"_blank\" href=\"http://" + link + "\">";
                    }
                    else if (link.Contains("http://") == true)
                    {
                        html += "<a target=\"_blank\" href=\"" + link + "\">";
                    }
                }
                if (logotype == "image")
                {
                    html += "<img src=\"Thumbnail.ashx?width=" + _imageWidth + "&height=" + _imageHeight + "&ImgFilePath=" + logosource + "\" alt=\"" + linkname + "\" title=\"" + linkname + "\" />";
                }
                else if (logotype == "flash")
                {
                    int width  = Convert.ToInt32(ds.Tables[0].Rows[i]["Width"]);
                    int height = Convert.ToInt32(ds.Tables[0].Rows[i]["Height"]);

                    html += "<object ";
                    if (width > 0)
                    {
                        html += "width=\"" + width + "\" ";
                    }
                    if (height > 0)
                    {
                        html += "height=\"" + height + "\"";
                    }

                    html += "><param name=\"movie\" value=\"" + logosource + "\" />";
                    html += "<embed src=\"" + logosource + "\" ";
                    if (width > 0)
                    {
                        html += "width=\"" + width + "\" ";
                    }
                    if (height > 0)
                    {
                        html += "height=\"" + height + "\"";
                    }
                    html += "></embed>";
                    html += "</object>";
                }
                html += "</a>";
            }
            Response.Write(html);
        }
        catch { }
    }
コード例 #3
0
        public static string LoadAds(int AgentCatID, string Position, string t)
        {
            string   html       = "";
            AgentCat agent      = new AgentCat();
            Link     obj        = new Link();
            DataSet  ds         = obj.GetLinkByPosition("AgentLink", AgentCatID, Position, t);
            string   link       = "";
            string   logotype   = "";
            string   linkname   = "";
            string   logosource = "";

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                link       = Convert.ToString(ds.Tables[0].Rows[i]["Link"]);
                logotype   = Convert.ToString(ds.Tables[0].Rows[i]["LogoType"]);
                linkname   = Convert.ToString(ds.Tables[0].Rows[i]["LinkName"]);
                logosource = agent.GetUploadHost(AgentCatID) + Convert.ToString(ds.Tables[0].Rows[i]["Logo"]);
                //logosource = Globals.GetUploadsUrl() + Convert.ToString(ds.Tables[0].Rows[i]["Logo"]);
                if (link == "" || link == "#")
                {
                    html += "<a href=\"javascript:;\">";
                }
                else
                {
                    if (link.Contains("http://") == false)
                    {
                        html += "<a target=\"_blank\" href=\"http://" + link + "\">";
                    }
                    else if (link.Contains("http://") == true)
                    {
                        html += "<a target=\"_blank\" href=\"" + link + "\">";
                    }
                }
                if (logotype == "image")
                {
                    html += "<img src=\"" + logosource + "\" class=\"wid_ads\" alt=\"" + linkname + "\" title=\"" + linkname + "\" />";
                }
                else if (logotype == "flash")
                {
                    int width  = Convert.ToInt32(ds.Tables[0].Rows[i]["Width"]);
                    int height = Convert.ToInt32(ds.Tables[0].Rows[i]["Height"]);

                    html += "<object ";
                    if (width > 0)
                    {
                        html += "width=\"" + width + "\" ";
                    }
                    if (height > 0)
                    {
                        html += "height=\"" + height + "\"";
                    }

                    html += "><param name=\"movie\" value=\"images/flash.swf\" />";
                    html += "<embed src=\"" + logosource + "\" ";
                    if (width > 0)
                    {
                        html += "width=\"" + width + "\" ";
                    }
                    if (height > 0)
                    {
                        html += "height=\"" + height + "\"";
                    }
                    html += "></embed>";
                    html += "</object>";
                }
                html += "</a>";
            }
            return(html);
        }