/// <summary> /// 绑定附加产品 /// </summary> /// <returns></returns> public string BindAttach() { StringBuilder sbAttach = new StringBuilder(); if (id > 0) { TravelAgent.Model.Insure model = InsureBll.GetModel(LineModel.InsureId); if (model != null) { sbAttach.Append("<tr id=\"tr_0\">"); sbAttach.Append("<td class=\"lt\">"); sbAttach.Append("<a href=\"javascript:void(0);\" style=\"line-height: 17px;\" id=\"atoggle_0\">"); sbAttach.Append("<span class=\"arrowFlag\">▼</span><span id=\"a_0\">" + model.InsureName + "</span>"); sbAttach.Append("</a>"); sbAttach.Append("</td>"); sbAttach.Append("<td><b>¥</b><b id=\"td_price_0\">" + model.InsurePrice + "</b></td>"); sbAttach.Append("<td><input type=\"hidden\" id=\"hdunits_0\" value=\"元/人\" />元/人</td>"); sbAttach.Append("<td>"); sbAttach.Append("<input id=\"txtHiddenDefaultNums_0\" type=\"hidden\" />"); sbAttach.Append("<input id=\"txtHiddenAddProductTypeId_0\" type=\"hidden\" value=\"3\" />"); sbAttach.Append("<select id=\"ddl_nums_0\" name=\"insure\" style=\"min-width: 34px;\"></select>"); sbAttach.Append("</td>"); sbAttach.Append("<td><b>¥</b><b id=\"td_total_0\">0</b></td>"); sbAttach.Append("</tr>"); sbAttach.Append("<tr class=\"trhide\">"); sbAttach.Append("<td colspan=\"6\" style=\"text-align: left; color: #666; line-height: 22px;\">"); sbAttach.Append("" + model.InsureContent + ""); sbAttach.Append("</td>"); sbAttach.Append("</tr>"); } } return(sbAttach.ToString()); }
/// <summary> /// 得到一个对象实体 /// </summary> public TravelAgent.Model.Insure GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from Insure "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; TravelAgent.Model.Insure model = new TravelAgent.Model.Insure(); 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.InsureName = ds.Tables[0].Rows[0]["InsureName"].ToString(); model.InsurePrice = int.Parse(ds.Tables[0].Rows[0]["InsurePrice"].ToString()); model.InsureContent = ds.Tables[0].Rows[0]["InsureContent"].ToString(); model.AddDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["AddDate"].ToString()); model.IsLock = int.Parse(ds.Tables[0].Rows[0]["IsLock"].ToString()); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(TravelAgent.Model.Insure model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Insure set "); strSql.Append("InsureName=@InsureName,"); strSql.Append("InsurePrice=@InsurePrice,"); strSql.Append("InsureContent=@InsureContent,"); strSql.Append("AddDate=@AddDate,"); strSql.Append("IsLock=@IsLock"); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@InsureName", SqlDbType.VarChar), new SqlParameter("@InsurePrice", SqlDbType.Int), new SqlParameter("@InsureContent", SqlDbType.NVarChar), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@IsLock", SqlDbType.Int), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.InsureName; parameters[1].Value = model.InsurePrice; parameters[2].Value = model.InsureContent; parameters[3].Value = model.AddDate; parameters[4].Value = model.IsLock; parameters[5].Value = model.Id; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 绑定附加产品 /// </summary> /// <returns></returns> public string BindAttach() { StringBuilder sbAttach = new StringBuilder(); if (order.attachPrice > 0) { TravelAgent.Model.Insure insure = InsureBll.GetModel(Line.InsureId); sbAttach.Append("<li class=\"li2\" id=\"AddPList\" style=\"\">"); sbAttach.Append("<p class=\"p1\">附加产品</p>"); sbAttach.Append("<div class=\"last\"><p>" + insure.InsureName + "</p><p><b>¥<s>" + order.attachPrice + "</s></b>" + (order.attachPrice / insure.InsurePrice) + "份×¥" + insure.InsurePrice + "</p></div>"); sbAttach.Append("</li>"); } return(sbAttach.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request.QueryString["insureid"] != null) { TravelAgent.Model.Insure model = InsureBll.GetModel(Convert.ToInt32(Request.QueryString["insureid"])); if (model != null) { this.txtInsureName.Text = model.InsureName; this.txtPrice.Text = model.InsurePrice.ToString(); this.txtContent.Value = model.InsureContent; this.hidId.Value = model.Id.ToString(); this.chkIsLock.Checked = model.IsLock == 1; } } } }
/// <summary> /// 增加一条数据 /// </summary> public void Add(TravelAgent.Model.Insure model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Insure("); strSql.Append("InsureName,InsurePrice,InsureContent,AddDate,IsLock)"); strSql.Append(" values ("); strSql.Append("@InsureName,@InsurePrice,@InsureContent,@AddDate,@IsLock)"); SqlParameter[] parameters = { new SqlParameter("@InsureName", SqlDbType.VarChar), new SqlParameter("@InsurePrice", SqlDbType.Int), new SqlParameter("@InsureContent", SqlDbType.NVarChar), new SqlParameter("@AddDate", SqlDbType.DateTime), new SqlParameter("@IsLock", SqlDbType.Int) }; parameters[0].Value = model.InsureName; parameters[1].Value = model.InsurePrice; parameters[2].Value = model.InsureContent; parameters[3].Value = model.AddDate; parameters[4].Value = model.IsLock; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(TravelAgent.Model.Insure model) { InsureDAL.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.Insure model) { InsureDAL.Add(model); return(InsureDAL.GetMaxID("Id")); }
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"); } } } } }