Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (Request.QueryString["aid"] != null)
         {
             int aid = Convert.ToInt32(Request.QueryString["aid"]);
             TravelAgent.Model.Advertising adv = advBll.GetModel(aid);
             if (adv != null)
             {
                 this.lblAdTitle.Text = adv.Title;
                 this.hidaId.Value    = adv.Id.ToString();;
             }
         }
         if (Request.QueryString["id"] != null)
         {
             int barid = Convert.ToInt32(Request.QueryString["id"]);
             TravelAgent.Model.Adbanner bar = banBll.GetModel(barid);
             if (bar != null)
             {
                 this.hidId.Value = bar.Id.ToString();
                 //this.lblAdTitle.Text = bar.Aid.ToString();
                 this.txtTitle.Text           = bar.Title;
                 this.txtStartTime.Text       = bar.StartTime.ToString("yyyy-MM-dd");
                 this.txtEndTime.Text         = bar.EndTime.ToString("yyyy-MM-dd");
                 this.txtImgUrl.Text          = bar.AdUrl;
                 this.txtLinkUrl.Text         = bar.LinkUrl;
                 this.txtAdRemark.Text        = TravelAgent.Tool.StringPlus.ToTxt(bar.AdRemark);
                 this.rblIsLock.SelectedValue = bar.IsLock.ToString();
             }
         }
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DataBindCategory();
                if (Request.QueryString["id"] != null)
                {
                    TravelAgent.Model.Advertising model = bll.GetModel(Convert.ToInt32(Request.QueryString["id"]));

                    if (model != null)
                    {
                        this.hidId.Value               = model.Id.ToString();
                        this.txtTitle.Text             = model.Title;
                        this.rblAdType.SelectedValue   = model.AdType.ToString();
                        this.txtAdRemark.Text          = model.AdRemark;
                        this.txtAdNum.Text             = model.AdNum.ToString();
                        this.txtAdWidth.Text           = model.AdWidth.ToString();
                        this.txtAdHeight.Text          = model.AdHeight.ToString();
                        this.rblAdTarget.SelectedValue = model.AdTarget;
                        this.ddlAdv.SelectedValue      = model.ParentID.ToString();
                        if (model.ParentID == 0)
                        {
                            this.ddlAdv.Enabled = false;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             TravelAgent.BLL.Advertising advBll = new TravelAgent.BLL.Advertising();
             model = advBll.GetModel(Convert.ToInt32(Request.QueryString["id"]));
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TravelAgent.Model.Advertising model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Advertising set ");
            strSql.Append("Title=@Title,");
            strSql.Append("AdType=@AdType,");
            strSql.Append("AdRemark=@AdRemark,");
            strSql.Append("AdNum=@AdNum,");
            strSql.Append("AdPrice=@AdPrice,");
            strSql.Append("AdWidth=@AdWidth,");
            strSql.Append("AdHeight=@AdHeight,");
            strSql.Append("AdTarget=@AdTarget,");
            strSql.Append("AdChannel=@AdChannel,");
            strSql.Append("ParentId=@ParentId,");
            strSql.Append("ClassList=@ClassList,");
            strSql.Append("ClassLayer=@ClassLayer");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Title",      SqlDbType.NVarChar, 100),
                new SqlParameter("@AdType",     SqlDbType.Int,        4),
                new SqlParameter("@AdRemark",   SqlDbType.NVarChar,   0),
                new SqlParameter("@AdNum",      SqlDbType.Int,        4),
                new SqlParameter("@AdPrice",    SqlDbType.Decimal,    9),
                new SqlParameter("@AdWidth",    SqlDbType.Int,        4),
                new SqlParameter("@AdHeight",   SqlDbType.Int,        4),
                new SqlParameter("@AdTarget",   SqlDbType.NVarChar,  50),
                new SqlParameter("@AdChannel",  SqlDbType.Int,        4),
                new SqlParameter("@ParentId",   SqlDbType.Int,        4),
                new SqlParameter("@ClassList",  SqlDbType.NVarChar, 300),
                new SqlParameter("@ClassLayer", SqlDbType.Int,        4),
                new SqlParameter("@Id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.Title;
            parameters[1].Value  = model.AdType;
            parameters[2].Value  = model.AdRemark;
            parameters[3].Value  = model.AdNum;
            parameters[4].Value  = model.AdPrice;
            parameters[5].Value  = model.AdWidth;
            parameters[6].Value  = model.AdHeight;
            parameters[7].Value  = model.AdTarget;
            parameters[8].Value  = model.AdChannel;
            parameters[9].Value  = model.ParentID;
            parameters[10].Value = model.ClassList;
            parameters[11].Value = model.ClassLayer;
            parameters[12].Value = model.Id;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (Request.QueryString["aid"] != null)
         {
             aid = Convert.ToInt32(Request.QueryString["aid"]);
             TravelAgent.Model.Advertising adv = advBll.GetModel(aid);
             if (adv != null)
             {
                 this.lblAdvName.Text = adv.Title;
             }
             DataBindBan(aid);
         }
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(TravelAgent.Model.Advertising model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Advertising(");
            strSql.Append("Title,AdType,AdRemark,AdNum,AdPrice,AdWidth,AdHeight,AdTarget,AdChannel,ParentId,ClassList,ClassLayer)");
            strSql.Append(" values (");
            strSql.Append("@Title,@AdType,@AdRemark,@AdNum,@AdPrice,@AdWidth,@AdHeight,@AdTarget,@AdChannel,@ParentId,@ClassList,@ClassLayer)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Title",      SqlDbType.NVarChar, 100),
                new SqlParameter("@AdType",     SqlDbType.Int,        4),
                new SqlParameter("@AdRemark",   SqlDbType.NVarChar,   0),
                new SqlParameter("@AdNum",      SqlDbType.Int,        4),
                new SqlParameter("@AdPrice",    SqlDbType.Decimal,    9),
                new SqlParameter("@AdWidth",    SqlDbType.Int,        4),
                new SqlParameter("@AdHeight",   SqlDbType.Int,        4),
                new SqlParameter("@AdTarget",   SqlDbType.NVarChar,  50),
                new SqlParameter("@AdChannel",  SqlDbType.Int,        4),
                new SqlParameter("@ParentId",   SqlDbType.Int,        4),
                new SqlParameter("@ClassList",  SqlDbType.NVarChar, 300),
                new SqlParameter("@ClassLayer", SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.Title;
            parameters[1].Value  = model.AdType;
            parameters[2].Value  = model.AdRemark;
            parameters[3].Value  = model.AdNum;
            parameters[4].Value  = model.AdPrice;
            parameters[5].Value  = model.AdWidth;
            parameters[6].Value  = model.AdHeight;
            parameters[7].Value  = model.AdTarget;
            parameters[8].Value  = model.AdChannel;
            parameters[9].Value  = model.ParentID;
            parameters[10].Value = model.ClassList;
            parameters[11].Value = model.ClassLayer;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Esempio n. 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TravelAgent.Model.Advertising model)
 {
     dal.Update(model);
 }
Esempio n. 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(TravelAgent.Model.Advertising model)
 {
     dal.Add(model);
     return(dal.GetMaxID("Id"));
 }
Esempio n. 9
0
        public void ProcessRequest(HttpContext context)
        {
            int aid;

            //获得广告位的ID
            if (!int.TryParse(context.Request.Params["id"] as string, out aid))
            {
                context.Response.Write("document.write('Error,unable to display the ads.');");
                return;
            }

            //检查广告位是否存在
            TravelAgent.BLL.Advertising abll = new TravelAgent.BLL.Advertising();
            if (!abll.Exists(aid))
            {
                context.Response.Write("document.write('Error, the ad does not exist.');");
                return;
            }

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

            //输出该广告位下的广告条,不显示未开始、过期、暂停广告
            TravelAgent.BLL.Adbanner bbll = new TravelAgent.BLL.Adbanner();
            //Access
            //DataSet ds = bbll.GetList(0, "IsLock=0 and datediff('d',StartTime,now())>=0 and datediff('d',EndTime,now())<=0 and Aid=" + aid, "StartTime desc,AddTime desc");
            //SQL
            DataSet ds = bbll.GetList(0, "IsLock=0 and datediff(day,StartTime,getdate())>=0 and datediff(day,EndTime,getdate())<=0 and Aid=" + aid, "StartTime desc,AddTime desc");

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

            //=================判断广告位类别,输出广告条======================
            switch (aModel.AdType)
            {
            case 1:     //文字
                context.Response.Write("document.write('<ul>');\n");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    //如果超出限制广告数量,则退出循环
                    if (i >= aModel.AdNum)
                    {
                        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.AdTarget + "\" href=\"" + dr["LinkUrl"] + "\">" + 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.AdTarget + "\" href=\"" + dr["LinkUrl"] + "\">');");
                    context.Response.Write("document.write('<img src=\"" + dr["AdUrl"] + "\" width=" + aModel.AdWidth + " height=" + aModel.AdHeight + " border=0 />');");
                    context.Response.Write("document.write('</a>');");
                }
                else
                {
                    context.Response.Write("document.write('<ul class=\"" + context.Request.Params["class"] + "\">');\n");
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        //如果超出限制广告数量,则退出循环
                        if (i >= aModel.AdNum)
                        {
                            break;
                        }
                        DataRow dr = ds.Tables[0].Rows[i];
                        context.Response.Write("document.write('<li><a title=\"" + dr["Title"] + "\" target=\"" + aModel.AdTarget + "\" href=\"" + dr["LinkUrl"] + "\"><img src=\"" + dr["AdUrl"] + "\" width=" + aModel.AdWidth + " height=" + aModel.AdHeight + " border=0 /></a></li>');");
                        //context.Response.Write("document.write('');");
                        //context.Response.Write("document.write('');");
                        //context.Response.Write("document.write('');\n");
                        //context.Response.Write("document.write('');\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.AdNum)
                    {
                        break;
                    }
                    DataRow dr = ds.Tables[0].Rows[i];
                    //picTitle.Append(dr["Title"].ToString());
                    picUrl.Append(dr["AdUrl"].ToString());
                    picLink.Append(dr["LinkUrl"].ToString());
                    if (i < ds.Tables[0].Rows.Count - 1)
                    {
                        //picTitle.Append("|");
                        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.AdWidth + "\" height=\"" + aModel.AdHeight + "\">');\n");
                context.Response.Write("document.write('<param name=\"movie\" value=\"/images/focus.swf?bcastr_flie=" + picUrl + "&bcastr_link=" + picLink + "&bcastr_title=" + picTitle + "\">');\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=\"/images/focus.swf?bcastr_flie=" + picUrl + "&bcastr_link=" + picLink + "&bcastr_title=" + picTitle + "\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\" 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.AdWidth + "\" height=\"" + aModel.AdHeight + "\">');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["AdUrl"] + "\">');\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["AdUrl"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\" 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.AdNum)
                        {
                            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.AdWidth + "\" height=\"" + aModel.AdHeight + "\">');\n");
                        context.Response.Write("document.write('<param name=\"movie\" value=\"" + dr["AdUrl"] + "\">');\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["AdUrl"] + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + aModel.AdWidth + "\" height=\"" + aModel.AdHeight + "\" 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.AdWidth + " height=" + aModel.AdHeight + " viewastext>');\n");
                    context.Response.Write("document.write('<param name=\"movie\" value=\"/images/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=upLoadFiles/file/2014051614005181.swf&LogoText=学知修学网&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["AdRemark"].ToString());
                    sb.Replace("&lt;", "<");
                    sb.Replace("&gt;", ">");
                    sb.Replace("\"", "'");
                    context.Response.Write("document.write(\"" + sb.ToString() + "\")");
                }
                break;
            }
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (Request["tag"] != null)
                {
                    string strTag = Request["tag"];
                    if (strTag == "category")//新闻分类设置
                    {
                        int    nav_editid = Convert.ToInt32(Request["hidId"]);
                        int    navId;
                        int    parentId = Convert.ToInt32(Request["ddlCategory"]); //上一级目录
                        int    navLayer = 1;                                       //栏目深度
                        string navList  = "";
                        TravelAgent.Model.Category category = new TravelAgent.Model.Category();
                        category.Title      = Request["txtName"];
                        category.ParentId   = parentId;
                        category.PageUrl    = Request["txtURL"];
                        category.ClassList  = "";
                        category.ClassOrder = Convert.ToInt32(Request["txtSort"]);
                        category.KindId     = this.kindId;
                        category.State      = Request["chkState"] == null?"0":"1";
                        category.Css        = "";
                        if (nav_editid == 0)
                        {
                            //添加导航
                            navId = CategoryBll.Add(category);
                        }
                        else
                        {
                            navId = nav_editid;
                        }
                        //修改导航的下属导航ID列表
                        if (parentId > 0)
                        {
                            DataSet ds = CategoryBll.GetChannelListByClassId(parentId);

                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                DataRow dr = ds.Tables[0].Rows[0];
                                navList  = dr["ClassList"].ToString().Trim() + navId + ",";
                                navLayer = Convert.ToInt32(dr["ClassLayer"]) + 1;
                            }
                        }
                        else
                        {
                            navList  = "," + navId + ",";
                            navLayer = 1;
                        }
                        category.Id         = navId;
                        category.ClassList  = navList;
                        category.ClassLayer = navLayer;

                        try
                        {
                            CategoryBll.Update(category);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "category_delete")//删除新闻分类
                    {
                        int categoryid = Convert.ToInt32(Request["categoryid"]);
                        try
                        {
                            CategoryBll.Delete(categoryid);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "new_delete")//删除内容
                    {
                        int categoryid = Convert.ToInt32(Request["newid"]);
                        try
                        {
                            ArticleBll.Delete(categoryid);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "adv")//广告位
                    {
                        int adv_Id;
                        int advid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.Advertising model = new TravelAgent.Model.Advertising();
                        model.Title     = Request["txtTitle"];
                        model.AdType    = Convert.ToInt32(Request["rblAdType"]);
                        model.AdRemark  = Request["txtAdRemark"];
                        model.AdNum     = Convert.ToInt32(Request["txtAdNum"]);
                        model.AdPrice   = 0;
                        model.AdWidth   = Convert.ToInt32(Request["txtAdWidth"]);
                        model.AdHeight  = Convert.ToInt32(Request["txtAdHeight"]);
                        model.AdTarget  = Request["rblAdTarget"];
                        model.AdChannel = 0;
                        int parentId = Convert.ToInt32(Request["ddlAdv"]);       //上一级目录
                        model.ParentID  = parentId;
                        model.ClassList = "";
                        int    Layer = 1;                                      //栏目深度
                        string List  = "";
                        if (advid == 0)
                        {
                            //添加导航
                            adv_Id = AdvBll.Add(model);
                        }
                        else
                        {
                            adv_Id = advid;
                        }
                        //修改导航的下属导航ID列表
                        if (parentId > 0)
                        {
                            DataSet ds = CategoryBll.GetChannelListByClassId(parentId);

                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                DataRow dr = ds.Tables[0].Rows[0];
                                List  = dr["ClassList"].ToString().Trim() + adv_Id + ",";
                                Layer = Convert.ToInt32(dr["ClassLayer"]) + 1;
                            }
                        }
                        else
                        {
                            List  = "," + adv_Id + ",";
                            Layer = 1;
                        }
                        model.Id         = adv_Id;
                        model.ClassList  = List;
                        model.ClassLayer = Layer;
                        try
                        {
                            AdvBll.Update(model);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "adv_delete")//删除广告位
                    {
                        int advid = Convert.ToInt32(Request["advid"]);
                        try
                        {
                            AdvBll.Delete(advid);      //删除广告位
                            BarBll.DeleteByAID(advid); //同时删除广告位下面的广告
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "bar")//广告内容
                    {
                        int barid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.Adbanner model = new TravelAgent.Model.Adbanner();
                        model.Title     = Request["txtTitle"];
                        model.StartTime = DateTime.Parse(Request["txtStartTime"]);
                        model.EndTime   = DateTime.Parse(Request["txtEndTime"]);
                        model.AdUrl     = Request["txtImgUrl"];
                        model.LinkUrl   = Request["txtLinkUrl"];
                        model.AdRemark  = TravelAgent.Tool.StringPlus.ToHtml(Request["txtAdRemark"]);
                        model.IsLock    = int.Parse(Request["rblIsLock"]);
                        model.AddTime   = DateTime.Now;
                        model.Aid       = int.Parse(Request["hidaId"]);
                        try
                        {
                            if (barid != 0)
                            {
                                model.Id = barid;
                                BarBll.Update(model);
                            }
                            else
                            {
                                BarBll.Add(model);
                            }
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "bar_delete")
                    {
                        int barid = Convert.ToInt32(Request["barid"]);
                        try
                        {
                            BarBll.Delete(barid);

                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "links")//友情链接
                    {
                        int linkid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.Links model = new TravelAgent.Model.Links();
                        model.Title    = Request["txtName"];
                        model.WebUrl   = Request["txtURL"];
                        model.UserName = Request["txtContactName"];
                        model.UserTel  = Request["txtLinkContent"];
                        model.UserMail = Request["txtEmail"];
                        model.SortId   = Convert.ToInt32(Request["txtSort"]);
                        model.IsLock   = Request["chkState"] == null?0:1;
                        model.AddTime  = DateTime.Now;
                        model.IsImage  = 0;
                        model.IsRed    = 1;
                        model.ImgUrl   = "";
                        try
                        {
                            if (linkid != 0)
                            {
                                model.Id = linkid;
                                linkBll.Update(model);
                            }
                            else
                            {
                                linkBll.Add(model);
                            }
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "link_delete")//友情链接
                    {
                        int linkid = Convert.ToInt32(Request["linkid"]);
                        try
                        {
                            linkBll.Delete(linkid);

                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "brand_save")//网站优势
                    {
                        int brandid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.VisaBrand model = new TravelAgent.Model.VisaBrand();
                        model.Title    = Request["txtTitle"];
                        model.SubTitle = Request["txtSubTitle"];
                        model.PicUrl   = "";
                        model.Type     = Convert.ToInt32(Request["ddlType"]);
                        model.Sort     = Convert.ToInt32(Request["txtSort"]);
                        model.isLock   = Request["chkState"] == null ? 0 : 1;
                        try
                        {
                            if (brandid != 0)
                            {
                                model.Id = brandid;
                                BrandBll.Update(model);
                            }
                            else
                            {
                                BrandBll.Add(model);
                            }
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "brand_delete")//网站优势
                    {
                        int brandid = Convert.ToInt32(Request["brandid"]);
                        try
                        {
                            BrandBll.Delete(brandid);

                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TravelAgent.Model.Advertising GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,Title,AdType,AdRemark,AdNum,AdPrice,AdWidth,AdHeight,AdTarget,AdChannel,ParentId,ClassList,ClassLayer from Advertising ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                if (ds.Tables[0].Rows[0]["AdType"].ToString() != "")
                {
                    model.AdType = int.Parse(ds.Tables[0].Rows[0]["AdType"].ToString());
                }
                model.AdRemark = ds.Tables[0].Rows[0]["AdRemark"].ToString();
                if (ds.Tables[0].Rows[0]["AdNum"].ToString() != "")
                {
                    model.AdNum = int.Parse(ds.Tables[0].Rows[0]["AdNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AdPrice"].ToString() != "")
                {
                    model.AdPrice = int.Parse(ds.Tables[0].Rows[0]["AdPrice"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AdWidth"].ToString() != "")
                {
                    model.AdWidth = int.Parse(ds.Tables[0].Rows[0]["AdWidth"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AdHeight"].ToString() != "")
                {
                    model.AdHeight = int.Parse(ds.Tables[0].Rows[0]["AdHeight"].ToString());
                }
                model.AdTarget = ds.Tables[0].Rows[0]["AdTarget"].ToString();
                if (ds.Tables[0].Rows[0]["AdChannel"].ToString() != "")
                {
                    model.AdChannel = int.Parse(ds.Tables[0].Rows[0]["AdChannel"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ParentId"].ToString() != "")
                {
                    model.ParentID = int.Parse(ds.Tables[0].Rows[0]["ParentId"].ToString());
                }
                model.ClassList = ds.Tables[0].Rows[0]["ClassList"].ToString();
                if (ds.Tables[0].Rows[0]["ClassLayer"].ToString() != "")
                {
                    model.ClassLayer = int.Parse(ds.Tables[0].Rows[0]["ClassLayer"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }