Exemplo n.º 1
0
        public async Task <Tuple <int, List <SubProjectEmployeeDTO> > > LoadEmployeeCoveringAsyncCount(
            int skip = -1,
            int take = -1,
            SubProjectSearchViewModel model = null)
        {
            var query = Entities.Include(x => x.Project)
                        // درصورتی که هنوز چیزی برای منگنه وجود داشته باشد
                        .Where(x => x.NumOfCovering < x.Number || x.Status == SubProjectRoutineStatusSSOT.CoveringProgress)
                        .ProjectTo <SubProjectEmployeeDTO>();



            if (!string.IsNullOrEmpty(model.Title))
            {
                query = query.Where(x => x.Title.Contains(model.Title));
            }

            int Count = query.Count();

            query = query.OrderByDescending(x => x.Id);


            if (skip != -1)
            {
                query = query.Skip((skip - 1) * take);
            }

            if (take != -1)
            {
                query = query.Take(take);
            }

            return(new Tuple <int, List <SubProjectEmployeeDTO> >(Count, await query.ToListAsync()));
        }
Exemplo n.º 2
0
        public async Task <Tuple <int, List <SubProjectCDTO> > > LoadCustomerAsyncCount(
            int projectId,
            int skip = -1,
            int take = -1,
            SubProjectSearchViewModel model = null)
        {
            var query = Entities.ProjectTo <SubProjectCDTO>();

            query = query.Where(x => x.ProjectId == projectId);

            if (!string.IsNullOrEmpty(model.Title))
            {
                query = query.Where(x => x.Title.Contains(model.Title));
            }

            int Count = query.Count();

            query = query.OrderByDescending(x => x.Id);


            if (skip != -1)
            {
                query = query.Skip((skip - 1) * take);
            }

            if (take != -1)
            {
                query = query.Take(take);
            }

            return(new Tuple <int, List <SubProjectCDTO> >(Count, await query.ToListAsync()));
        }
        public async Task <IActionResult> Index(SubProjectSearchViewModel searchModel)
        {
            var model = await _subProjectRepository.LoadEmployeeCoveringAsyncCount(
                this.CurrentPage,
                this.PageSize,
                searchModel);

            this.TotalNumber = model.Item1;

            ViewBag.SearchModel = searchModel;

            return(View(model.Item2));
        }
        public async Task <IActionResult> Index(int id, SubProjectSearchViewModel searchModel)
        {
            //ViewBag.Organizations = await _userOrganizationRepository.GetOrganizationFullByUserId(this.UserId);

            var model = await _subProjectRepository.LoadCustomerAsyncCount(
                id,
                this.CurrentPage,
                this.PageSize,
                searchModel);

            this.TotalNumber = model.Item1;

            ViewBag.SearchModel = searchModel;
            // شماره پروژه مورد نظر
            ViewBag.ProjectId = id;
            // وضعیت پروژه مورد نظر
            ViewBag.ProjectStatus = await _projectRepository.GetStatus(id);

            return(View(model.Item2));
        }
Exemplo n.º 5
0
        public async Task <Tuple <int, List <SubProjectADTO> > > LoadAdminAsyncCount(
            int projectId,
            int userId,
            int skip = -1,
            int take = -1,
            SubProjectSearchViewModel model = null)
        {
            var query = (from subProject in DbContext.SubProject
                         where subProject.ProjectId == projectId

                         join bill in DbContext.Bill on subProject.Id equals bill.SubProjectId into temp
                         from leftBill in temp.DefaultIfEmpty()


                         select new SubProjectADTO
            {
                Id = subProject.Id,
                ProjectId = projectId,
                Title = subProject.Title,
                UserId = userId,
                SubProjectType = subProject.SubProjectType,
                OrganizationId = subProject.OrganizationId,
                NumberOfPage = subProject.BookPageNumber,


                //price info
                HasBill = leftBill != null ? true : false,
                PriceEachPage = leftBill.PriceEachPage ?? 0,
                SumPriceEachPage = leftBill.SumPriceEachPage ?? 0,
                PriceEachCover = leftBill.PriceEachCover ?? 0,
                SumPriceEachCover = leftBill.SumPriceEachCover ?? 0,
                PriceDelivery = leftBill.PriceDelivery ?? 0,
                SumPrice = leftBill.SumPrice != null ? leftBill.SumPrice.Value : 0
            });



            if (!string.IsNullOrEmpty(model.Title))
            {
                query = query.Where(x => x.Title.Contains(model.Title));
            }



            int Count = query.Count();

            query = query.OrderByDescending(x => x.Id);


            if (skip != -1)
            {
                query = query.Skip((skip - 1) * take);
            }

            if (take != -1)
            {
                query = query.Take(take);
            }

            return(new Tuple <int, List <SubProjectADTO> >(Count, await query.ToListAsync()));
        }