예제 #1
0
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public void Add(TravelAgent.Model.Links model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into Links(");
			strSql.Append("Title,UserName,UserTel,UserMail,WebUrl,ImgUrl,IsImage,IsRed,IsLock,SortId,AddTime)");
			strSql.Append(" values (");
            strSql.Append("@Title,@UserName,@UserTel,@UserMail,@WebUrl,@ImgUrl,@IsImage,@IsRed,@IsLock,@SortId,@AddTime)");
			SqlParameter[] parameters = {
					new SqlParameter("@Title", SqlDbType.NVarChar,100),
					new SqlParameter("@UserName", SqlDbType.NVarChar,20),
					new SqlParameter("@UserTel", SqlDbType.NVarChar,250),
					new SqlParameter("@UserMail", SqlDbType.NVarChar,30),
					new SqlParameter("@WebUrl", SqlDbType.NVarChar,250),
					new SqlParameter("@ImgUrl", SqlDbType.NVarChar,250),
					new SqlParameter("@IsImage", SqlDbType.Int,4),
                    new SqlParameter("@IsRed", SqlDbType.Int,4),
					new SqlParameter("@IsLock", SqlDbType.Int,4),
					new SqlParameter("@SortId", SqlDbType.Int,4),
					new SqlParameter("@AddTime", SqlDbType.DateTime)};
			parameters[0].Value = model.Title;
			parameters[1].Value = model.UserName;
			parameters[2].Value = model.UserTel;
			parameters[3].Value = model.UserMail;
			parameters[4].Value = model.WebUrl;
			parameters[5].Value = model.ImgUrl;
			parameters[6].Value = model.IsImage;
            parameters[7].Value = model.IsRed;
			parameters[8].Value = model.IsLock;
			parameters[9].Value = model.SortId;
			parameters[10].Value = model.AddTime;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
		}
예제 #2
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public TravelAgent.Model.Links GetModel(int Id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 Id,Title,UserName,UserTel,UserMail,WebUrl,ImgUrl,IsImage,IsRed,IsLock,SortId,AddTime from Links ");
			strSql.Append(" where Id=@Id ");
			SqlParameter[] parameters = {
					new SqlParameter("@Id", SqlDbType.Int,4)};
			parameters[0].Value = Id;

			TravelAgent.Model.Links model=new TravelAgent.Model.Links();
			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();
				model.UserName=ds.Tables[0].Rows[0]["UserName"].ToString();
				model.UserTel=ds.Tables[0].Rows[0]["UserTel"].ToString();
				model.UserMail=ds.Tables[0].Rows[0]["UserMail"].ToString();
				model.WebUrl=ds.Tables[0].Rows[0]["WebUrl"].ToString();
				model.ImgUrl=ds.Tables[0].Rows[0]["ImgUrl"].ToString();
				if(ds.Tables[0].Rows[0]["IsImage"].ToString()!="")
				{
					model.IsImage=int.Parse(ds.Tables[0].Rows[0]["IsImage"].ToString());
				}
                if (ds.Tables[0].Rows[0]["IsRed"].ToString() != "")
                {
                    model.IsRed = int.Parse(ds.Tables[0].Rows[0]["IsRed"].ToString());
                }
				if(ds.Tables[0].Rows[0]["IsLock"].ToString()!="")
				{
					model.IsLock=int.Parse(ds.Tables[0].Rows[0]["IsLock"].ToString());
				}
				if(ds.Tables[0].Rows[0]["SortId"].ToString()!="")
				{
					model.SortId=int.Parse(ds.Tables[0].Rows[0]["SortId"].ToString());
				}
				if(ds.Tables[0].Rows[0]["AddTime"].ToString()!="")
				{
					model.AddTime=DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
				}
				return model;
			}
			else
			{
				return null;
			}
		}
예제 #3
0
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public void Update(TravelAgent.Model.Links model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update Links set ");
			strSql.Append("Title=@Title,");
			strSql.Append("UserName=@UserName,");
			strSql.Append("UserTel=@UserTel,");
			strSql.Append("UserMail=@UserMail,");
			strSql.Append("WebUrl=@WebUrl,");
			strSql.Append("ImgUrl=@ImgUrl,");
			strSql.Append("IsImage=@IsImage,");
            strSql.Append("IsRed=@IsRed,");
			strSql.Append("IsLock=@IsLock,");
			strSql.Append("SortId=@SortId,");
			strSql.Append("AddTime=@AddTime");
			strSql.Append(" where Id=@Id ");
			SqlParameter[] parameters = {
					new SqlParameter("@Title", SqlDbType.NVarChar,100),
					new SqlParameter("@UserName", SqlDbType.NVarChar,20),
					new SqlParameter("@UserTel", SqlDbType.NVarChar,250),
					new SqlParameter("@UserMail", SqlDbType.NVarChar,30),
					new SqlParameter("@WebUrl", SqlDbType.NVarChar,250),
					new SqlParameter("@ImgUrl", SqlDbType.NVarChar,250),
					new SqlParameter("@IsImage", SqlDbType.Int,4),
                    new SqlParameter("@IsRed", SqlDbType.Int,4),
					new SqlParameter("@IsLock", SqlDbType.Int,4),
					new SqlParameter("@SortId", SqlDbType.Int,4),
					new SqlParameter("@AddTime", SqlDbType.DateTime),
                    new SqlParameter("@Id", SqlDbType.Int,4)};
			parameters[0].Value = model.Title;
			parameters[1].Value = model.UserName;
			parameters[2].Value = model.UserTel;
			parameters[3].Value = model.UserMail;
			parameters[4].Value = model.WebUrl;
			parameters[5].Value = model.ImgUrl;
			parameters[6].Value = model.IsImage;
            parameters[7].Value = model.IsRed;
			parameters[8].Value = model.IsLock;
			parameters[9].Value = model.SortId;
			parameters[10].Value = model.AddTime;
            parameters[11].Value = model.Id;

			DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
		}
예제 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (Request.QueryString["id"] != null)
         {
             int linkid = Convert.ToInt32(Request.QueryString["id"]);
             TravelAgent.BLL.Links   LinkBll = new TravelAgent.BLL.Links();
             TravelAgent.Model.Links model   = LinkBll.GetModel(linkid);
             if (model != null)
             {
                 this.hidId.Value         = model.Id.ToString();
                 this.txtName.Text        = model.Title;
                 this.txtURL.Text         = model.WebUrl;
                 this.txtContactName.Text = model.UserName;
                 this.txtLinkContent.Text = model.UserTel;
                 this.txtEmail.Text       = model.UserMail;
                 this.txtSort.Text        = model.SortId.ToString();
                 this.chkState.Checked    = model.IsLock == 1;
             }
         }
     }
 }
예제 #5
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");
                        }
                    }
                }
            }
        }