/// <summary> /// 更新一条数据 /// </summary> public void Update(TravelAgent.Model.LineTheme model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update LineTheme set "); strSql.Append("themeName=@themeName,"); strSql.Append("themeTopPic=@themeTopPic,"); strSql.Append("themeTopBgPic=@themeTopBgPic,"); strSql.Append("Sort=@Sort,"); strSql.Append("isLock=@isLock"); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@themeName", SqlDbType.NVarChar, 50), new SqlParameter("@themeTopPic", SqlDbType.NVarChar, 255), new SqlParameter("@themeTopBgPic", SqlDbType.NVarChar, 255), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@isLock", SqlDbType.Int), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.themeName; parameters[1].Value = model.themeTopPic; parameters[2].Value = model.themeTopBgPic; parameters[3].Value = model.Sort; parameters[4].Value = model.isLock; parameters[5].Value = model.Id; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
protected void Page_Load(object sender, EventArgs e) { int.TryParse(Request.QueryString["id"], out id); int.TryParse(Request.QueryString["page"], out page); if (!this.IsPostBack) { if (id > 0) { TravelAgent.Model.LineTheme theme = ThemeBll.GetModel(id); if (theme != null) { strBackgroudUrl = theme.themeTopPic; this.ltTitle.Text = theme.themeName; this.Title = theme.themeName + "-主题旅游-" + Master.webinfo.WebName; } } else { this.Title = "主题旅游-" + Master.webinfo.WebName; } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request.QueryString["themeid"] != null) { TravelAgent.Model.LineTheme model = ThemeBll.GetModel(Convert.ToInt32(Request.QueryString["themeid"])); if (model != null) { this.txtThemeName.Text = model.themeName; this.txtImgUrl.Text = model.themeTopPic; this.txtSort.Text = model.Sort.ToString(); this.hidId.Value = model.Id.ToString(); this.chkIsLock.Checked = model.isLock == 1; } } else { this.txtSort.Text = (ThemeBll.GetMaxID("Sort") + 1).ToString(); } } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(TravelAgent.Model.LineTheme model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into LineTheme("); strSql.Append("themeName,themeTopPic,themeTopBgPic,Sort,isLock)"); strSql.Append(" values ("); strSql.Append("@themeName,@themeTopPic,@themeTopBgPic,@Sort,@isLock)"); SqlParameter[] parameters = { new SqlParameter("@themeName", SqlDbType.NVarChar, 50), new SqlParameter("@themeTopPic", SqlDbType.NVarChar, 255), new SqlParameter("@themeTopBgPic", SqlDbType.NVarChar, 255), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@isLock", SqlDbType.Int) }; parameters[0].Value = model.themeName; parameters[1].Value = model.themeTopPic; parameters[2].Value = model.themeTopBgPic; parameters[3].Value = model.Sort; parameters[4].Value = model.isLock; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public TravelAgent.Model.LineTheme GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,themeName,themeTopPic,themeTopBgPic,Sort,isLock from LineTheme "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; TravelAgent.Model.LineTheme model = new TravelAgent.Model.LineTheme(); 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.themeName = ds.Tables[0].Rows[0]["themeName"].ToString(); model.themeTopPic = ds.Tables[0].Rows[0]["themeTopPic"].ToString(); model.themeTopBgPic = ds.Tables[0].Rows[0]["themeTopBgPic"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } model.isLock = int.Parse(ds.Tables[0].Rows[0]["isLock"].ToString()); return(model); } else { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request["tag"] != null) { string strTag = Request["tag"]; if (strTag == "dest")//目的地设置 { int nav_editid = Convert.ToInt32(Request["hidId"]); int navId; int parentId = Convert.ToInt32(Request["ddlDest"]); //上一级目录 int navLayer = 1; //栏目深度 string navList = ""; TravelAgent.Model.Destination dest = new TravelAgent.Model.Destination(); dest.navName = Request["txtDestName"]; dest.navParentId = parentId; dest.navURL = Request["txtDestURL"]; dest.navList = ""; dest.navSort = Convert.ToInt32(Request["txtSort"]); dest.kindId = this.kindId; dest.State = Request["hidState"]; dest.isLock = Request["chkLock"] == null ? 0 : 1; if (nav_editid == 0) { //添加导航 navId = DestBll.Add(dest); CacheHelper.Clear("dest"); } else { navId = nav_editid; } //修改导航的下属导航ID列表 if (parentId > 0) { DataSet ds = DestBll.GetDestListByClassId(parentId); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; navList = dr["navList"].ToString().Trim() + navId + ","; navLayer = Convert.ToInt32(dr["navLayer"]) + 1; } } else { navList = "," + navId + ","; navLayer = 1; } dest.Id = navId; dest.navList = navList; dest.navLayer = navLayer; try { DestBll.Update(dest); CacheHelper.Clear("dest"); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "dest_delete")//删除目的地 { int destid = Convert.ToInt32(Request["destid"]); try { DestBll.Delete(destid); CacheHelper.Clear("dest"); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "property_save")//参团性质保存 { int property_editid = Convert.ToInt32(Request["hidId"]); TravelAgent.Model.JoinProperty model = new TravelAgent.Model.JoinProperty(); model.joinName = Request["txtPropertyName"]; model.joinSort = Convert.ToInt32(Request["txtSort"]); model.isLock = Request["chkIsLock"] == null?0:1; try { if (property_editid != 0) { model.id = property_editid; PropertyBll.Update(model); } else { PropertyBll.Add(model); } Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "property_delete")//参团性质删除 { int proid = Convert.ToInt32(Request["proid"]); try { PropertyBll.Delete(proid); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "city_save")//出发城市保存 { int city_editid = Convert.ToInt32(Request["hidId"]); TravelAgent.Model.DepartureCity model = new TravelAgent.Model.DepartureCity(); model.CityName = Request["txtCityName"]; model.Sort = Convert.ToInt32(Request["txtSort"]); model.isLock = Request["chkIsLock"] == null?0:1; try { if (city_editid != 0) { model.id = city_editid; CityBll.Update(model); } else { CityBll.Add(model); } Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "city_delete")//出发城市删除 { int cityid = Convert.ToInt32(Request["cityid"]); try { CityBll.Delete(cityid); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "supply_delete")//删除供应商 { int supplyid = Convert.ToInt32(Request["supplyid"]); try { SupplyBll.Delete(supplyid); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "theme_save")//主题保存 { int theme_editid = Convert.ToInt32(Request["hidId"]); TravelAgent.Model.LineTheme model = new TravelAgent.Model.LineTheme(); model.themeName = Request["txtThemeName"]; model.themeTopPic = Request["txtImgUrl"]; model.themeTopBgPic = ""; model.Sort = Convert.ToInt32(Request["txtSort"]); model.isLock = Request["chkIsLock"] == null?0:1; try { if (theme_editid != 0) { model.Id = theme_editid; ThemeBll.Update(model); } else { ThemeBll.Add(model); } Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "theme_delete")//出发城市删除 { int themeid = Convert.ToInt32(Request["themeid"]); try { ThemeBll.Delete(themeid); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "insure_save")//保险 { int insure_editid = Convert.ToInt32(Request["hidId"]); TravelAgent.Model.Insure model = new TravelAgent.Model.Insure(); model.InsureName = Request["txtInsureName"]; model.InsurePrice = Convert.ToInt32(Request["txtPrice"]); model.InsureContent = Request["txtContent"]; model.AddDate = DateTime.Now; model.IsLock = Request["chkIsLock"] == null ? 0 : 1; try { if (insure_editid != 0) { model.Id = insure_editid; InsureBll.Update(model); } else { InsureBll.Add(model); } Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "insure_delete")//保险删除 { int insureid = Convert.ToInt32(Request["insureid"]); try { if (LineBll.GetCount("insureid=" + insureid) == 0) { InsureBll.Delete(insureid); Response.Write("true"); } else { Response.Write("exsit"); } } catch { Response.Write("false"); } } } } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(TravelAgent.Model.LineTheme model) { ThemeDAL.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.LineTheme model) { ThemeDAL.Add(model); return(ThemeDAL.GetMaxID("Id")); }