public PageResultDTO <JobIndexPointSummaryDTOWithAction> GetAllJobIndexPoints(long periodId, long calculationId, int pageSize, int pageIndex)
        {
            var fs  = new ListFetchStrategy <JobIndexPointWithEmployee>(Enums.FetchInUnitOfWorkOption.NoTracking);
            var cal = calculationRep.GetById(new CalculationId(calculationId));

            if (cal.PeriodId.Id != periodId)
            {
                throw new Exception("چنین محاسبه ای در دوره ذکر شده نداریم.");
            }
            fs.WithPaging(pageSize, pageIndex).OrderByDescending(c => c.JobIndexPoint.Value);

            repository.Find <SummaryEmployeePoint>(c => c.CalculationId == cal.Id && c.IsFinal, fs);

            var res = new PageResultDTO <JobIndexPointSummaryDTOWithAction>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            var i   = (res.CurrentPage - 1) * res.PageSize;
            var lst = fs.PageCriteria.PageResult.Result.Select(p =>
            {
                i++;
                var m = jobIndexPointMapper.MapToModel(p);
                m.EmployeeRankInPeriod = i;
                return(m);
            }).ToList();

            res.Result = lst;
            return(res);
        }
Esempio n. 2
0
        public PageResultDTO <UserDTOWithActions> GetAllUsers(int pageSize, int pageIndex, string filter)
        {
            var fs = new ListFetchStrategy <User>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.WithPaging(pageSize, pageIndex);

            var criterias = filter.Split(';');
            var predicate = getUserPredicate(criterias);
            var rs        = getPredicate(criterias);

            if (criterias.Count() > 1)
            {
                //TODO:
                userRep.FindUsers(predicate, fs);//, rs[0], rs[1], rs[2], pageSize, pageIndex);
            }
            else
            {
                //TODO:
                userRep.FindUsers(predicate, fs);//, "", "", "", pageSize, pageIndex);
            }
            var res = new PageResultDTO <UserDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            List <UserDTOWithActions> result = new List <UserDTOWithActions>();

            fs.PageCriteria.PageResult.Result.ForEach(p =>
            {
                var u = userDTOWithActionsMapper.MapToModel(p);
                //u.CompanyDto = new CompanyDto() { Id = p.CompanyId };
                result.Add(u);
            });
            res.Result = result;
            return(res);
        }
Esempio n. 3
0
        public PageResultDTO <PeriodDTOWithAction> GetAllPeriods(int pageSize, int pageIndex)
        {
            var fs = new ListFetchStrategy <Period>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.WithPaging(pageSize, pageIndex);
            periodRep.GetAll(fs);
            var res = new PageResultDTO <PeriodDTOWithAction>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result =
                fs.PageCriteria.PageResult.Result.Select(p => periodDTOWithActionsMapper.MapToModel(p)).ToList();
            return(res);
        }
Esempio n. 4
0
        public PageResultDTO <PolicyDTOWithActions> GetAllPolicies(int pageSize, int pageIndex)
        {
            var fs = new ListFetchStrategy <Policy>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.OrderBy(x => x.Id);
            fs.WithPaging(pageSize, pageIndex);
            policyRep.FindBy(fs);
            var res = new PageResultDTO <PolicyDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result = fs.PageCriteria.PageResult.Result.Select(r => policyWithActionMapper.MapToModel(r)).ToList();
            return(res);
        }
Esempio n. 5
0
        public PageResultDTO <EmployeeDTOWithActions> GetAllEmployees(long periodId, int pageSize, int pageIndex)
        {
            var fs = new ListFetchStrategy <Employee>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.WithPaging(pageSize, pageIndex);
            fs.OrderBy(e => e.Id);
            employeeRep.Find(e => e.Id.PeriodId == new PeriodId(periodId), fs);
            var res = new PageResultDTO <EmployeeDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result =
                fs.PageCriteria.PageResult.Result.Select(p => employeeDTOWithActionsMapper.MapToModel(p)).ToList();
            return(res);
        }
