public IActionResult GetActiveRole() { RoleGrid roleGrid = new RoleGrid(); roleGrid.ID = "1"; roleGrid.Description = "This is testing one"; roleGrid.RoleName = "Yasir"; List <RoleGrid> roleGrids = new List <RoleGrid>(); roleGrids.Add(roleGrid); roleGrid = new RoleGrid(); roleGrid.ID = "2"; roleGrid.Description = "this is two"; roleGrid.RoleName = "Tariq"; roleGrids.Add(roleGrid); roleGrid = new RoleGrid(); roleGrid.ID = "3"; roleGrid.Description = "this is two"; roleGrid.RoleName = "dgn"; roleGrids.Add(roleGrid); var data = roleGrids.ToList().Select(c => new { ID = c.ID, RoleName = c.RoleName, Description = c.Description }).ToList(); return(Ok(data)); }
protected void Page_Load(object sender, EventArgs e) { //SELECT user.BsnNumber,user.EmailAdress, user.FirstName,user.LastName from user where user.Confirmed=0 if (!IsPostBack) { Messager.Text = ""; Messager.Visible = false; loggedinUser = Session["User"] as Entities.User; if (loggedinUser != null) { try { UserGrid.DataSource = dBUserConnection.getPendingUsers(loggedinUser); UserGrid.DataBind(); ListBoxUsers.DataSource = dBUserConnection.GetAllUsers(loggedinUser); ListBoxUsers.DataTextField = "FirstName"; ListBoxUsers.DataValueField = "BsnNumber"; ListBoxUsers.DataBind(); DAL.DBRoleConnection dBRoleConnection = new DAL.DBRoleConnection(); ListBoxRoles.DataSource = dBRoleConnection.GetRoles(); ListBoxRoles.DataTextField = "Description"; ListBoxRoles.DataValueField = "RoleID"; ListBoxRoles.DataBind(); ListBoxUserTherapist.DataSource = ListBoxUsers.DataSource; ListBoxUserTherapist.DataTextField = "FirstName"; ListBoxUserTherapist.DataValueField = "BsnNumber"; ListBoxUserTherapist.DataBind(); ListBoxTherapist.DataSource = dBUserConnection.GetAllUsersWithRole(loggedinUser); ListBoxTherapist.DataTextField = "FirstName"; ListBoxTherapist.DataValueField = "ID"; ListBoxTherapist.DataBind(); ListboxFunctionRoles.DataSource = dBRoleConnection.GetRoles(); ListboxFunctionRoles.DataTextField = "Description"; ListboxFunctionRoles.DataValueField = "RoleID"; ListboxFunctionRoles.DataBind(); RoleGrid.DataSource = dBRoleConnection.GetRights(); RoleGrid.DataBind(); } catch (Exception ex) { showMessage(ex.Message); } } } }
public IActionResult GetRolesFromRolePermission() { try { if (true) { // var roles = _roleService.GetAllPermissions(); //roles = roles.Where(x => x.Id == int.Parse(id.ToString())).ToList(); //var parent = roles.Where(x => x.ParentPermissionId == null).Select(c => new RoleNode { value = c.Id.Value, label = c.PermissionName, children = addChild(c.Id, roles) }).ToList(); //var checkedNode = parent.Select(c => c.value).ToList(); RoleGrid roleGrid = new RoleGrid(); roleGrid.ID = "1"; roleGrid.Description = "This is testing one"; roleGrid.CreatedBy = "Osama"; roleGrid.RoleName = "Yasir"; roleGrid.Status = "Rejected"; List <RoleGrid> roleGrids = new List <RoleGrid>(); roleGrids.Add(roleGrid); roleGrid = new RoleGrid(); roleGrid.ID = "2"; roleGrid.Description = "this is two"; roleGrid.CreatedBy = "Nuaman"; roleGrid.RoleName = "Tariq"; roleGrid.Status = "Pending"; roleGrids.Add(roleGrid); roleGrid = new RoleGrid(); roleGrid.ID = "3"; roleGrid.Description = "this is two"; roleGrid.CreatedBy = "waleed"; roleGrid.RoleName = "Salman"; roleGrid.Status = "Active"; roleGrids.Add(roleGrid); return(Ok(roleGrids)); } else { return(NotFound("Record Not Found")); } } catch (System.Exception ex) { return(NotFound("Something Went wrong" + ex.Message.ToString())); } }
public IActionResult SearchRole(SearchRole searchRole) { RoleGrid roleGrid = new RoleGrid(); roleGrid.ID = "1"; roleGrid.Description = "This is testing one"; roleGrid.CreatedBy = "Osama"; roleGrid.RoleName = "Yasir"; roleGrid.Status = "Rejected"; List <RoleGrid> roleGrids = new List <RoleGrid>(); roleGrids.Add(roleGrid); roleGrid = new RoleGrid(); roleGrid.ID = "2"; roleGrid.Description = "this is two"; roleGrid.CreatedBy = "Nuaman"; roleGrid.RoleName = "Tariq"; roleGrid.Status = "Pending"; roleGrids.Add(roleGrid); roleGrid = new RoleGrid(); roleGrid.ID = "3"; roleGrid.Description = "this is two"; roleGrid.CreatedBy = "dgn"; roleGrid.RoleName = "dgn"; roleGrid.Status = "Approved"; roleGrids.Add(roleGrid); if (searchRole.Role.Status.ToLower() == "all") { return(Ok(roleGrids)); } return(Ok(roleGrids.Where(x => x.Status.ToLower() == searchRole.Role.Status.ToLower()).ToList())); }
public ActionResult SearchRole(RolePager pager) { var service = Container.GetService <IRoleService>(); var size = Convert.ToInt32(pager.pageSize); var idx = Convert.ToInt32(pager.pageIndex); var where = new StringBuilder(" where 1=1 "); if (!string.IsNullOrWhiteSpace(pager.Name)) { where.AppendLine("and C_Name like '%" + pager.Name + "%'"); } if (!string.IsNullOrWhiteSpace(pager.DateFrom)) { where.AppendLine("and C_CreatedDate>'" + pager.DateFrom + "' "); } if (!string.IsNullOrWhiteSpace(pager.DateTo)) { where.AppendLine("and C_CreatedDate<'" + pager.DateTo + "' "); } var sql = @"SELECT TOP 1000 t1.[keyid] ,[C_Name] ,ParentName ,[C_ParentRole] ,[C_CreatedDate] ,[C_UpdatedDate] FROM [DATA_MANAGE].[dbo].[tbl_Role] as t1 left join (select keyid, C_Name as ParentName from tbl_Role) as t2 on t1.C_ParentRole=t2.keyid"; var roles = service.GetModelsByPage <RoleDto>(size, idx, sql + where); var rolegrid = new RoleGrid(); rolegrid.rows = RoleInfo.ConvertToRoleInfos(roles); rolegrid.total = service.GetTableCount(where.ToString()); return(Json(rolegrid)); }