protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string commandName = e.CommandName;
        int    id          = e.CommandArgument.ToArrowInt();

        if (e.CommandName == "UpdateData")
        {
            GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
            int         num = (gvData.Rows[drv.RowIndex].FindControl("tbNum") as TextBox).Text.Trim().ToArrowInt();
            if ((num == 0).ValidateSuccess("促销的团位数无效!"))
            {
                BindData();
                return;
            }
            PromotionBLL.UpdateTotalNumOfPromotionGroup(num, id);
            BindData();
            MessageBox.Show("修改成功!");
        }
        else if (e.CommandName == "DelData")
        {
            //删除,判断是否已经有人报名
            PromotionGroupInfo model = PromotionBLL.SelectGroupOfPromotion(id);
            if (model == null)
            {
                BindData();
                return;
            }
            if ((model.SelledNum > 0).ValidateSuccess("已经有人报名了,不可删除该促销!"))
            {
                BindData();
                return;
            }
            PromotionBLL.DelGroupOfPromotion(id);
            BindData();
            MessageBox.Show("删除成功!");
        }
    }
Exemplo n.º 2
0
 public static int UpdateGroupOfPromotion(PromotionGroupInfo model)
 {
     return(pgDal.Update(model));
 }
Exemplo n.º 3
0
 public static int AddGroupToPromotion(PromotionGroupInfo model)
 {
     return(pgDal.Add(model));
 }