protected void ShowUserGrid(DataGrid dataGrid, int index, string sort, string order) { dataGrid.PageSize = Helpers.GetPageSize("PageSize.UserList"); UserContainer selected = new UserContainer(); JobAnswer filter = new JobAnswer(m_JobId, JobAnswerTypeEnum.FIN, "", Context.User.Identity.Name); filter.FilterOnIsActive = 1; IJobAnswerService srvJobAnswer = ServiceFactory.GetJobAnswerService(); IUserService srvUser = ServiceFactory.GetUserService(); JobAnswerContainer answers = srvJobAnswer.JobAnswerSelectFiltered(filter); foreach (JobAnswer answer in answers.All) { User user = srvUser.UserSelect(answer.SubscriberNameRef); selected.Add(user); } if (selected.AllCount > 0) { dataGrid.Visible = true; lblNotFoundUser.Visible = false; } else { dataGrid.Visible = false; lblNotFoundUser.Visible = true; return; } ArrayList sortableList; // Sort if necessary if (sort == null) { sortableList = selected.All.Items; } else { if (String.Compare(order, "Ascending", true) == 0) { sortableList = selected.All.SortBy(sort, true); } else sortableList = String.Compare(order, "Descending", true) == 0 ? selected.All.SortBy(sort, false) : selected.All.SortBy(sort); } // Bind list to datagrid control dataGrid.CurrentPageIndex = index; dataGrid.CurrentSortExpression = sort; dataGrid.CurrentSortOrder = order; dataGrid.DataSource = sortableList; dataGrid.DataBind(); }
public virtual UserContainer UserSelectAll() { TraceCallEnterEvent.Raise(); try { UserContainer result; DataSet entitySet = m_DataContext.ndihdUserSelectAll(); result = new UserContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public UserContainer UserSelectFiltered(User filter) { // Check permission: Administrator PrincipalPermission permissionAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permissionAdm.Demand(); TraceCallEnterEvent.Raise(); try { UserContainer result; DataSet entitySet = m_DataContext.ndihdUserSelectFiltered( filter.Right, filter.OrganisationRef, filter.LoginName, filter.FilterOnIsactive, filter.FilterOnLockedOut); result = new UserContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public UserContainer UserSelectOfEmailRecipient( bool activityOther, bool activityPrevention, bool activityRehabilitation, bool activityResearch, bool activityNDI, bool activityAll) { // Check permission: Administrator PrincipalPermission permissionAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permissionAdm.Demand(); TraceCallEnterEvent.Raise(); try { string ndiIdSting = ConfigurationManager.AppSettings["NDI.Id"]; Guid ndiID= Guid.Empty; if (ndiIdSting != null && ndiIdSting.Length == 36) { ndiID= new Guid(ndiIdSting); } OrganisationService orgSrv = new OrganisationService(m_DataContext); UserContainer all; UserContainer result; DataSet entitySet = m_DataContext.ndihdUserSelectDispsetOfEmailRecipient(); all = new UserContainer(entitySet.Tables[0]); result = new UserContainer(); //mindenki if (activityAll) { result = new UserContainer(entitySet.Tables[0]); } else { foreach (User user in all.All) { Organisation org = orgSrv.OrganisationSelect(user.OrganisationRef); if (org != null) { if(org.ID.Equals(ndiID) && activityNDI) { if (!result.All.Items.Contains(user)) { result.All.Items.Add(user); } } if (org.ActivityOther && activityOther) { if (!result.All.Items.Contains(user)) { result.All.Items.Add(user); } } if (org.ActivityPrevention && activityPrevention) { if (!result.All.Items.Contains(user)) { result.All.Items.Add(user); } } if (org.ActivityRehabilitation && activityRehabilitation) { if (!result.All.Items.Contains(user)) { result.All.Items.Add(user); } } if (org.ActivityResearch && activityResearch) { if (!result.All.Items.Contains(user)) { result.Add(user); } } } } } TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual UserContainer SelectChildrenByUserOfOrganisation(DBGuid IDVal) { TraceCallEnterEvent.Raise(); try { UserContainer result; DataSet entitySet = m_DataContext.ndihdUserOfOrganisationSelectBy(IDVal); result = new UserContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }