/// <summary> /// 得到一个对象实体 /// </summary> public TravelAgent.Model.JoinProperty GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,joinName,joinSort,isLock from JoinProperty "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; TravelAgent.Model.JoinProperty model = new TravelAgent.Model.JoinProperty(); 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.joinName = ds.Tables[0].Rows[0]["joinName"].ToString(); if (ds.Tables[0].Rows[0]["joinSort"].ToString() != "") { model.joinSort = int.Parse(ds.Tables[0].Rows[0]["joinSort"].ToString()); } model.isLock = int.Parse(ds.Tables[0].Rows[0]["isLock"].ToString()); return(model); } else { return(null); } }
/// <summary> /// 显示参团性质 /// </summary> /// <returns></returns> public string ShowJoinName(string proids) { string strvalue = ""; int proidsId; if (int.TryParse(proids, out proidsId)) { TravelAgent.Model.JoinProperty proModel = ProBll.GetModel(proidsId); if (proModel != null) { strvalue = proModel.joinName; } } return(strvalue); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(TravelAgent.Model.JoinProperty model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into JoinProperty("); strSql.Append("joinName,joinSort,isLock)"); strSql.Append(" values ("); strSql.Append("@joinName,@joinSort,@isLock)"); SqlParameter[] parameters = { new SqlParameter("@joinName", SqlDbType.NVarChar, 50), new SqlParameter("@joinSort", SqlDbType.Int, 4), new SqlParameter("@isLock", SqlDbType.Int, 4) }; parameters[0].Value = model.joinName; parameters[1].Value = model.joinSort; parameters[2].Value = model.isLock; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request.QueryString["propertyid"] != null) { TravelAgent.Model.JoinProperty model = PropertyBll.GetModel(Convert.ToInt32(Request.QueryString["propertyid"])); if (model != null) { this.txtPropertyName.Text = model.joinName; this.txtSort.Text = model.joinSort.ToString(); this.hidId.Value = model.id.ToString(); this.chkIsLock.Checked = model.isLock == 1; } } else { this.txtSort.Text = (PropertyBll.GetMaxID("joinSort") + 1).ToString(); } } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(TravelAgent.Model.JoinProperty model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update JoinProperty set "); strSql.Append("joinName=@joinName,"); strSql.Append("joinSort=@joinSort,"); strSql.Append("isLock=@isLock"); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@joinName", SqlDbType.NVarChar, 50), new SqlParameter("@joinSort", SqlDbType.Int, 4), new SqlParameter("@isLock", SqlDbType.Int, 4), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.joinName; parameters[1].Value = model.joinSort; parameters[2].Value = model.isLock; parameters[3].Value = model.id; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 获得参团性质 /// </summary> /// <returns></returns> protected string getJoinPropery(int value) { TravelAgent.Model.JoinProperty proModel = ProBll.GetModel(value); return(proModel != null ? proModel.joinName : ""); }
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.JoinProperty model) { PropertyDAL.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.JoinProperty model) { PropertyDAL.Add(model); return(PropertyDAL.GetMaxID("Id")); }
/// <summary> /// 显示线路类型 /// </summary> /// <param name="typeId"></param> /// <returns></returns> public string ShowLineTypeName(int typeId) { TravelAgent.Model.JoinProperty proModel = ProBll.GetModel(typeId); return(proModel != null ? proModel.joinName : ""); }
protected void Page_Load(object sender, EventArgs e) { int id; if (!this.IsPostBack && Request.QueryString["id"] != null && int.TryParse(Request.QueryString["id"], out id)) { LineModel = LineBll.GetModel(id); if (LineModel != null) { //增加关注度 string strsql = "update Line set gzd=gzd+1 where Id=" + LineModel.Id; //Access //TravelAgent.Tool.DbHelperOleDb.ExecuteSql(strsql); //SQL TravelAgent.Tool.DbHelperSQL.ExecuteSql(strsql); if (LineModel.SeoTitle.Trim().Equals("")) { this.Title = LineModel.LineName + "-" + Master.webinfo.WebName + "-" + Master.webinfo.SEOTitle; } else { this.Title = LineModel.SeoTitle; } if (LineModel.SeoKey.Trim().Equals("")) { Common.AddMeta(Page.Master.Page, "keywords", Master.webinfo.SEOKeywords); } else { Common.AddMeta(Page.Master.Page, "keywords", LineModel.SeoKey); } if (LineModel.SeoDisc.Trim().Equals("")) { Common.AddMeta(Page.Master.Page, "description", Master.webinfo.SEODescription); } else { Common.AddMeta(Page.Master.Page, "description", LineModel.SeoDisc); } this.divPlace.InnerHtml = ShowPlace(LineModel); TravelAgent.Model.JoinProperty proModel = ProBll.GetModel(Convert.ToInt32(LineModel.ProIds)); if (proModel != null) { this.lblLineType.Text = proModel.joinName; } TravelAgent.Model.DepartureCity cityModel = CityBll.GetModel(LineModel.CityId); if (cityModel != null) { this.lblCity.Text = cityModel.CityName; } int intNormalPrice = String.IsNullOrEmpty(LineModel.PriceContent) ? 0 : Convert.ToInt32(LineModel.PriceContent.Split(',')[2]); int intMinPrice = GetLineSpePrice(LineModel.Id, intNormalPrice); if (intMinPrice == 0) { this.ltPrice.Text = "电询"; } else { this.ltPrice.Text = "¥ " + intMinPrice; } } } if (LineModel == null) { Response.Redirect("/Opr.aspx?t=error&msg=opr"); } }