예제 #1
0
        public async Task <IActionResult> GetLeads([FromRoute] Guid organizationId, [FromQuery] CommonFilters filters)
        {
            var leads = await _leadService.GetLeads <AccountManagerLeadOutput>(_accountManager, filters);

            AddPagination(filters, leads.Total);
            return(Ok(leads.Data));
        }
예제 #2
0
 protected void AddPagination(CommonFilters commonFilters, int totalRecords)
 {
     HttpContext.Response.AddPagination(commonFilters.Page ?? 1,
                                        commonFilters.PageSize ?? 0,
                                        totalRecords,
                                        (int)Math.Ceiling((double)totalRecords / (commonFilters.PageSize ?? 1)));
 }
예제 #3
0
        public bool IsMatch(FileSystemInfo itemInfo)
        {
            string path = itemInfo.FullName;

            if (PathFilters.Any(reg => reg.IsMatch(path)))
            {
                return(true);
            }

            string name = itemInfo.Name;

            if (CommonFilters.Any(reg => reg.IsMatch(name)))
            {
                return(true);
            }

            if (itemInfo is FileInfo fileInfo)
            {
                return(FileFilters.Any(reg => reg.IsMatch(name)));
            }
            else if (itemInfo is DirectoryInfo directoryInfo)
            {
                return(DirectoryFilters.Any(reg => reg.IsMatch(name)));
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
        public bool IsMatch(string name, string path, ItemType type)
        {
            if (PathFilters.Any(reg => reg.IsMatch(path)))
            {
                return(true);
            }

            if (CommonFilters.Any(reg => reg.IsMatch(name)))
            {
                return(true);
            }

            if (type == ItemType.File)
            {
                return(FileFilters.Any(reg => reg.IsMatch(name)));
            }
            else if (type == ItemType.Directory)
            {
                return(DirectoryFilters.Any(reg => reg.IsMatch(name)));
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
 public Task <PackedList <T> > GetLeads <T>(IOrganizationMarketer ma, CommonFilters filters) where T : MarketerLeadOutput
 {
     return(Repository.Queryable()
            .ForOrganizationMarketer(ma)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Lead, T>(filters, ProjectionMapping));
 }
예제 #6
0
 public Task <PackedList <T> > GetContractors <T>(IOrganizationRecruiter re, CommonFilters filters)
     where T : ContractorOutput
 {
     return(Repository.Queryable()
            .ForOrganizationRecruiter(re)
            .PaginateProjection <Contractor, T>(filters, ProjectionMapping));
 }
예제 #7
0
        public async Task <IActionResult> GetLeads([FromRoute] Guid organizationId, [FromQuery] CommonFilters filters)
        {
            var ao    = _agencyOwner.Value;
            var leads = await _leadService.GetLeads <AgencyOwnerLeadOutput>(ao, filters);

            AddPagination(filters, leads.Total);
            return(Ok(leads.Data));
        }
예제 #8
0
 public Task <PackedList <T> > GetLeads <T>(IMarketingAgencyOwner ao, CommonFilters filters) where T : AgencyOwnerLeadOutput
 {
     return(Repository.Queryable()
            .ForMarketingAgencyOwner(ao)
            .Where(x => x.IsInternal == false)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Lead, T>(filters, ProjectionMapping));
 }
예제 #9
0
        public async Task <IActionResult> GetCandidates([FromRoute] Guid organizationId,
                                                        [FromQuery] CommonFilters filters)
        {
            var candidates = await _candidateService.GetCandidates <ProjectManagerCandidateOutput>(_projectManager, filters);

            AddPagination(filters, candidates.Total);
            return(Ok(candidates.Data));
        }
예제 #10
0
        public async Task <IActionResult> GetCustomers(
            [FromRoute] Guid organizationId, [FromQuery] CommonFilters filters)
        {
            var marketers = await _customerService.GetList <MarketerCustomerOutput>(_marketer, filters);

            AddPagination(filters, marketers.Total);
            return(Ok(marketers.Data));
        }
예제 #11
0
 public Task <PackedList <T> > GetAccounts <T>(
     IProviderAgencyOwner ao, CommonFilters filters)
     where T : AgencyOwnerCustomerAccountOutput
 {
     return(Repository.Queryable()
            .ForAgencyOwner(ao)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <CustomerAccount, T>(filters, ProjectionMapping));
 }
예제 #12
0
 public Task <PackedList <T> > GetAccounts <T>(
     IOrganizationCustomer cu, CommonFilters filters)
     where T : CustomerCustomerAccountOutput
 {
     return(Repository.Queryable()
            .ForOrganizationCustomer(cu)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <CustomerAccount, T>(filters, ProjectionMapping));
 }
        public async Task <IActionResult> Get(
            [FromRoute] Guid organizationId,
            [FromQuery] CommonFilters filters)
        {
            var accounts = await _accountService
                           .GetAccounts <AccountManagerCustomerAccountOutput>(_accountManager, filters);

            AddPagination(filters, accounts.Total);
            return(Ok(accounts.Data));
        }
예제 #14
0
        public async Task <IActionResult> GetContractors(
            [FromRoute] Guid organizationId, [FromQuery] CommonFilters filters
            )
        {
            var contractors = await _contractorService
                              .GetContractors <RecruiterContractorOutput>(_recruiter, filters);

            AddPagination(filters, contractors.Total);
            return(Ok(contractors.Data));
        }
예제 #15
0
        public Task <PackedList <T> > GetLeads <T>(IProviderAgencyOwner ao, CommonFilters filters) where T : AgencyOwnerLeadOutput
        {
            _logger.LogInformation(GetLogMessage("{ProviderAgencyOwner}"), ao.OrganizationId);

            return(Repository.Queryable()
                   .ForAgencyOwner(ao)
                   .Where(x => x.Status == LeadStatus.New)
                   .OrderByDescending(x => x.Updated)
                   .PaginateProjection <Lead, T>(filters, ProjectionMapping));
        }
예제 #16
0
        public object GetSearchConfiguration([FromUri] object param)
        {
            CommonFilters commfilters = new CommonFilters();

            commfilters.DeserializeParameters(param);

            db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
            var entryPoint = (from configs in db.Configurations
                              join wkitems in db.WorkItems on configs.work_item_id equals wkitems.work_item_id
                              join status in db.Statuses on configs.config_status_id equals status.status_id
                              join application in db.Applications on configs.application_id equals application.application_id
                              join scope in db.Scopes on wkitems.scope_id equals scope.scope_id
                              join sprint in db.Sprints on wkitems.sprint_id equals sprint.sprint_id
                              join config_type in db.Config_Types on configs.config_type_id equals config_type.config_type_id
                              where (String.IsNullOrEmpty(commfilters.work_item_nm) || commfilters.work_item_nm.Contains(wkitems.work_item_ext_id)) &&
                              (String.IsNullOrEmpty(commfilters.modified_usr_ids) || commfilters.modified_usr_ids.Contains(configs.modified_usr_id)) &&
                              ((commfilters.startdate == null || configs.modified_dtm == null) || configs.modified_dtm >= commfilters.startdate) &&
                              ((commfilters.enddate == null || configs.modified_dtm == null) || configs.modified_dtm <= commfilters.enddate)
                              select new
            {
                configs.config_id,
                configs.config_nm,
                configs.config_key,
                configs.config_dev_int_value,
                configs.config_qa_value,
                configs.config_prod_value,
                configs.config_status_id,
                configs.config_type_id,
                configs.application_id,
                wkitems.sprint_id,
                wkitems.work_item_ext_id,
                wkitems.scope_id,
                configs.is_pdf,
                configs.pdfaction,
                configs.comments,
                application.application_nm,
                scope.scope_nm,
                sprint.sprint_nm,
                status.status_nm,
                config_type.config_type_nm
            }).ToList();

            //return db.Configurations.AsEnumerable();
            db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);

            // Apply filters
            var filtereddata = (from dbdata in entryPoint
                                where ((commfilters.applications == null || commfilters.applications.Count == 0) || commfilters.applications.Any(cp => cp.application_id.Equals(dbdata.application_id))) &&
                                ((commfilters.scopes == null || commfilters.scopes.Count == 0) || commfilters.scopes.Any(cp => cp.scope_id.Equals(dbdata.scope_id))) &&
                                ((commfilters.sprints == null || commfilters.sprints.Count == 0) || commfilters.sprints.Any(cp => cp.sprint_id.Equals(dbdata.sprint_id)))
                                select dbdata);


            return(filtereddata.ToArray());
        }
예제 #17
0
        /// <summary>
        ///     Finds stealth targets using ldap properties.
        /// </summary>
        /// <returns></returns>
        private async Task <Dictionary <string, ISearchResultEntry> > FindPathTargetSids()
        {
            var paths = new ConcurrentDictionary <string, byte>();
            var sids  = new Dictionary <string, ISearchResultEntry>();

            var query = new LDAPFilter();

            query.AddComputers("(|(homedirectory=*)(scriptpath=*)(profilepath=*))");
            foreach (var domain in Context.Domains)
            {
                //Request user objects with the "homedirectory", "scriptpath", or "profilepath" attributes
                Parallel.ForEach(Context.LDAPUtils.QueryLDAP(
                                     query.GetFilter(),
                                     SearchScope.Subtree,
                                     new[] { "homedirectory", "scriptpath", "profilepath" }, domain), searchResult =>
                {
                    //Grab any properties that exist, filter out null values
                    var poss = new[]
                    {
                        searchResult.GetProperty("homedirectory"), searchResult.GetProperty("scriptpath"),
                        searchResult.GetProperty("profilepath")
                    }.Where(s => s != null);

                    // Loop over each possibility, and grab the hostname from the path, adding it to a list
                    foreach (var s in poss)
                    {
                        var split = s.Split('\\');
                        if (!(split.Length >= 3))
                        {
                            continue;
                        }
                        var path = split[2];
                        paths.TryAdd(path, new byte());
                    }
                });
            }



            // Loop over the paths we grabbed, and resolve them to sids.
            foreach (var path in paths.Keys)
            {
                var sid = await Context.LDAPUtils.ResolveHostToSid(path, Context.DomainName);

                if (sid != null && sid.StartsWith("S-1-5"))
                {
                    var searchResult = Context.LDAPUtils.QueryLDAP(CommonFilters.SpecificSID(sid),
                                                                   SearchScope.Subtree, _props.ToArray());
                    sids.Add(sid, searchResult.FirstOrDefault());
                }
            }

            //Return all the sids corresponding to objects
            return(sids);
        }
        public Array GetCheckListItemSummary([FromUri] object param)
        {
            CommonFilters commfilters = new CommonFilters();

            commfilters.DeserializeParameters(param);

            var entryPoint = (from checklist in db.CheckListActions
                              join chklistactionxref in db.CheckListActionsXref on checklist.checklist_action_id equals chklistactionxref.checklist_action_id
                              join refsubtype in db.SubTypes on checklist.sub_type_id equals refsubtype.sub_type_id into grefsubtype
                              from agrefsubtype in grefsubtype.DefaultIfEmpty()
                              where
                              (String.IsNullOrEmpty(commfilters.modified_usr_ids) || commfilters.modified_usr_ids.Contains(checklist.modified_usr_id)) &&
                              ((commfilters.startdate == null || checklist.modified_dtm == null) || checklist.modified_dtm >= commfilters.startdate) &&
                              ((commfilters.enddate == null || checklist.modified_dtm == null) || checklist.modified_dtm <= commfilters.enddate)

                              group chklistactionxref by new { agrefsubtype.sub_type_nm, checklist.created_usr_id, checklist.created_dtm, checklist.checklist_action_nm, chklistactionxref.checklist_action_id } into g
                              select new
            {
                NOTSTARTED = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.NOTSTARTED)),
                COMPLETED = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.COMPLETED)),
                INPROGRESS = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.INPROGRESS)),
                NOTAPPLICABLE = g.Count(chklistactionxref => chklistactionxref.status_id == (short)(CheckListStatus.NOTAPPLICABLE)),
                g.Key.sub_type_nm,
                g.Key.created_usr_id,
                g.Key.created_dtm,
                g.Key.checklist_action_nm,
                g.Key.checklist_action_id,
            }
                              ).ToList();


            // Apply filters

            var filtereddata = (from dbdata in entryPoint
                                where (
                                    (commfilters.search_for_options == null)
                                    ||
                                    ((commfilters.search_for_options["value"].ToString() == "COMPLETED" && (dbdata.INPROGRESS + dbdata.NOTSTARTED) == 0) ||
                                     (commfilters.search_for_options["value"].ToString() == "INCOMPLETE" && (dbdata.INPROGRESS + dbdata.NOTSTARTED) > 0) ||
                                     (commfilters.search_for_options["value"].ToString() == "ALL"))
                                    )
                                select dbdata).ToList();


            return(filtereddata.ToArray());
        }
