//Lấy danh sách quyền public void SetGroupIDViewBag(string selectedID = null) { var listUserGroup = new UserGroupDAO().GetAll(); //var id = listUserGroup.First(x => x.Id == selectedID); ViewBag.GroupID = new SelectList(listUserGroup, "Id", "Name", selectedID); }
// GET: Admin/LoaiThanhVien public ActionResult Index(string searchString, int page = 1, int pagesize = 5) { var dao = new UserGroupDAO(); var list = dao.ListAll(searchString, page, pagesize); return(View(list)); }
public ActionResult AddGroups(int id, FormCollection collection) { //try //{ // TODO: Add insert logic here UserGroup userGroup = new UserGroup(); userGroup.UserID = Convert.ToInt32(collection["UserID"]); userGroup.GroupID = Convert.ToInt32(collection["GroupID"]); int rs = UserGroupDAO.Add(userGroup); if (rs > 0) { return(RedirectToAction("Index")); } else { return(View()); } //} //catch //{ // return View(); //} }
public ActionResult Xoa(string ID) { var result = new UserGroupDAO().Delete(ID); SetAlert("Xóa thông tin thành công", "success"); return(RedirectToAction("Index", "LoaiThanhVien")); }
public void GetListGroupByUserID(int userID) { List <UserGroup> userGroups = UserGroupDAO.GetByUserID(userID); foreach (UserGroup userGroup in userGroups) { PerGroup group = PerGroupDAO.Single(userGroup.UserID.ToString()); if (!this.Groups.Contains(group)) { this.Groups.Add(group); } } }
public static List <PerGroup> GetListGroupByUserID_Static(int userID) { List <PerGroup> result = new List <PerGroup>(); List <UserGroup> userGroups = UserGroupDAO.GetByUserID(userID); foreach (UserGroup userGroup in userGroups) { PerGroup group = PerGroupDAO.Single(userGroup.GroupID.ToString()); if (!result.Contains(group)) { result.Add(group); } } return(result); }
public List <string> GetListCredential(string userName) { var user = Base.Instance.User.Single(x => x.UserName == userName); var lsCredential = new CredentialDAO().SelectAll() as List <Credential>; var lsUserGroup = new UserGroupDAO().SelectAll() as List <UserGroup>; var lsRole = new RoleDAO().SelectAll() as List <Role>; var data = lsCredential.Join(lsUserGroup, x => x.UserGroupID, y => y.ID, (x, y) => new { IDUG = x.UserGroupID, IDROLE = x.RoleID }).Join(lsRole, z => z.IDROLE, w => w.ID, (z, w) => new Credential { RoleID = z.IDROLE, UserGroupID = z.IDUG }).Where(u => u.UserGroupID == user.GroupID); return(data.Select(x => x.RoleID).ToList()); }
public ActionResult CapNhat(UserGroup entity) { if (ModelState.IsValid) { var dao = new UserGroupDAO(); var result = dao.Update(entity); if (result) { SetAlert("Cập nhật thông tin thành công", "success"); return(RedirectToAction("Index", "LoaiThanhVien")); } else { SetAlert("Cập nhật thông tin không thành công", "error"); return(RedirectToAction("CapNhat", "LoaiThanhVien")); } } return(View("Index")); }
public ActionResult ThemMoi(UserGroup entity) { if (ModelState.IsValid) { var dao = new UserGroupDAO(); var id = dao.Insert(entity); if (id == true) { SetAlert("Thêm mới thành công", "success"); return(RedirectToAction("Index", "LoaiThanhVien")); } else { SetAlert("Thêm mới không thành công", "error"); return(RedirectToAction("ThemMoi", "LoaiThanhVien")); } } return(View("Index")); }
public ActionResult CapNhat(string ID) { var model = new UserGroupDAO().GetByID(ID); return(View(model)); }
// public void SetViewBag(string selectedId = null) { var dao = new UserGroupDAO(); ViewBag.GroupID = new SelectList(dao.ListAll(), "ID", "Name", selectedId); }
public List <UserDTO> LoadMember(int iGroupID) { UserGroupDAO userGroupDAO = new UserGroupDAO(m_db); return(userGroupDAO.LoadMember(iGroupID)); }
public void DropdownUsergroup(string UsergroupID = null) { var dao = new UserGroupDAO(); ViewBag.UserGroupList = new SelectList(dao.List(), "ID", "Name", UsergroupID); }
public UserGroupBUS() { userGroupDAO = new UserGroupDAO(); }
public UserGroupBIZ(Database db) { m_daoUserGroup = new UserGroupDAO(db); m_daoUser = new UserDAO(db); }
public List <UserGroupDTO> LoadAllUserGroup() { UserGroupDAO userGroupDAO = new UserGroupDAO(m_db); return(userGroupDAO.LoadAll()); }
/// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary> /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param> /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param> /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param> /// <param name="relations">The set of relations to walk to construct to total query.</param> /// <param name="pageNumber">The page number to retrieve.</param> /// <param name="pageSize">The page size of the page to retrieve.</param> /// <returns>DataTable with the rows requested.</returns> public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize) { UserGroupDAO dao = DAOFactory.CreateUserGroupDAO(); return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize)); }
public UserGroup() { lUserGroupDAO = new UserGroupDAO(); }