示例#1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Valiate())
     {
         if (hidAddOrUpdate.Value == "")
         {
             try
             {
                 PolicySettingInfo setting = SaveInfo();
                 PolicyManageService.AddPolicySetting(setting, this.CurrentUser.UserName);
                 RegisterScript("alert('添加成功');window.location.href='policy_set_manage.aspx';", true);
             }
             catch (Exception ex)
             {
                 ShowExceptionMessage(ex, "添加");
             }
         }
         else
         {
             try
             {
                 PolicySettingInfo setting = SaveInfo();
                 setting.Creator = this.CurrentUser.Name;
                 string policySettingId = Request.QueryString["Id"];
                 if (!string.IsNullOrWhiteSpace(policySettingId))
                 {
                     setting.Id = Guid.Parse(policySettingId);
                     PolicyManageService.UpdatePolicySetting(setting, this.CurrentUser.UserName);
                     RegisterScript("alert('修改成功');window.location.href='policy_set_manage.aspx';", true);
                 }
             }
             catch (Exception ex)
             {
                 ShowExceptionMessage(ex, "修改");
             }
         }
     }
 }