예제 #19
0
        public async static Task <PackedList <TResult> > PaginateProjection <TEntity, TResult>
            (this IQueryable <TEntity> query, CommonFilters filters, MapperConfiguration mapperConfiguration)
            where TEntity : AuditableEntity where TResult : class
        {
            PackedList <TResult> packedResult = new PackedList <TResult>();

            if (filters.Page.HasValue && filters.PageSize.HasValue)
            {
                var skip = (filters.Page.Value - 1) * filters.PageSize.Value;
                packedResult.Total = await query.ProjectTo <TResult>(mapperConfiguration).CountAsync();

                packedResult.Data = await query.Skip(skip).Take(filters.PageSize.Value)
                                    .ProjectTo <TResult>(mapperConfiguration).ToListAsync();
            }
            else
            {
                packedResult.Data = await query.ProjectTo <TResult>(mapperConfiguration).ToListAsync();

                packedResult.Total = packedResult.Data.Count();
            }

            return(packedResult);
        }
        public object GetSearchWorkItem([FromUri] object param)
        {
            CommonFilters commfilters = new CommonFilters();

            commfilters.DeserializeParameters(param);

            var entryPoint = (from wkitems in db.WorkItems
                              join scope in db.Scopes on wkitems.scope_id equals scope.scope_id
                              join sprint in db.Sprints on wkitems.sprint_id equals sprint.sprint_id
                              where ((commfilters.startdate == null || wkitems.modified_dtm == null) || wkitems.modified_dtm >= commfilters.startdate) &&
                              ((commfilters.enddate == null || wkitems.modified_dtm == null) || wkitems.modified_dtm <= commfilters.enddate)

                              //where (String.IsNullOrEmpty(commfilters.work_item_nm) || commfilters.work_item_nm.Contains(wkitems.work_item_ext_id))
                              //&& (String.IsNullOrEmpty(commfilters.modified_usr_ids) || commfilters.modified_usr_ids.Contains(wkitems.modified_usr_id))
                              ////&& (commfilters.startdate == null || wkitems.modified_dtm >= commfilters.startdate)
                              //&& (commfilters.enddate == null || wkitems.modified_dtm <= commfilters.enddate)
                              select new
            {
                wkitems.work_item_id,
                wkitems.sprint_id,
                wkitems.work_item_ext_id,
                wkitems.scope_id,
                scope.scope_nm,
                sprint.sprint_nm,
                wkitems.work_item_title
            }).ToList();

            // Apply filters
            var filtereddata = (from dbdata in entryPoint
                                where ((commfilters.scopes == null || commfilters.scopes.Count == 0) || commfilters.scopes.Any(cp => cp.scope_id.Equals(dbdata.scope_id))) &&
                                ((commfilters.sprints == null || commfilters.sprints.Count == 0) || commfilters.sprints.Any(cp => cp.sprint_id.Equals(dbdata.sprint_id)))
                                select dbdata);


            return(filtereddata.ToArray());
        }