Esempio n. 6
0
        public PageResultDTO <CalculationBriefDTOWithAction> GetAllCalculations(long periodId, int pageSize, int pageIndex)
        {
            var fs = new ListFetchStrategy <CalculationWithPolicyAndPeriod>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.WithPaging(pageSize, pageIndex).OrderBy(c => c.Calculation.Id.Id);
            var x = calculationRep.FindByWithPolicy(new PeriodId(periodId), fs);

            var res = new PageResultDTO <CalculationBriefDTOWithAction>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            var lst = fs.PageCriteria.PageResult.Result.Select(p => calculationBriefMapper.MapToModel(p)).ToList();

            res.Result = lst;
            return(res);
        }
Esempio n. 7
0
        public PageResultDTO <CalculationExceptionBriefDTOWithAction> GetAllCalculationExceptions(long calculationId, int pageSize, int pageIndex)
        {
            var fs = new ListFetchStrategy <EmployeeCalculationException>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.WithPaging(pageSize, pageIndex).OrderByDescending(c => c.Id.Id);
            var x = calculationExpRepository.FindBy(new CalculationId(calculationId), fs);

            var res = new PageResultDTO <CalculationExceptionBriefDTOWithAction>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            var lst = fs.PageCriteria.PageResult.Result.Select(p => calculationExceptionBriefMapper.MapToModel(p)).ToList();

            res.Result = lst;

            return(res);
        }
Esempio n. 8
0
        public PageResultDTO <EmployeeDTOWithActions> GetAllEmployees(long periodId, int pageSize, int pageIndex,
                                                                      string filter)
        {
            var fs = new ListFetchStrategy <Employee>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.WithPaging(pageSize, pageIndex);
            fs.OrderBy(e => e.Id);
            //todo:(LOW) Must be code in better way
            var criterias = filter.Split(';');
            var predicate = getEmployeePredicate(criterias, periodId);

            employeeRep.Find(predicate, fs);
            var res = new PageResultDTO <EmployeeDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result =
                fs.PageCriteria.PageResult.Result.Select(p => employeeDTOWithActionsMapper.MapToModel(p)).ToList();
            return(res);
        }
Esempio n. 9
0
        public PageResultDTO <AbstractUnitIndexDTOWithActions> GetAllUnitIndexCategoriesWithPagination(int pageSize, int pageIndex, QueryStringConditions queryStringConditions)
        {
            var fs     = new ListFetchStrategy <UnitIndexCategory>(Enums.FetchInUnitOfWorkOption.NoTracking);
            var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy);

            foreach (var item in sortBy)
            {
                fs.SortCriterias.Add(new StringSortCriteria <UnitIndexCategory>(item.Key,
                                                                                (item.Value.ToUpper() == "ASC")
                                                                                 ? Enums.SortOrder.Ascending
                                                                               : Enums.SortOrder.Descending));
            }
            fs.OrderBy(x => x.Id);
            fs.WithPaging(pageSize, pageIndex);
            unitIndexRep.GetAllUnitIndexCategory(fs);
            var res = new PageResultDTO <AbstractUnitIndexDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result = fs.PageCriteria.PageResult.Result.Select(r => unitIndexWithActionsMapper.MapToModel(r));
            return(res);
        }
Esempio n. 10
0
        public PageResultDTO <ClaimDTOWithAction> GetClaimsWithActions(long periodId, string employeeNo, int pageSize, int pageIndex, QueryStringConditions queryStringConditions)
        {
            var fs     = new ListFetchStrategy <Claim>(Enums.FetchInUnitOfWorkOption.NoTracking);
            var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy);

            foreach (var item in sortBy)
            {
                fs.SortCriterias.Add(new StringSortCriteria <Claim>(item.Key,
                                                                    (item.Value.ToUpper() == "ASC")
                                                                                 ? Enums.SortOrder.Ascending
                                                                               : Enums.SortOrder.Descending));
            }
            fs.OrderBy(x => x.Id);
            fs.WithPaging(pageSize, pageIndex);
            claimRep.FindBy(fs, employeeNo, new PeriodId(periodId));
            var res = new PageResultDTO <ClaimDTOWithAction>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result = fs.PageCriteria.PageResult.Result.Select(r => claimDTOWithActionsMapper.MapToModel(r)).ToList();
            return(res);
        }
