示例#1
0
 protected void btnConfrim_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         List <TablePrimary> t           = new List <TablePrimary>();
         TablePrimary        userPrimary = new TablePrimary();
         userPrimary.PrimaryName  = "RoleName";
         userPrimary.PrimaryValue = GetRoleInfo().RoleName;
         t.Add(userPrimary);
         if (Request.QueryString["Type"] != null && Request.QueryString["Type"].ToString() == "0")//新增状态
         {
             if (Common.IsExsit("Role", t))
             {
                 ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('角色已经存在,请确认!');", true);
             }
             else
             {
                 bool iResult = Role.Add(GetRoleInfo().RoleName, GetRoleInfo().Remark);
                 if (iResult)
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(),
                                                         "Sucess", "alert('操作成功!');location.replace('RoleList.aspx?Refresh=1');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('操作失败!');", true);
                 }
             }
         }
         else
         {
             if (Common.IsExsit("Role", t, GetRoleInfo().RoleID))
             {
                 ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('角色已经存在,请确认!');", true);
             }
             else
             {
                 bool bResult = Role.Update(GetRoleInfo().RoleName, GetRoleInfo().Remark, GetRoleInfo().RoleID);
                 if (bResult)
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(),
                                                         "Sucess", "alert('操作成功!');location.replace('RoleList.aspx?Refresh=1');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('操作失败!');", true);
                 }
             }
         }
     }
 }
示例#2
0
 protected void btnConfrim_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         List <TablePrimary> t           = new List <TablePrimary>();
         TablePrimary        userPrimary = new TablePrimary();
         userPrimary.PrimaryName  = "UserGroupName";
         userPrimary.PrimaryValue = GetUserGroupInfo().UserGroupName;
         t.Add(userPrimary);
         if (Request.QueryString["Type"] != null && Request.QueryString["Type"].ToString() == "0")//新增状态
         {
             if (Common.IsExsit("UserGroup", t))
             {
                 ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('用户组已经存在,请确认!');", true);
             }
             else
             {
                 if (UserManage.AddUserGroup(GetUserGroupInfo()))
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Sucess",
                                                         "alert('操作成功!');location.replace('UserGroupList.aspx?Refresh=1');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('操作失败!');", true);
                 }
             }
         }
         else
         {
             if (Common.IsExsit("UserGroup", t, GetUserGroupInfo().UserGroupID))
             {
                 ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('用户组已经存在,请确认!');", true);
             }
             else
             {
                 if (UserManage.UpdateUserGroup(GetUserGroupInfo()))
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Sucess",
                                                         "alert('操作成功!');location.replace('UserGroupList.aspx?Refresh=1');", true);
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Fail", "alert('操作失败!');", true);
                 }
             }
         }
     }
 }