protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e) { string commandName = e.CommandName; int id = e.CommandArgument.ToArrowInt(); if (e.CommandName == "UpdateData") { Response.Redirect("GroupEdit.aspx?LineID=" + MyLine.ID + "&id=" + id + CreateReturnUrl("&")); } else if (e.CommandName == "DelData") { //删除 GroupBLL.SetGroupIsDel(id, 1); BindData(); MessageBox.Show("删除成功!"); } else if (e.CommandName == "AddData") { var model = GroupBLL.SelectGroup(id); if (model != null) { model.GoDate = model.GoDate.AddDays(1); model.BackDate = model.BackDate.AddDays(1); model.JoinNum = 0; model.AddTime = DateTime.Now; model.AddUserName = CurrentAdmin.UserName; model.AddUserRealName = CurrentAdmin.RealName; GroupBLL.AddGroup(model); BindData(); } } }
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 = GroupBLL.SelectGroup(GroupID); if (model == null) { return; } tbBegin.Text = model.GoDate.ToDateOnlyString(); tbEnd.Text = model.BackDate.ToDateOnlyString(); tbNum.Text = model.TotalNum.ToString(); tbPrice.Text = model.OuterPrice.ToString(); tbMemberPrice.Text = model.InnerPrice.ToString(); tbDeposit.Text = model.Deposit.ToString(); tbGatheringTime.Text = model.GatheringTime; tbGatheringPlace.Text = model.GatheringPlace; tbTransfer.Text = model.TransferPlace; tbLeader.Text = model.GruopLeader; tbRemain.Text = model.RemainNum.ToString(); }
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) { DateTime goDate = tbBegin.Text.Trim().ToArrowDateTime(); DateTime backDate = tbEnd.Text.Trim().ToArrowDateTime(); int totalNum = tbNum.Text.Trim().ToArrowInt(); int remainNum = tbRemain.Text.Trim().ToArrowInt(); decimal outerPrice = tbPrice.Text.Trim().ToArrowDecimal(); decimal innerPrice = tbMemberPrice.Text.Trim().ToArrowDecimal(); decimal deposit = tbDeposit.Text.Trim().ToArrowDecimal(); string gatheringTime = tbGatheringTime.Text.Trim(); string gatheringPlace = tbGatheringPlace.Text.Trim(); string transfer = tbTransfer.Text.Trim(); string leader = tbLeader.Text.Trim(); if ((goDate == DateTime.MinValue).ValidateSuccess("出团日期不正确!")) { return; } if ((backDate == DateTime.MinValue).ValidateSuccess("回程日期不正确!")) { return; } if ((goDate <= DateTime.Now).ValidateSuccess("出团日期必须大于今天!")) { return; } if ((backDate <= goDate).ValidateSuccess("返程日期必须大于出团日期!")) { return; } if ((totalNum <= 0).ValidateSuccess("参团人数不正确!")) { return; } if ((remainNum <= 0).ValidateSuccess("剩余位数不正确!")) { return; } if ((outerPrice <= 0M).ValidateSuccess("价格不正确!")) { return; } if ((innerPrice <= 0M).ValidateSuccess("会员价不正确!")) { return; } if ((deposit <= 0M).ValidateSuccess("订金不正确!")) { return; } if (GroupID == 0) { var model = new TravelGroupInfo(); model.AddTime = DateTime.Now; model.AddUserName = CurrentAdmin.UserName; model.AddUserRealName = CurrentAdmin.RealName; model.BackDate = backDate; model.BackTravel = ""; model.Deposit = deposit; model.GatheringPlace = gatheringPlace; model.GatheringTime = gatheringTime; model.GoDate = goDate; model.GoTravel = ""; model.GroupNum = ""; //团号 model.GruopLeader = leader; model.InnerPrice = innerPrice; model.IsDel = 0; model.IsPublish = 0; model.JoinNum = 0; model.RemainNum = remainNum; model.LineID = LineID; model.Name = ""; model.OuterPrice = outerPrice; model.PromotionNum = 0; model.Remarks = ""; model.TotalNum = totalNum; model.TransferPlace = transfer; model.TravelGuide = ""; GroupBLL.AddGroup(model); MessageBox.Show("添加成功!", CurrentUrl); } else { var model = GroupBLL.SelectGroup(GroupID); if (model == null) { return; } model.BackDate = backDate; model.Deposit = deposit; model.GatheringPlace = gatheringPlace; model.GatheringTime = gatheringTime; model.GoDate = goDate; model.GruopLeader = leader; model.InnerPrice = innerPrice; model.LineID = LineID; model.OuterPrice = outerPrice; model.TotalNum = totalNum; model.RemainNum = remainNum; model.TransferPlace = transfer; GroupBLL.UpdateGroup(model); MessageBox.Show("更新成功!"); } }