Beispiel #1
0
    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();
            }
        }
    }
Beispiel #2
0
    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("更新成功!");
        }
    }