Example #1
0
        protected override void Hapus()
        {
            var index = this.gridList.SelectedIndex;

            if (!base.IsSelectedItem(index, this.TabText))
            {
                return;
            }

            var role = _listOfRole[index];

            if (IsAdministrator(role.nama_role))
            {
                MsgHelper.MsgWarning("Maaf hak akses 'Administrator' tidak bisa dihapus");
                return;
            }

            if (MsgHelper.MsgDelete())
            {
                var result = _bll.Delete(role);
                if (result > 0)
                {
                    GridListControlHelper.RemoveObject <Role>(this.gridList, _listOfRole, role);
                    ResetButton();
                }
                else
                {
                    MsgHelper.MsgDeleteError();
                }
            }
        }
 public void Delete(int id)
 {
     try
     {
         var response = _role.Delete(id);
         Console.WriteLine(response);
     }
     catch (Exception ex)
     {
         Assert.True(false, ex.Message);
     }
 }
Example #3
0
        public void DeleteTest()
        {
            var obj = new Role
            {
                role_id = "ca001999-f31a-4746-aea3-3de628e9bfdd"
            };

            var result = _bll.Delete(obj);

            Assert.IsTrue(result != 0);

            var deletedObj = _bll.GetByID(obj.role_id);

            Assert.IsNull(deletedObj);
        }
Example #4
0
        //权限角色页面删除(进行删除操作)
        // GET: Systems/Delete/5
        public ActionResult PowerDelete(int id)
        {
            //事务
            using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())
            {
                var dd = iud.SelectAll();
                foreach (var item in dd)
                {   //判断角色是否被分配权限
                    if (item.UserJueSe == id)
                    {
                        return(Content("<script>alert('不能删除,这个角色正在被使用');window.location.href='/Systems/PowerSelect'</script>"));
                    }
                }

                info_Role role = new info_Role
                {
                    RoleID = id
                };

                if (ipsb.delete(id) >= 0)
                {
                    if (irb.Delete(role) > 0)
                    {
                        ts.Complete();
                        return(Content("<script>alert('删除成功');window.location.href='/Systems/PowerSelect'</script>"));
                    }
                    else
                    {
                        return(Content("<script>alert('删除失败');window.location.href='/Systems/PowerSelect'</script>"));
                    }
                }
                else
                {
                    return(Content("<script>alert('删除失败');window.location.href='/Systems/PowerSelect'</script>"));
                }
            }
        }
Example #5
0
 public IActionResult Delete(int id)
 {
     return(Ok(_role.Delete(id)));
 }
 public IActionResult Delete(RoleViewModel formData)
 {
     return(Ok(_role.Delete(formData)));
 }