protected void gvProductList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Enabled")
     {
         var id  = (SpecialProductType)Convert.ToInt32(e.CommandArgument);
         var air = SpecialProductService.Query(id);
         if (air != null)
         {
             var view = new SpecialProductView(id)
             {
                 Description = air.Description,
                 Enabled     = !air.Enabled,
                 Explain     = air.Explain,
                 Name        = air.Name
             };
             try
             {
                 SpecialProductService.Update(view, CurrentUser.UserName);
                 RegisterScript("alert('" + (air.Enabled ? "禁用成功!" : "启用成功!") + "')");
             }
             catch (Exception ex)
             {
                 ShowExceptionMessage(ex, air.Enabled ? "禁用" : "启用");
                 return;
             }
             Datainit();
         }
     }
 }
Пример #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         SpecialProductService.Update(GetSpecialProductView(), CurrentUser.UserName);
         RegisterScript("alert('修改成功!');window.location.href='./SpecialProductManagement.aspx'");
     }
     catch (Exception ex)
     {
         ShowExceptionMessage(ex, "修改失败!");
         return;
     }
 }