public void TestList() { UserDao userDao = new UserDao(connectionString); RoleDao roleDao = new RoleDao(connectionString); Role role = TestHelper.CreateRole(); int isSave = roleDao.Save(role); Assert.IsTrue(isSave > 0); User user1 = TestHelper.CreateUser(); User user2 = TestHelper.CreateUser(); role.Users = new List <User>(); role.Users.Add(user1); role.Users.Add(user2); isSave = roleDao.Update(role); Assert.IsTrue(isSave > 0); IList <User> list = userDao.List(role.Id); Assert.AreEqual(2, list.Count); int isDelete = roleDao.Delete(role.Id); Assert.IsTrue(isDelete > 0); list = userDao.List(role.Id); Assert.AreEqual(0, list.Count); }
public void Delete() { const int id = 1; var model = RoleDao.Delete(id); Assert.IsNotNull(model); }
public bool DeleteRole(string id) { if (string.IsNullOrEmpty(id)) throw new Exception("删除角色时没有ID"); ISqlMapper mapper = MapperHelper.GetMapper(); RoleDao dao = new RoleDao(mapper); Role_Module_ActionDao rmadao = new Role_Module_ActionDao(mapper); rmadao.Delete(new Role_Module_ActionQueryForm { RoleID = id }); Role currentrole = dao.Query(new RoleQueryForm { ID = id }).FirstOrDefault(); return dao.Delete(new RoleQueryForm { ID = id }); }
public bool Delete(string code) { try { return(_roleDao.Delete(code)); } catch (Exception ex) { nlog.Error(ex, "删除角色失败!", code); return(false); } }
/// <summary> /// 删除角色 /// </summary> /// <param name="roleId">角色Id</param> /// <returns></returns> public Result Delete(int roleId) { int row = roleDao.Delete(roleId); if (row > 0) { return(Result.除成功); } else { return(Result.除失败); } }
public string Delete(string Id) { var dao = new RoleDao(); var result = dao.Delete(Id); if (result == 1) { SetAlert("Thêm bản ghi thành công!", "success"); return("Deleted successfully"); } else { SetAlert("Không thể thêm bản ghi này!", "error"); return("Some Validation "); } }
private void B_DELETE_Click(object sender, EventArgs e) { if (MessageBox.Show("Really delete?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { ModelRole model = new ModelRole(); model.id = this.id; model.role_code = role_code.Text; model.role_name = role_name.Text; Boolean result = roleDao.Delete(model); if (result) { MessageBox.Show("ลบข้อมูลเรียบร้อยแล้ว"); refresh(); } } }
public void TestCURD() { Role role = TestHelper.CreateRole(); RoleDao roleDao = new RoleDao(connectionString); int isSave = roleDao.Save(role); Assert.IsTrue(isSave > 0); role.Name = "hello"; int isUpdate = roleDao.Update(role); Assert.IsTrue(isUpdate > 0); int isDelete = roleDao.Delete(role.Id); Assert.IsTrue(isDelete > 0); }
public bool DeleteRole(string id) { if (string.IsNullOrEmpty(id)) { throw new Exception("删除角色时没有ID"); } ISqlMapper mapper = Common.GetMapperFromSession(); RoleDao dao = new RoleDao(mapper); Role_Module_ActionDao rmadao = new Role_Module_ActionDao(mapper); rmadao.Delete(new Role_Module_ActionQueryForm { RoleID = id }); Role currentrole = dao.Query(new RoleQueryForm { ID = id }).FirstOrDefault(); return(dao.Delete(new RoleQueryForm { ID = id })); }
/// <summary> /// Delete Role /// </summary> /// <param name="objRole"></param> public static void DeleteRole(Role objRole) { RoleDao.Delete(objRole); }
public bool DeleteRole(int roleId) { return(RoleDao.Delete(roleId)); }
public bool Delete(Guid RoleID) { return(ModelRole.Delete(RoleID)); }