/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.LineSpePrice model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into LineSpePrice("); strSql.Append("lineId,lineDate,linePrice,tag)"); strSql.Append(" values ("); strSql.Append("@lineId,@lineDate,@linePrice,@tag)"); SqlParameter[] parameters = { new SqlParameter("@lineId", SqlDbType.Int, 4), new SqlParameter("@lineDate", SqlDbType.VarChar, 50), new SqlParameter("@linePrice", SqlDbType.VarChar, 250), new SqlParameter("@tag", SqlDbType.Int) }; parameters[0].Value = model.lineId; parameters[1].Value = model.lineDate; parameters[2].Value = model.linePrice; parameters[3].Value = model.tag; return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters)); }
/// <summary> /// 根据编号获得集合 /// </summary> /// <param name="lineid"></param> /// <returns></returns> public List <TravelAgent.Model.LineSpePrice> GetlstSpePriceByLineId(int lineid) { string strsql = "select * from LineSpePrice where lineId=" + lineid; List <TravelAgent.Model.LineSpePrice> lstSpePrice = new List <TravelAgent.Model.LineSpePrice>(); using (SqlDataReader odr = DbHelperSQL.ExecuteReader(strsql)) { TravelAgent.Model.LineSpePrice price = null; while (odr.Read()) { price = new TravelAgent.Model.LineSpePrice(); price.Id = odr.GetInt32(0); price.lineId = odr.GetInt32(1); price.lineDate = odr.GetString(2); price.linePrice = odr.GetString(3); price.tag = odr.GetInt32(4); lstSpePrice.Add(price); } } return(lstSpePrice); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["lineid"] != null) { int lineid = Convert.ToInt32(Request.QueryString["lineid"]); string content = Request["txtMenshi_adult"] + "," + Request["txtMenshi_child"] + ","; content += Request["txtPrice_adult"] + "," + Request["txtPrice_child"] + ","; content += Request["txtUsePoints_adult"] + "," + Request["txtUsePoints_child"] + ","; content += Request["txtDoPoints_adult"] + "," + Request["txtDoPoints_child"] + ","; content += Request["txtCheng_adult"] + "," + Request["txtCheng_child"] + ","; content += Request["txtDFC"] + ","; content += Request["txtNumber"]; string strsetting = ""; if (Request["rbtnPlanType"].ToString().Equals("1")) { strsetting = Request["hidweek"]; } else if (Request["rbtnPlanType"].ToString().Equals("2")) { strsetting = Request["hidday"]; } string strsql = "update Line set priceSdate='" + Request["txtStartDate"] + "',priceEdate='" + Request["txtEndDate"] + "',"; strsql += "priceEditModel=" + Request["rbtnPlanType"] + ",priceContent='" + content + "',"; strsql += "dealType='" + Request["rbtnDealType"] + "',priceSetting='" + strsetting + "',priceCommon='" + Request["txtPrice_adult"] + "' where Id=" + lineid; try { if (LineBll.Update(strsql) > 0) { if (Request["chkClearPrice"] != null) { //清除特殊价格 SpePriceBll.Delete(lineid); } Response.Write("true"); } else { Response.Write("false"); } } catch { Response.Write("false"); } } if (Request.QueryString["line_id"] != null) { int line_id = Convert.ToInt32(Request.QueryString["line_id"]); string content = Request["menshi_adult"] + "," + Request["menshi_child"] + ","; content += Request["price_adult"] + "," + Request["price_child"] + ","; content += Request["points_use_adult"] + "," + Request["points_use_child"] + ","; content += Request["points_do_adult"] + "," + Request["points_do_child"] + ","; content += Request["jsprice_adult"] + "," + Request["jsprice_child"] + ","; content += Request["dfc"] + ","; content += Request["num"]; //string strprice = Request["hidPrice"]; string strDate = Request["hidDate"]; //先删除后增加 SpePriceBll.Delete(line_id, strDate); TravelAgent.Model.LineSpePrice price = new TravelAgent.Model.LineSpePrice(); price.lineId = line_id; price.linePrice = content; price.lineDate = strDate; price.tag = 1; if (SpePriceBll.Add(price) > 0) { Response.Write("true"); } else { Response.Write("false"); } } if (Request["line_id_delete"] != null) { int line_id_delete = Convert.ToInt32(Request["line_id_delete"]); string strDate = Request["line_date"]; SpePriceBll.Delete(line_id_delete, strDate); TravelAgent.Model.LineSpePrice price = new TravelAgent.Model.LineSpePrice(); price.lineId = line_id_delete; price.linePrice = ""; price.lineDate = strDate; price.tag = 0; if (SpePriceBll.Add(price) > 0) { Response.Write("true"); } else { Response.Write("false"); } } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.LineSpePrice model) { TravelAgent.Tool.CacheHelper.Clear("speprice"); return(dal.Add(model)); }