protected override void OnInit(EventArgs e) { base.OnInit(e); int promotionID = GetUrlInt("PromotionID"); int groupID = GetUrlInt("GroupID"); int lineID = GetUrlInt("LineID"); if (promotionID > 0) { MyPromotion = PromotionBLL.Select(promotionID); } if (groupID > 0) { MyGroup = GroupBLL.SelectGroup(groupID); } if (lineID > 0) { MyLine = LineBLL.SelectLine(lineID); } if (MyLine == null || MyGroup == null) { Arrow.Framework.MessageBox.Jump("-1"); } BindBuyNum(); if (promotionID == 0) { ltPrice.Text = MyGroup.InnerPrice.ToString(); ltTotal.Text = (MyGroup.InnerPrice * ddlBuyNum.SelectedValue.ToArrowInt()).ToString(); } else { if (MyPromotion.PromotionType == PromotionType.Discount) { ltPrice.Text = decimal.Round(MyGroup.InnerPrice * MyPromotion.Discount, 2).ToString(); ltTotal.Text = (ltPrice.Text.ToArrowDecimal() * ddlBuyNum.SelectedValue.ToArrowInt()).ToString(); } else if (MyPromotion.PromotionType == PromotionType.Bundle) { ltPrice.Text = MyPromotion.TotalPayOneTime.ToString(); ddlBuyNum.SelectedValue = MyPromotion.TotalPayOneTimeJoinNum.ToString(); ddlBuyNum.Enabled = false; ltTotal.Text = MyPromotion.TotalPayOneTime.ToString(); } } }
protected override void OnInit(EventArgs e) { BindBuyNum(); base.OnInit(e); int promotionID = GetUrlInt("PromotionID"); int groupID = GetUrlInt("GroupID"); int lineID = GetUrlInt("LineID"); if (promotionID > 0) { MyPromotion = PromotionBLL.Select(promotionID); } if (groupID > 0) { MyGroup = GroupBLL.SelectGroup(groupID); } if (lineID > 0) { MyLine = LineBLL.SelectLine(lineID); } if (promotionID == 0) { ltPrice.Text = MyGroup.InnerPrice.ToString(); ltTotal.Text = ltPrice.Text; } else { if (MyPromotion.PromotionType == PromotionType.Discount) { ltPrice.Text = decimal.Round(MyGroup.InnerPrice * MyPromotion.Discount, 2).ToString(); ltTotal.Text = ltPrice.Text; } else if (MyPromotion.PromotionType == PromotionType.Bundle) { ltPrice.Text = MyPromotion.TotalPayOneTime.ToString(); ddlBuyNum.SelectedValue = MyPromotion.TotalPayOneTimeJoinNum.ToString(); ddlBuyNum.Enabled = false; ltTotal.Text = MyPromotion.TotalPayOneTime.ToString(); } } }
protected void BindModel() { var model = PromotionBLL.Select(PromotionID); if (model == null) { return; } tbName.Text = model.Name; tbBegin.Text = model.StartTime.ToDateOnlyString(); tbEnd.Text = model.EndTime.ToDateOnlyString(); ddlType.SelectedValue = model.PromotionType; SetControlStatus(); tbDiscount.Text = model.Discount.ToString(); tbTotalPay.Text = model.TotalPayOneTime.ToString(); tbJoinNum.Text = model.TotalPayOneTimeJoinNum.ToString(); tbCoverPath.Text = model.CoverPath; tbRemarks.Text = model.PromotionDesc; }
protected void Page_Load(object sender, EventArgs e) { if (CurrentMember == null) { Response.Redirect("Login.aspx"); } ShowTitle("编辑参团人"); if (!Page.IsPostBack) { BindData(); TravelOrderInfo order = OrderBLL.SelectOrder(OrderNum); if (order != null) { LineInfo line = LineBLL.SelectLine(order.LineID); if (line != null) { TravelGroupInfo group = GroupBLL.SelectGroup(order.GroupID); if (group != null) { ltBuyNum.Text = order.BuyNum.ToString(); ltLineName.Text = line.Name.ToString(); ltPrice.Text = group.InnerPrice.ToString(); ltTotal.Text = order.TotalMoney.ToString(); PromotionInfo promotion = PromotionBLL.Select(order.PromotionID); if (promotion != null) { ltPromotionName.Text = promotion.Name; } else { ltPromotionName.Text = "无"; } } } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string name = tbName.Text.Trim(); string cover = tbCoverPath.Text.Trim(); string promotionType = ddlType.SelectedValue.ToArrowString(); decimal discount = tbDiscount.Text.Trim().ToArrowDecimal(); decimal totalOneTime = tbTotalPay.Text.Trim().ToArrowDecimal(); int joinNum = tbJoinNum.Text.Trim().ToArrowInt(); string desc = tbRemarks.Text.Trim(); DateTime dtBegin = tbBegin.Text.Trim().ToArrowDateTime(); DateTime dtEnd = tbEnd.Text.Trim().ToArrowDateTime(); #region 验证数据 if (name.ValidateIsNullOrEmpty("请输入促销名称!")) { return; } if ((dtBegin == DateTime.MinValue || dtEnd == DateTime.MinValue).ValidateSuccess("开始时间和结束时间不正确!")) { return; } if ((dtBegin >= dtEnd).ValidateSuccess("结束时间必须大于开始时间!")) { return; } if (promotionType.IsEqualTo(PromotionType.Discount)) { if (discount >= 1 || discount <= 0) { MessageBox.Show("折扣输入错误!"); return; } } else if (promotionType.IsEqualTo(PromotionType.Bundle)) { if ((totalOneTime <= 0).ValidateSuccess("一次性支付金额不正确!")) { return; } if ((joinNum <= 0).ValidateSuccess("购买团位个数不正确!")) { return; } } #endregion PromotionInfo model = null; if (PromotionID == 0) { //添加 model = new PromotionInfo(); } else { model = PromotionBLL.Select(PromotionID); if (model == null) { return; } } model.CoverPath = cover; model.Discount = discount; model.EndTime = dtEnd; model.FullCutMinus = 0M; model.FullCutTotal = 0M; model.IsDel = 0; model.Name = name; model.PromotionDesc = desc; model.PromotionType = promotionType; model.Remarks = ""; model.SecondKillPrice = 0M; model.StartTime = dtBegin; model.Tag = ""; model.TotalPayOneTime = totalOneTime; model.TotalPayOneTimeJoinNum = joinNum; if (PromotionID == 0) { model.AddTime = DateTime.Now; model.AddUserName = CurrentAdmin.UserName; model.AddUserRealName = CurrentAdmin.RealName; PromotionBLL.Add(model); MessageBox.Show("添加成功!", CurrentUrl); } else { PromotionBLL.Update(model); MessageBox.Show("修改成功!"); } }