protected void Page_Load(object sender, EventArgs e) { this.Title = "租车预订_" + Master.webinfo.WebName; if (!this.IsPostBack) { if (Request.QueryString["cid"] != null) { cid = Convert.ToInt32(Request.QueryString["cid"]); CarModel = CarBll.GetModel(cid); } if (Request.QueryString["pcid"] != null) { pid = Convert.ToInt32(Request.QueryString["pcid"]); CarPriceModel = CarPriceBll.GetModel(pid); } if (Request.QueryString["oid"] != null) { order = OrderBll.GetModel(Convert.ToInt32(Request.QueryString["oid"])); } if (CarModel == null || CarPriceModel == null || order == null) { Response.Redirect("/Opr.aspx?msg=no"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["id"])) { orderid = Convert.ToInt32(Request.QueryString["id"]); } if (!this.IsPostBack) { DataBindState(); DataBindPay(); if (orderid > 0) { TravelAgent.Model.Order order = OrderBll.GetModel(orderid); if (order != null) { TravelAgent.Model.CarList car = CarBll.GetModel(order.lineId); if (car != null) { this.hdordercode.Value = order.ordercode; this.lblCarName.Text = car.CarName; this.lblOrderCode.Text = order.ordercode; this.lblUseCount.Text = order.account.ToString(); this.lblOrderDate.Text = order.orderDate.ToString(); TravelAgent.Model.CarPrice price = PriceBll.GetModel(order.peopleNumber); if (price != null) { this.lblCarType.Text = price.CarTypeID == 0 ? "旅游租车" : "自驾租车"; } this.lblUseDate.Text = order.usedate + " " + order.timedot + "点"; this.lblHuanDate.Text = order.huandate; } TravelAgent.Model.Club club = ClubBll.GetModel(order.clubid); if (club != null) { this.lblClubInfo.Text = club.clubName + " / " + club.clubMobile + " / " + club.clubEmail; } this.lblLinkName.Text = order.contactName; this.lblEmail.Text = order.contactEmail; this.lblTel.Text = order.contactMobile; this.lblSex.Text = !order.contactSex.Equals("") ? TravelAgent.Tool.EnumHelper.GetMemberName <TravelAgent.Tool.EnumSummary.TouristSex>(order.contactSex) : ""; this.lblOrderTotalPrice.Text = order.orderPrice.ToString(); this.txtJiaJian.Value = order.subPrice.ToString(); this.txtuserPoints.Value = order.usePoints.ToString(); this.lblPayCost.Text = (order.orderPrice - order.usePoints + order.subPrice).ToString(); this.ddlPayType.SelectedValue = order.payType.ToString(); this.ddlState.SelectedValue = order.orderState.ToString(); this.txtRemark.Value = order.operRemark; if (order.orderState == Convert.ToInt32(TravelAgent.Tool.EnumSummary.OrderState.已付款)) { this.lblPayState.Text = "已付款"; } else { this.lblPayState.Text = "未付款"; } } } } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.CarPrice model) { int lineid = 0; if (dal.Add(model) > 0) { lineid = dal.GetMaxID("Id"); } return(lineid); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.CarPrice model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CarPrice("); strSql.Append("CarId,PriceName,Unit,CarTypeID,CarCityId,TranDisc,NumberId,MemshiPrice,XiaoshuPrice,JiesuanPrice,UsePoints,DonatePoints,StartDate,EndDate,DealType,IsLock,BSQ,SpeXiaoshuPrice)"); strSql.Append(" values ("); strSql.Append("@CarId,@PriceName,@Unit,@CarTypeID,@CarCityId,@TranDisc,@NumberId,@MemshiPrice,@XiaoshuPrice,@JiesuanPrice,@UsePoints,@DonatePoints,@StartDate,@EndDate,@DealType,@IsLock,@BSQ,@SpeXiaoshuPrice)"); SqlParameter[] parameters = { new SqlParameter("@CarId", SqlDbType.Int), new SqlParameter("@PriceName", SqlDbType.VarChar, 200), new SqlParameter("@Unit", SqlDbType.VarChar, 50), new SqlParameter("@CarTypeID", SqlDbType.Int), new SqlParameter("@CarCityId", SqlDbType.Int), new SqlParameter("@TranDisc", SqlDbType.VarChar, 50), new SqlParameter("@NumberId", SqlDbType.Int, 4), new SqlParameter("@MemshiPrice", SqlDbType.Int, 4), new SqlParameter("@XiaoshuPrice", SqlDbType.Int, 4), new SqlParameter("@JiesuanPrice", SqlDbType.Int, 4), new SqlParameter("@UsePoints", SqlDbType.Int, 4), new SqlParameter("@DonatePoints", SqlDbType.VarChar, 250), new SqlParameter("@StartDate", SqlDbType.VarChar, 200), new SqlParameter("@EndDate", SqlDbType.VarChar, 200), new SqlParameter("@DealType", SqlDbType.VarChar, 50), new SqlParameter("@IsLock", SqlDbType.Int, 4), new SqlParameter("@BSQ", SqlDbType.Int, 4), new SqlParameter("@SpeXiaoshuPrice", SqlDbType.NVarChar, 500) }; parameters[0].Value = model.CarId; parameters[1].Value = model.PriceName; parameters[2].Value = model.Unit; parameters[3].Value = model.CarTypeID; parameters[4].Value = model.CarCityId; parameters[5].Value = model.TranDisc; parameters[6].Value = model.NumberId; parameters[7].Value = model.MemshiPrice; parameters[8].Value = model.XiaoshuPrice; parameters[9].Value = model.JiesuanPrice; parameters[10].Value = model.UsePoints; parameters[11].Value = model.DonatePoints; parameters[12].Value = model.StartDate; parameters[13].Value = model.EndDate; parameters[14].Value = model.DealType; parameters[15].Value = model.IsLock; parameters[16].Value = model.BSQ; parameters[17].Value = model.SpeXiaoshuPrice; return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters)); }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(Request.QueryString["carid"])) { carid = Convert.ToInt32(Request.QueryString["carid"]); } if (!string.IsNullOrEmpty(Request.QueryString["priceid"])) { priceid = Convert.ToInt32(Request.QueryString["priceid"]); } if (!this.IsPostBack) { BindCarCity(); BindCarNumber(); BindPrice(); if (priceid > 0) { TravelAgent.Model.CarPrice model = PriceBll.GetModel(priceid); if (model != null) { this.lblPriceName.Text = model.PriceName; this.txtPriceName.Text = model.PriceName; this.txtUnit.Text = model.Unit; this.rbtnCarType.SelectedValue = model.CarTypeID.ToString(); this.ddlCarCity.SelectedValue = model.CarCityId.ToString(); this.ddlCarNumber.SelectedValue = model.NumberId.ToString(); this.ddlBSQ.SelectedValue = model.BSQ.ToString(); this.txtStartDate.Text = model.StartDate; this.txtEndDate.Text = model.EndDate; this.txtMenshi.Text = model.MemshiPrice.ToString(); this.txtXiaoshou.Text = model.XiaoshuPrice.ToString(); this.txtJiesuan.Text = model.JiesuanPrice.ToString(); this.txtUsePoint.Text = model.UsePoints.ToString(); this.txtDonatePoint.Text = model.DonatePoints.ToString(); this.rbtnDealType0.SelectedValue = model.DealType.ToString(); this.chkIsLock.Checked = model.IsLock == 1; } } else { this.lblPriceName.Text = ""; } } }
/// <summary> /// 添加价格体系 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { TravelAgent.Model.CarPrice model = new TravelAgent.Model.CarPrice(); model.CarId = carid; model.PriceName = this.txtPriceName.Text.Trim(); model.Unit = this.txtUnit.Text.Trim(); model.CarTypeID = Convert.ToInt32(this.rbtnCarType.SelectedValue); model.CarCityId = Convert.ToInt32(this.ddlCarCity.SelectedValue); model.TranDisc = ""; model.NumberId = Convert.ToInt32(this.ddlCarNumber.SelectedValue); model.MemshiPrice = Convert.ToInt32(this.txtMenshi.Text); model.XiaoshuPrice = Convert.ToInt32(this.txtXiaoshou.Text); model.JiesuanPrice = Convert.ToInt32(this.txtJiesuan.Text); model.UsePoints = Convert.ToInt32(this.txtUsePoint.Text); model.DonatePoints = Convert.ToInt32(this.txtDonatePoint.Text); model.StartDate = this.txtStartDate.Text; model.EndDate = this.txtEndDate.Text; model.DealType = Convert.ToInt32(this.rbtnDealType0.SelectedValue); model.IsLock = this.chkIsLock.Checked ? 1 : 0; model.BSQ = Convert.ToInt32(this.ddlBSQ.SelectedValue); model.SpeXiaoshuPrice = ""; string stringUrl = Request.Url.ToString(); try { if (priceid > 0) { model.Id = priceid; PriceBll.Update(model); JscriptPrint("保存成功!", stringUrl, "Success"); } else { PriceBll.Add(model); JscriptPrint("添加成功!", stringUrl, "Success"); } } catch { JscriptPrint("保存失败!", stringUrl, "Error"); } }
/// <summary> /// 更新一条数据 /// </summary> public int Update(TravelAgent.Model.CarPrice model) { return(dal.Update(model)); }
protected void Page_Load(object sender, EventArgs e) { this.Title = "租车预订_" + Master.webinfo.WebName; if (!this.IsPostBack) { if (Request.QueryString["cid"] != null) { cid = Convert.ToInt32(Request.QueryString["cid"]); CarModel = CarBll.GetModel(cid); } if (Request.QueryString["pcid"] != null) { pid = Convert.ToInt32(Request.QueryString["pcid"]); CarPriceModel = CarPriceBll.GetModel(pid); if (CarPriceModel.CarTypeID == 1)//旅游租车 { this.trHuan.Style["display"] = "none"; } } if (CarModel == null || CarPriceModel == null) { Response.Redirect("/Opr.aspx?msg=no"); } if (!string.IsNullOrEmpty(TravelAgent.Tool.CookieHelper.GetCookieValue("uid"))) { CurClub = ClubBll.GetModel(Convert.ToInt32(TravelAgent.Tool.CookieHelper.GetCookieValue("uid"))); } else { CurClub = new TravelAgent.Model.Club(); } strYCDate = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"); strHCDate = Convert.ToDateTime(strYCDate).AddDays(1).ToString("yyyy-MM-dd"); if (Request["txtHiddenCId"] != null) { TravelAgent.Model.Order order = new TravelAgent.Model.Order(); order.lineId = Convert.ToInt32(Request["txtHiddenCId"]); order.ordercode = "O" + DateTime.Now.ToString("yyyyMMddHHmmssfff"); order.peopleNumber = Convert.ToInt32(Request["txtHiddenPId"]); order.adultNumber = 0; order.childNumber = 0; order.orderDate = DateTime.Now; order.TravelDate = ""; order.orderPrice = Convert.ToInt32(Request["txtHiddenOrderPrice"]); order.attachPrice = 0; order.usePoints = 0; order.donatePoints = 0; order.contactName = Request["txt_name"]; order.contactMobile = Request["txt_mobile"]; order.contactEmail = Request["txt_email"]; order.contactTelephone = Request["txt_start_phone"] + "-" + Request["txt_end_phone"]; order.orderRemark = Request["txt_des"]; order.operRemark = ""; order.orderState = Convert.ToInt32(TravelAgent.Tool.EnumSummary.OrderState.处理中); if (string.IsNullOrEmpty(TravelAgent.Tool.CookieHelper.GetCookieValue("uid"))) { order.clubid = 0; } else { order.clubid = Convert.ToInt32(TravelAgent.Tool.CookieHelper.GetCookieValue("uid")); } order.adultPrice = 0; order.childPrice = 0; order.payType = 0; order.subPrice = 0; order.orderType = Convert.ToInt32(TravelAgent.Tool.EnumSummary.OrderType.租车); order.contactSex = ""; order.sourceType = Convert.ToInt32(TravelAgent.Tool.EnumSummary.SourceType.PC网页); order.usedate = Request["txtHiddenYongcheDate"]; order.timedot = Convert.ToInt32(Request["timedot"]); order.huandate = Request["txtHiddenHuancheDate"]; order.account = Convert.ToInt32(Request["selYongchecount"]); try { int orderid = LineOrderBll.Add(order); if (orderid > 0 & order.clubid > 0) { //urlrewrite Response.Redirect("/car/CarOrder2.aspx?cid=" + cid + "&pcid=" + pid + "&oid=" + orderid + "", false); } else { Response.Redirect("/Opr.aspx?t=error&msg=opr"); } } catch (Exception ex) { Response.Redirect("/Opr.aspx?t=error&msg=opr"); } } } }
/// <summary> /// 得到一个对象实体 /// </summary> public TravelAgent.Model.CarPrice GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 *,(select NumName from CarNumber where Id=NumberId) as NumName from CarPrice "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; TravelAgent.Model.CarPrice model = new TravelAgent.Model.CarPrice(); 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()); } if (ds.Tables[0].Rows[0]["CarId"].ToString() != "") { model.CarId = int.Parse(ds.Tables[0].Rows[0]["CarId"].ToString()); } model.PriceName = ds.Tables[0].Rows[0]["PriceName"].ToString(); model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString(); if (ds.Tables[0].Rows[0]["CarTypeID"].ToString() != "") { model.CarTypeID = int.Parse(ds.Tables[0].Rows[0]["CarTypeID"].ToString()); } if (ds.Tables[0].Rows[0]["CarCityId"].ToString() != "") { model.CarCityId = int.Parse(ds.Tables[0].Rows[0]["CarCityId"].ToString()); } model.TranDisc = ds.Tables[0].Rows[0]["TranDisc"].ToString(); if (ds.Tables[0].Rows[0]["NumberId"].ToString() != "") { model.NumberId = int.Parse(ds.Tables[0].Rows[0]["NumberId"].ToString()); } if (ds.Tables[0].Rows[0]["MemshiPrice"].ToString() != "") { model.MemshiPrice = int.Parse(ds.Tables[0].Rows[0]["MemshiPrice"].ToString()); } if (ds.Tables[0].Rows[0]["XiaoshuPrice"].ToString() != "") { model.XiaoshuPrice = int.Parse(ds.Tables[0].Rows[0]["XiaoshuPrice"].ToString()); } if (ds.Tables[0].Rows[0]["JiesuanPrice"].ToString() != "") { model.JiesuanPrice = int.Parse(ds.Tables[0].Rows[0]["JiesuanPrice"].ToString()); } if (ds.Tables[0].Rows[0]["UsePoints"].ToString() != "") { model.UsePoints = int.Parse(ds.Tables[0].Rows[0]["UsePoints"].ToString()); } if (ds.Tables[0].Rows[0]["DonatePoints"].ToString() != "") { model.DonatePoints = int.Parse(ds.Tables[0].Rows[0]["DonatePoints"].ToString()); } model.StartDate = ds.Tables[0].Rows[0]["StartDate"].ToString(); model.EndDate = ds.Tables[0].Rows[0]["EndDate"].ToString(); if (ds.Tables[0].Rows[0]["DealType"].ToString() != "") { model.DealType = int.Parse(ds.Tables[0].Rows[0]["DealType"].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]["BSQ"].ToString() != "") { model.BSQ = int.Parse(ds.Tables[0].Rows[0]["BSQ"].ToString()); } model.SpeXiaoshuPrice = ds.Tables[0].Rows[0]["SpeXiaoshuPrice"].ToString(); model.NumName = ds.Tables[0].Rows[0]["NumName"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public int Update(TravelAgent.Model.CarPrice model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update CarPrice set "); strSql.Append("PriceName=@PriceName,"); strSql.Append("Unit=@Unit,"); strSql.Append("CarTypeID=@CarTypeID,"); strSql.Append("CarCityId=@CarCityId,"); strSql.Append("TranDisc=@TranDisc,"); strSql.Append("NumberId=@NumberId,"); strSql.Append("MemshiPrice=@MemshiPrice,"); strSql.Append("XiaoshuPrice=@XiaoshuPrice,"); strSql.Append("JiesuanPrice=@JiesuanPrice,"); strSql.Append("UsePoints=@UsePoints,"); strSql.Append("DonatePoints=@DonatePoints,"); strSql.Append("StartDate=@StartDate,"); strSql.Append("EndDate=@EndDate,"); strSql.Append("DealType=@DealType,"); strSql.Append("IsLock=@IsLock,"); strSql.Append("BSQ=@BSQ,"); strSql.Append("SpeXiaoshuPrice=@SpeXiaoshuPrice"); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@PriceName", SqlDbType.VarChar, 200), new SqlParameter("@Unit", SqlDbType.VarChar, 50), new SqlParameter("@CarTypeID", SqlDbType.Int), new SqlParameter("@CarCityId", SqlDbType.Int), new SqlParameter("@TranDisc", SqlDbType.VarChar, 50), new SqlParameter("@NumberId", SqlDbType.Int), new SqlParameter("@MemshiPrice", SqlDbType.Int), new SqlParameter("@XiaoshuPrice", SqlDbType.Int), new SqlParameter("@JiesuanPrice", SqlDbType.Int), new SqlParameter("@UsePoints", SqlDbType.Int), new SqlParameter("@DonatePoints", SqlDbType.Int), new SqlParameter("@StartDate", SqlDbType.VarChar, 10), new SqlParameter("@EndDate", SqlDbType.VarChar, 10), new SqlParameter("@DealType", SqlDbType.Int), new SqlParameter("@IsLock", SqlDbType.Int), new SqlParameter("@BSQ", SqlDbType.Int), new SqlParameter("@SpeXiaoshuPrice", SqlDbType.NVarChar, 500), new SqlParameter("@Id", SqlDbType.Int) }; parameters[0].Value = model.PriceName; parameters[1].Value = model.Unit; parameters[2].Value = model.CarTypeID; parameters[3].Value = model.CarCityId; parameters[4].Value = model.TranDisc; parameters[5].Value = model.NumberId; parameters[6].Value = model.MemshiPrice; parameters[7].Value = model.XiaoshuPrice; parameters[8].Value = model.JiesuanPrice; parameters[9].Value = model.UsePoints; parameters[10].Value = model.DonatePoints; parameters[11].Value = model.StartDate; parameters[12].Value = model.EndDate; parameters[13].Value = model.DealType; parameters[14].Value = model.IsLock; parameters[15].Value = model.BSQ; parameters[16].Value = model.SpeXiaoshuPrice; parameters[17].Value = model.Id; return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters)); }
/// <summary> /// 显示租车的明细 /// </summary> /// <param name="carid"></param> /// <param name="pid"></param> /// <returns></returns> public string ShowCarPrice(int pid) { TravelAgent.Model.CarPrice model = PriceBll.GetModel(pid); return(model != null ? model.PriceName : ""); }