示例#1
0
 protected void btnok_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp("SetPurview"))
     {
         base.ShowMsg("Không có thẩm quyền");
     }
     else if (this.role != null && this.role.RoleName != "超级管理员")
     {
         System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
         string text = HttpContext.Current.Request.Form["purviewcollect"];
         if (!string.IsNullOrEmpty(text) && text.IndexOf(',') != -1)
         {
             stringBuilder.Append(" INSERT sys_Purview  (     RoleID,     ModuleID,     OperateCode ) ");
             string[] array = text.Split(new char[]
             {
                 ','
             });
             for (int i = 0; i < array.Length; i += 2)
             {
                 stringBuilder.Append(string.Concat(new object[]
                 {
                     " select ",
                     this.role.AutoID,
                     ",",
                     array[i],
                     ",'",
                     array[i + 1],
                     "' union all"
                 }));
             }
             string text2 = stringBuilder.ToString();
             text2 = text2.Substring(0, text2.Length - "union all".Length);
             Purview.DeleteByRoleID(base.OpID);
             if (PageBase.dbo.ExecSQL(text2))
             {
                 CacheUtils.Del("JsonLeeCMS_CacheForGetAccountMenuDT");
                 PageBase.log.AddEvent(base.LoginAccount.AccountName, "更新角色[" + this.role.RoleName + "]的权限设置成功");
                 base.Response.Redirect(string.Concat(new object[]
                 {
                     "Role.aspx?CatalogID=",
                     base.CurrentCatalogID,
                     "&Module=",
                     base.CurrentModuleCode,
                     "&action=View"
                 }));
             }
             else
             {
                 base.ShowMsg("Thao tác thất bại");
             }
         }
     }
 }