예제 #21
0
        public async Task <IActionResult> GetMarketerStatistics([FromRoute] Guid organizationId,
                                                                [FromQuery] MarketerFilters filters, [FromQuery] CommonFilters pagingFilters)
        {
            var result = await _marketerService
                         .GetForOrganization <OrganizationMarketerStatistics>(_accountManager.OrganizationId, filters, pagingFilters);

            AddPagination(pagingFilters, result.Total);
            return(Ok(result.Data));
        }
예제 #22
0
        public async Task <IActionResult> GetProjectManagerStatistics([FromRoute] Guid organizationId,
                                                                      [FromQuery] ProjectManagerFilters filter, [FromQuery] CommonFilters pagingFilters)
        {
            var result = await _projectManagerService
                         .GetForOrganization <OrganizationProjectManagerStatistics>(_agencyOwner.OrganizationId, filter, pagingFilters);

            AddPagination(pagingFilters, result.Total);
            return(Ok(result.Data));
        }
        public async Task <PackedList <T> > GetForOrganization <T>(Guid organizationId,
                                                                   MarketerFilters filters, CommonFilters pagingFilters) where T : OrganizationMarketerOutput
        {
            var organizationMarketers = Repository.Queryable()
                                        .Where(x => x.OrganizationId == organizationId)
                                        .ApplyWhereFilters(filters)
                                        .ProjectTo <T>(ProjectionMapping)
                                        .OrderByDescending(x => x.IsDefault);

            return(new PackedList <T>
            {
                Data = await organizationMarketers.Paginate(pagingFilters.Page, pagingFilters.PageSize).ToListAsync(),
                Total = await organizationMarketers.CountAsync()
            });
        }
        public async Task <IActionResult> GetStoryTemplates([FromRoute] Guid organizationId, [FromQuery] CommonFilters filters)
        {
            var templates = await _storyTemplateService.GetStoryTemplates(_accountManager, filters);

            AddPagination(filters, templates.Total);
            return(Ok(templates.Data));
        }
