Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.plugins.advert model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update " + databaseprefix + "advert set ");
            strSql.Append("title=@title,");
            strSql.Append("type=@type,");
            strSql.Append("price=@price,");
            strSql.Append("remark=@remark,");
            strSql.Append("view_num=@view_num,");
            strSql.Append("view_width=@view_width,");
            strSql.Append("view_height=@view_height,");
            strSql.Append("target=@target,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",       SqlDbType.NVarChar,  100),
                new SqlParameter("@type",        SqlDbType.TinyInt,     1),
                new SqlParameter("@price",       SqlDbType.Decimal,     9),
                new SqlParameter("@remark",      SqlDbType.NVarChar,  255),
                new SqlParameter("@view_num",    SqlDbType.Int,         4),
                new SqlParameter("@view_width",  SqlDbType.Int,         4),
                new SqlParameter("@view_height", SqlDbType.Int,         4),
                new SqlParameter("@target",      SqlDbType.NVarChar,   30),
                new SqlParameter("@add_time",    SqlDbType.DateTime),
                new SqlParameter("@id",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.title;
            parameters[1].Value = model.type;
            parameters[2].Value = model.price;
            parameters[3].Value = model.remark;
            parameters[4].Value = model.view_num;
            parameters[5].Value = model.view_width;
            parameters[6].Value = model.view_height;
            parameters[7].Value = model.target;
            parameters[8].Value = model.add_time;
            parameters[9].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.plugins.advert   bll   = new BLL.plugins.advert();
            Model.plugins.advert model = bll.GetModel(_id);

            txtTitle.Text           = model.title;
            rblType.SelectedValue   = model.type.ToString();
            txtRemark.Text          = model.remark;
            txtViewNum.Text         = model.view_num.ToString();
            txtPrice.Text           = model.price.ToString();
            txtViewWidth.Text       = model.view_width.ToString();
            txtViewHeight.Text      = model.view_height.ToString();
            rblTarget.SelectedValue = model.target;
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.id = OSRequest.GetQueryInt("id", 0);
            if (this.id < 1)
            {
                PageErrorMsg("传输参数不正确");
            }

            if (!new BLL.plugins.advert().Exists(this.id))
            {
                PageErrorMsg("信息不存在或已被删除");
            }
            if (!Page.IsPostBack)
            {
                model = new BLL.plugins.advert().GetModel(id);
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.id = OSRequest.GetQueryInt("id", 0);
            if (this.id < 1)
            {
                PageErrorMsg("传输参数不正确");
            }

            if (!new BLL.plugins.advert().Exists(this.id))
            {
                PageErrorMsg("信息不存在或已被删除");
            }
            if (!Page.IsPostBack)
            {
                model = new BLL.plugins.advert().GetModel(id);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.plugins.advert model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into " + databaseprefix + "advert(");
            strSql.Append("title,type,price,remark,view_num,view_width,view_height,target,add_time)");
            strSql.Append(" values (");
            strSql.Append("@title,@type,@price,@remark,@view_num,@view_width,@view_height,@target,@add_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",       SqlDbType.NVarChar, 100),
                new SqlParameter("@type",        SqlDbType.TinyInt,    1),
                new SqlParameter("@price",       SqlDbType.Decimal,    9),
                new SqlParameter("@remark",      SqlDbType.NVarChar, 255),
                new SqlParameter("@view_num",    SqlDbType.Int,        4),
                new SqlParameter("@view_width",  SqlDbType.Int,        4),
                new SqlParameter("@view_height", SqlDbType.Int,        4),
                new SqlParameter("@target",      SqlDbType.NVarChar,  30),
                new SqlParameter("@add_time",    SqlDbType.DateTime)
            };
            parameters[0].Value = model.title;
            parameters[1].Value = model.type;
            parameters[2].Value = model.price;
            parameters[3].Value = model.remark;
            parameters[4].Value = model.view_num;
            parameters[5].Value = model.view_width;
            parameters[6].Value = model.view_height;
            parameters[7].Value = model.target;
            parameters[8].Value = model.add_time;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 6
0
        private bool DoAdd()
        {
            bool result = false;
            Model.plugins.advert model = new Model.plugins.advert();
            BLL.plugins.advert bll = new BLL.plugins.advert();

            model.title = txtTitle.Text.Trim();
            model.type = int.Parse(rblType.SelectedValue);
            model.price = decimal.Parse(txtPrice.Text.Trim());
            model.remark = txtRemark.Text.Trim();
            model.view_num = int.Parse(txtViewNum.Text.Trim());
            model.view_width = int.Parse(txtViewWidth.Text.Trim());
            model.view_height = int.Parse(txtViewHeight.Text.Trim());
            model.target = rblTarget.SelectedValue;

            if (bll.Add(model) >0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加广告位:" + model.title); //记录日志
                result = true;
            }
            return result;
        }
Ejemplo n.º 7
0
        private bool DoAdd()
        {
            bool result = false;

            Model.plugins.advert model = new Model.plugins.advert();
            BLL.plugins.advert   bll   = new BLL.plugins.advert();

            model.title       = txtTitle.Text.Trim();
            model.type        = int.Parse(rblType.SelectedValue);
            model.price       = decimal.Parse(txtPrice.Text.Trim());
            model.remark      = txtRemark.Text.Trim();
            model.view_num    = int.Parse(txtViewNum.Text.Trim());
            model.view_width  = int.Parse(txtViewWidth.Text.Trim());
            model.view_height = int.Parse(txtViewHeight.Text.Trim());
            model.target      = rblTarget.SelectedValue;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "添加广告位:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.plugins.advert model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.plugins.advert model)
 {
     return(dal.Add(model));
 }
Ejemplo n.º 10
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public Model.plugins.advert GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,title,type,price,remark,view_num,view_width,view_height,target,add_time from " + databaseprefix + "advert ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)};
            parameters[0].Value = id;

            Model.plugins.advert model = new Model.plugins.advert();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["type"] != null && ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.type = int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["price"] != null && ds.Tables[0].Rows[0]["price"].ToString() != "")
                {
                    model.price = decimal.Parse(ds.Tables[0].Rows[0]["price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["remark"] != null && ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["view_num"] != null && ds.Tables[0].Rows[0]["view_num"].ToString() != "")
                {
                    model.view_num = int.Parse(ds.Tables[0].Rows[0]["view_num"].ToString());
                }
                if (ds.Tables[0].Rows[0]["view_width"] != null && ds.Tables[0].Rows[0]["view_width"].ToString() != "")
                {
                    model.view_width = int.Parse(ds.Tables[0].Rows[0]["view_width"].ToString());
                }
                if (ds.Tables[0].Rows[0]["view_height"] != null && ds.Tables[0].Rows[0]["view_height"].ToString() != "")
                {
                    model.view_height = int.Parse(ds.Tables[0].Rows[0]["view_height"].ToString());
                }
                model.target = ds.Tables[0].Rows[0]["target"].ToString();
                if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Ejemplo n.º 11
0
        public void ProcessRequest(HttpContext context)
        {
            int aid = OSRequest.GetQueryInt("id");

            //获得广告位的ID
            if (aid < 1)
            {
                context.Response.Write("document.write('错误提示,请勿提交非法字符!');");
                return;
            }

            //检查广告位是否存在
            BLL.plugins.advert abll = new BLL.plugins.advert();
            if (!abll.Exists(aid))
            {
                context.Response.Write("document.write('错误提示,该广告位不存在!');");
                return;
            }

            //取得该广告位详细信息
            Model.plugins.advert aModel = abll.GetModel(aid);

            //输出该广告位下的广告条,不显示未开始、过期、暂停广告
            BLL.plugins.advert_banner bbll = new BLL.plugins.advert_banner();
            DataSet ds = bbll.GetList("is_lock=0 and datediff(d,start_time,getdate())>=0 and datediff(d,end_time,getdate())<=0 and aid=" + aid);

            if (ds.Tables[0].Rows.Count < 1)
            {
                context.Response.Write("document.write('该广告位下暂无广告内容');");
                return;
            }

            //=================判断广告位类别,输出广告条======================

            //新增,取得站点配置信息
            Model.configs.siteconfig siteConfig = new BLL.configs.siteconfig().loadConfig();      //获得站点配置信息


            switch (aModel.type)
            {
            case 1:     //文字
                context.Response.Write("document.write('<ul>');\n");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= aModel.view_num)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    context.Response.Write("document.write('<li>');");
                    context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">" + dr["title"] + "</a>');");
                    context.Response.Write("document.write('</li>');\n");
                }
                context.Response.Write("document.write('</ul>');\n");
                break;

            case 2:     //图片
                if (ds.Tables[0].Rows.Count == 1)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">');");
                    context.Response.Write("document.write('<img src=\"" + dr["file_path"] + "\" width=" + aModel.view_width + " height=" + aModel.view_height + " border=0 />');");
                    context.Response.Write("document.write('</a>');");
                }
                else
                {
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.view_num)
                        {
                            break;
                        }
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<a title=\"" + dr["title"] + "\" target=\"" + aModel.target + "\" href=\"" + dr["link_url"] + "\">');");
                        context.Response.Write("document.write('<img src=\"" + dr["file_path"] + "\" width=" + aModel.view_width + " height=" + aModel.view_height + " border=0 />');");
                        context.Response.Write("document.write('</a>');\n");
                        context.Response.Write("document.write('</li>');\n");
                    }
                    context.Response.Write("document.write('</ul>');\n");
                }
                break;

            case 3:     //幻灯片
                StringBuilder picTitle = new StringBuilder();
                StringBuilder picUrl   = new StringBuilder();
                StringBuilder picLink  = new StringBuilder();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= aModel.view_num)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    picUrl.Append(dr["file_path"].ToString());
                    picLink.Append(dr["link_url"].ToString());
                    if (i < ds.Tables[0].Rows.Count - 1)
                    {
                        picUrl.Append("|");
                        picLink.Append("|");
                    }
                }
                context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" d=scriptmain name=scriptmain codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                context.Response.Write("document.write('<param name=\"movie\" value=\"/plugins/focus.swf?width=" + aModel.view_width + "&height=" + aModel.view_height + "&bigSrc=" + picUrl + "&href=" + picLink + "\">');\n");
                context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                context.Response.Write("document.write('<param name=\"loop\" value=\"false\">');\n");
                context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                context.Response.Write("document.write('<embed src=\"/plugins/focus.swf?width=" + aModel.view_width + "&height=" + aModel.view_height + "&bigSrc=" + picUrl + "&href=" + picLink + "\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" loop=\"false\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" menu=\"false\"></embed>');\n");
                context.Response.Write("document.write('</object>');\n");
                break;

            case 4:     //动画
                if (ds.Tables[0].Rows.Count == 1)
                {
                    DataRow dr = ds.Tables[0].Rows[0];
                    context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["file_path"] + "\">');\n");
                    context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                    context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                    context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                    context.Response.Write("document.write('<embed src=\"" + dr["file_path"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" quality=\"High\" wmode=\"transparent\">');\n");
                    context.Response.Write("document.write('</embed>');\n");
                    context.Response.Write("document.write('</object>');\n");
                }
                else
                {
                    context.Response.Write("document.write('<ul>');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.view_num)
                        {
                            break;
                        }
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li>');");
                        context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11CF-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\">');\n");
                        context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["file_path"] + "\">');\n");
                        context.Response.Write("document.write('<param name=\"quality\" value=\"high\">');\n");
                        context.Response.Write("document.write('<param name=\"wmode\" value=\"transparent\">');\n");
                        context.Response.Write("document.write('<param name=\"menu\" value=\"false\">');\n");
                        context.Response.Write("document.write('<embed src=\"" + dr["file_path"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.view_width + "\" height=\"" + aModel.view_height + "\" quality=\"High\" wmode=\"transparent\">');\n");
                        context.Response.Write("document.write('</embed>');\n");
                        context.Response.Write("document.write('</object>');\n");
                        context.Response.Write("document.write('</li>');\n");
                    }
                    context.Response.Write("document.write('</ul>');\n");
                }
                break;

            case 5:    //视频
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= 1)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    context.Response.Write("document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" width=" + aModel.view_width + " height=" + aModel.view_height + " viewastext>');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"/plugins/player.swf\" />');\n");
                    context.Response.Write("document.write('<param name=\"quality\" value=\"high\" />');\n");
                    context.Response.Write("document.write('<param name=\"allowFullScreen\" value=\"true\" />');\n");
                    context.Response.Write("document.write('<param name=\"FlashVars\" value=\"vcastr_file=" + dr["file_path"].ToString() + "&LogoText=www.auto.cn&BarTransparent=30&BarColor=0xffffff&IsAutoPlay=1&IsContinue=1\" />');\n");
                    context.Response.Write("document.write('</object>');\n");
                }
                break;

            case 6:    //代码
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= 1)
                    {
                        break;
                    }
                    DataRow       dr = ds.Tables[0].Rows[i];
                    StringBuilder sb = new StringBuilder(dr["content"].ToString());
                    sb.Replace("&lt;", "<");
                    sb.Replace("&gt;", ">");
                    sb.Replace("\"", "'");
                    context.Response.Write("document.write(\"" + sb.ToString() + "\")");
                }
                break;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.plugins.advert GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,title,type,price,remark,view_num,view_width,view_height,target,add_time from " + databaseprefix + "advert ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Model.plugins.advert model = new Model.plugins.advert();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["title"] != null && ds.Tables[0].Rows[0]["title"].ToString() != "")
                {
                    model.title = ds.Tables[0].Rows[0]["title"].ToString();
                }
                if (ds.Tables[0].Rows[0]["type"] != null && ds.Tables[0].Rows[0]["type"].ToString() != "")
                {
                    model.type = int.Parse(ds.Tables[0].Rows[0]["type"].ToString());
                }
                if (ds.Tables[0].Rows[0]["price"] != null && ds.Tables[0].Rows[0]["price"].ToString() != "")
                {
                    model.price = decimal.Parse(ds.Tables[0].Rows[0]["price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["remark"] != null && ds.Tables[0].Rows[0]["remark"].ToString() != "")
                {
                    model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["view_num"] != null && ds.Tables[0].Rows[0]["view_num"].ToString() != "")
                {
                    model.view_num = int.Parse(ds.Tables[0].Rows[0]["view_num"].ToString());
                }
                if (ds.Tables[0].Rows[0]["view_width"] != null && ds.Tables[0].Rows[0]["view_width"].ToString() != "")
                {
                    model.view_width = int.Parse(ds.Tables[0].Rows[0]["view_width"].ToString());
                }
                if (ds.Tables[0].Rows[0]["view_height"] != null && ds.Tables[0].Rows[0]["view_height"].ToString() != "")
                {
                    model.view_height = int.Parse(ds.Tables[0].Rows[0]["view_height"].ToString());
                }
                model.target = ds.Tables[0].Rows[0]["target"].ToString();
                if (ds.Tables[0].Rows[0]["add_time"] != null && ds.Tables[0].Rows[0]["add_time"].ToString() != "")
                {
                    model.add_time = DateTime.Parse(ds.Tables[0].Rows[0]["add_time"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }