public ActionResult DoAddNewRole(string name, string RoleTypeId)
        {
            string results = "OK";

            if (ModelState.IsValid && !string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(RoleTypeId))
            {
                var checkExist = _iroleService.Query.FirstOrDefault(x => x.name.ToUpper() == name.ToUpper());
                if (checkExist == null)
                {
                    try
                    {
                        role p = new role();
                        p.AppID = 1;
                        p.name  = name.Trim();
                        List <string> lstPmsChange = new List <string>();

                        if (Session["ArrayPms"] != null)
                        {
                            lstPmsChange = (List <string>)Session["ArrayPms"];
                        }

                        foreach (string word in lstPmsChange)
                        {
                            _permission = _ipmsService.GetByName(word, 1);
                            Listpermission.Add(_permission);
                        }
                        p.Permissions = Listpermission;

                        _iroleService.BeginTran();
                        _iroleService.CreateNew(p);

                        typeRole = new TYPE_ROLE {
                            ROLE_ID = p.roleid, TYPE = int.Parse(RoleTypeId)
                        };

                        _iTypeRoleService.CreateNew(typeRole);
                        _iLogSystemService.CreateNew(HttpContext.User.Identity.Name, "Thêm mới Phân quyền ", "Thực hiện chức năng thêm mới Phân quyền", Helper.GetIPAddress.GetVisitorIPAddress(), HttpContext.Request.Browser.Browser);
                        _iroleService.CommitTran();
                    }
                    catch (Exception e)
                    {
                        _iroleService.RolbackTran();
                        results = e.Message;
                    }
                }
                else
                {
                    results = "ExistName";
                }
            }
            else
            {
                results = "NotOK";
            }
            Session["ArrayPms"]          = null;
            Session["ChangeCheckBoxPms"] = null;
            return(Content(results, "text/html"));
        }