예제 #25
0
 public async Task <PackedList <T> > GetLeads <T>(IOrganizationAccountManager am, CommonFilters filters) where T : AccountManagerLeadOutput
 {
     return(await Repository.Queryable()
            .ForOrganizationAccountManager(am)
            .Where(x => x.Status == LeadStatus.Qualified)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Lead, T>(filters, ProjectionMapping));
 }
예제 #26
0
 public Task <PackedList <T> > GetActiveCandidates <T>(IProviderAgencyOwner agencyOwner, CommonFilters filters)
     where T : AgencyOwnerCandidateOutput
 {
     return(Repository.Queryable()
            .ForAgencyOwner(agencyOwner)
            .Where(x => x.Status == CandidateStatus.New)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Candidate, T>(filters, ProjectionMapping));
 }
예제 #27
0
 public Task <PackedList <T> > GetCandidates <T>(IOrganizationRecruiter organizationRecruiter, CommonFilters filters)
     where T : RecruiterCandidateOutput
 {
     return(Repository.Queryable()
            .ForOrganizationRecruiter(organizationRecruiter)
            .OrderByDescending(x => x.Updated)
            .PaginateProjection <Candidate, T>(filters, ProjectionMapping));
 }
 public Task <PackedList <T> > GetForOrganization <T>(Guid organizationId,
                                                      AccountManagerFilters filters, CommonFilters pagingFilters) where T : OrganizationAccountManagerOutput
 {
     return(Repository.Queryable()
            .ApplyWhereFilters(filters)
            .Where(x => x.OrganizationId == organizationId)
            .PaginateProjection <OrganizationAccountManager, T>(pagingFilters, ProjectionMapping));
 }
예제 #29
0
 public Task <PackedList <StoryTemplateOutput> > GetStoryTemplates(IOrganizationProjectManager pm, CommonFilters filters)
 {
     return(Repository.Queryable()
            .Where(x => x.ProviderOrganizationId == pm.OrganizationId)
            .PaginateProjection <StoryTemplate, StoryTemplateOutput>(filters, ProjectionMapping));
 }