Esempio n. 11
0
        public PageResultDTO <JobInPeriodDTOWithActions> GetAllJobs(long periodId, int pageSize, int pageIndex, QueryStringConditions queryStringConditions, string selectedColumns)
        {
            var fs     = new ListFetchStrategy <Job>(Enums.FetchInUnitOfWorkOption.NoTracking);
            var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy);

            foreach (var item in sortBy)
            {
                fs.SortCriterias.Add(new StringSortCriteria <Job>(item.Key,
                                                                  (item.Value.ToUpper() == "ASC")
                                                                                 ? Enums.SortOrder.Ascending
                                                                               : Enums.SortOrder.Descending));
            }
            fs.OrderBy(x => x.Id);
            fs.WithPaging(pageSize, pageIndex);
            jobRep.Find(e => e.Id.PeriodId == new PeriodId(periodId), fs);
            var res = new PageResultDTO <JobInPeriodDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result = fs.PageCriteria.PageResult.Result.Select(r => jobInPeriodDTOWithActionsMapper.MapToModel(r, selectedColumns.Split(','))).ToList();
            return(res);
        }
Esempio n. 12
0
        public PageResultDTO <EmployeeDTOWithActions> GetSubordinateEmployees(long periodId, string verifierEmployeeNo, int pageSize, int pageIndex,
                                                                              string filter)
        {
            var fs = new ListFetchStrategy <Employee>(Enums.FetchInUnitOfWorkOption.NoTracking);

            fs.WithPaging(pageSize, pageIndex);
            fs.OrderBy(e => e.LastName);
            //todo:(LOW) Must be code in better way
            var criterias = filter.Split(';');
            var predicate = getEmployeePredicate(criterias, periodId);

            employeeRep.GetSubordinatesEmployee(new EmployeeId(verifierEmployeeNo, new PeriodId(periodId)), predicate, fs);
            var res = new PageResultDTO <EmployeeDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result =
                fs.PageCriteria.PageResult.Result.Select(p =>
            {
                var mapped = new EmployeeDTOWithActions
                {
                    FirstName   = p.FirstName,
                    LastName    = p.LastName,
                    PeriodId    = p.Id.PeriodId.Id,
                    PersonnelNo = p.Id.EmployeeNo,
                    FinalPoint  = p.FinalPoint,
                    SystemPoint = p.CalculatedPoint,
                    StateName   = p.EmployeePointState.Description,
                    ActionCodes = new List <int>
                    {
                        (int)ActionType.ChangeEmployeePoint,
                    }
                };
                return(mapped);
            }).ToList();
            return(res);
        }
Esempio n. 13
0
        public PageResultDTO <CustomFieldDTOWithActions> GetAllCustomFieldes(int pageSize, int pageIndex, QueryStringConditions queryStringConditions)
        {
            var fs     = new ListFetchStrategy <CustomFieldType>(Enums.FetchInUnitOfWorkOption.NoTracking);
            var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy);

            foreach (var item in sortBy)
            {
                fs.SortCriterias.Add(new StringSortCriteria <CustomFieldType>(item.Key,
                                                                              (item.Value.ToUpper() == "ASC")
                                                                                 ? Enums.SortOrder.Ascending
                                                                               : Enums.SortOrder.Descending));
            }
            fs.OrderBy(x => x.Id);
            fs.WithPaging(pageSize, pageIndex);
            var entityId = getEntityIdFromQueryString(queryStringConditions.Filter);

            customFieldRep.GetAll(
                entityId != null ? Enumeration.FromValue <EntityTypeEnum>(entityId.ToString()) : null, fs);
            var res = new PageResultDTO <CustomFieldDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result = fs.PageCriteria.PageResult.Result.Select(r => customFieldWithActionMapper.MapToModel(r)).ToList();
            return(res);
        }