예제 #1
0
        public FieldPlanViewModel GetFieldPlanViewModel(int marketingYearId)
        {
            FieldPlanDto fieldPlanDto = _fieldPlanDao.GetByMarketingYear(marketingYearId);

            FiledPlanModel filedPlanModel = null;

            if (fieldPlanDto != null)
            {
                filedPlanModel = new FiledPlanModel
                {
                    Hectare = fieldPlanDto.Hectare
                };
            }

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var fieldPlanViewModel = new FieldPlanViewModel
            {
                FiledPlanModel        = filedPlanModel,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(fieldPlanViewModel);
        }
예제 #2
0
        public PastureBaseViewModel GetPastureViewModel(int marketingYearId)
        {
            IList <PastureDto> pastureDtos = _pastureDao.GetByMarketingYear(marketingYearId);

            List <PastureViewModel> pastureViewModels = pastureDtos.Select(x => new PastureViewModel
            {
                Id          = x.Id,
                Section     = x.Section,
                District    = x.District,
                Forestry    = x.Forestry,
                Description = x.Description,
                CreatedDate = x.CreatedDate,
                RemovedDate = x.RemovedDate
            }).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var pastureBaseViewModel = new PastureBaseViewModel
            {
                PastureViewModels     = pastureViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(pastureBaseViewModel);
        }
예제 #3
0
        public CostPlanBaseViewModel GetCostPlanViewModel(int marketingYearId)
        {
            IList <CostPlanDto> costPlanDtos = _costPlanDao.GetByMarketingYear(marketingYearId);

            List <CostPlanViewModel> costPlanViewModels =
                (
                    from costPlan in costPlanDtos
                    where costPlan.MarketingYearId == marketingYearId
                    select new CostPlanViewModel
            {
                Id = costPlan.Id,
                Type = costPlan.Type,
                TypeName = GetCostTypeName(costPlan.Type),
                Cost = costPlan.Cost
            }
                ).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var costPlanViewBaseModel = new CostPlanBaseViewModel
            {
                CostPlanViewModels    = costPlanViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(costPlanViewBaseModel);
        }
예제 #4
0
파일: LaborService.cs 프로젝트: Mrotas/Hoof
        public LaborBaseViewModel GetLaborViewModel(int marketingYearId)
        {
            IList <LaborDto>    laborDtos    = _laborDao.GetByMarketingYear(marketingYearId);
            IList <HuntsmanDto> huntsmanDtos = _huntsmanDao.GetAll();

            List <LaborViewModel> laborViewModels =
                (
                    from labor in laborDtos
                    join huntsman in huntsmanDtos on labor.HuntsmanId equals huntsman.Id
                    select new LaborViewModel
            {
                Id = labor.Id,
                HuntsmanId = huntsman.Id,
                HuntsmanName = $"{huntsman.Name} {huntsman.LastName}",
                Description = labor.Description,
                Date = labor.Date
            }
                ).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var laborBaseViewModel = new LaborBaseViewModel
            {
                LaborViewModels       = laborViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(laborBaseViewModel);
        }
예제 #5
0
        public HuntEquipmentPlanBaseViewModel GetHuntEquipmentPlanViewModel(int marketingYearId)
        {
            IList <HuntEquipmentPlanDto> huntEquipmentPlanDtos = _huntEquipmentPlanDao.GetByMarketingYear(marketingYearId);

            List <HuntEquipmentPlanViewModel> huntEquipmentPlanViewModels =
                (
                    from huntEquipmentPlan in huntEquipmentPlanDtos
                    where huntEquipmentPlan.MarketingYearId == marketingYearId
                    select new HuntEquipmentPlanViewModel
            {
                Id = huntEquipmentPlan.Id,
                Type = huntEquipmentPlan.Type,
                TypeName = GetHuntEquipmentTypeName(huntEquipmentPlan.Type),
                Count = huntEquipmentPlan.Count
            }
                ).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var huntEquipmentPlanBaseViewModel = new HuntEquipmentPlanBaseViewModel
            {
                HuntEquipmentPlanViewModels = huntEquipmentPlanViewModels,
                MarketingYearModel          = marketingYearModel,
                AnnualPlanStatusModel       = annualPlanStatusModel
            };

            return(huntEquipmentPlanBaseViewModel);
        }
예제 #6
0
        public WateringPlaceBaseViewModel GetWateringPlaceViewModel(int marketingYearId)
        {
            IList <WateringPlaceDto> wateringPlaceDtos = _wateringPlaceDao.GetByMarketingYear(marketingYearId);

            List <WateringPlaceViewModel> wateringPlaceViewModels = wateringPlaceDtos.Select(x => new WateringPlaceViewModel
            {
                Id          = x.Id,
                Section     = x.Section,
                District    = x.District,
                Forestry    = x.Forestry,
                Description = x.Description,
                CreatedDate = x.CreatedDate,
                RemovedDate = x.RemovedDate
            }).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var wateringPlaceBaseViewModel = new WateringPlaceBaseViewModel
            {
                WateringPlaceViewModels = wateringPlaceViewModels,
                MarketingYearModel      = marketingYearModel,
                AnnualPlanStatusModel   = annualPlanStatusModel
            };

            return(wateringPlaceBaseViewModel);
        }
예제 #7
0
        public ExpenseBaseViewModel GetExpenseBaseViewModel(int marketingYearId)
        {
            IList <ExpenseDto> expenseDtos = _expenseDao.GetByMarketingYear(marketingYearId);

            List <ExpenseViewModel> expenseViewModels = expenseDtos.Select(x => new ExpenseViewModel
            {
                Id          = x.Id,
                Cost        = x.Cost,
                Description = x.Description,
                Note        = x.Note,
                Date        = x.Date
            }).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var expenseBaseViewModel = new ExpenseBaseViewModel
            {
                ExpenseViewModels     = expenseViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(expenseBaseViewModel);
        }
예제 #8
0
        public TrunkFoodPlanViewModel GetTrunkFoodPlanViewModel(int marketingYearId)
        {
            TrunkFoodPlanDto   trunkFoodPlanDto   = _trunkFoodPlanDao.GetByMarketingYear(marketingYearId);
            TrunkFoodPlanModel trunkFoodPlanModel = null;

            if (trunkFoodPlanDto != null)
            {
                trunkFoodPlanModel = new TrunkFoodPlanModel
                {
                    Hectare = trunkFoodPlanDto.Hectare
                };
            }

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var trunkFoodPlanViewModel = new TrunkFoodPlanViewModel
            {
                TrunkFoodPlanModel    = trunkFoodPlanModel,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(trunkFoodPlanViewModel);
        }
예제 #9
0
        public EmploymentPlanBaseViewModel GetEmploymentPlanViewModel(int marketingYearId)
        {
            IList <EmploymentPlanDto> employmentPlanDtos = _employmentPlanDao.GetByMarketingYear(marketingYearId);

            List <EmploymentPlanViewModel> employmentPlanViewModels =
                (
                    from employmentPlan in employmentPlanDtos
                    where employmentPlan.MarketingYearId == marketingYearId
                    select new EmploymentPlanViewModel
            {
                Id = employmentPlan.Id,
                EmploymentType = employmentPlan.EmploymentType,
                EmploymentTypeName = GetEmploymentTypeName(employmentPlan.EmploymentType),
                Count = employmentPlan.Count
            }
                ).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var employmentPlanBaseViewModel = new EmploymentPlanBaseViewModel
            {
                EmploymentPlanViewModels = employmentPlanViewModels,
                MarketingYearModel       = marketingYearModel,
                AnnualPlanStatusModel    = annualPlanStatusModel
            };

            return(employmentPlanBaseViewModel);
        }
예제 #10
0
        public PulpitBaseViewModel GetPulpitViewModel(int marketingYearId)
        {
            IList <PulpitDto> pulpitDtos = _pulpitDao.GetByMarketingYear(marketingYearId);

            List <PulpitViewModel> pulpitViewModels = pulpitDtos.Select(x => new PulpitViewModel
            {
                Id          = x.Id,
                Number      = x.Number,
                Section     = x.Section,
                District    = x.District,
                Forestry    = x.Forestry,
                HasRoof     = x.HasRoof,
                Description = x.Description,
                CreatedDate = x.CreatedDate,
                RemovedDate = x.RemovedDate
            }).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var pulpitBaseViewModel = new PulpitBaseViewModel
            {
                PulpitViewModels      = pulpitViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(pulpitBaseViewModel);
        }
예제 #11
0
        public FodderPlanBaseViewModel GetFodderPlanViewModel(int marketingYearId)
        {
            IList <FodderPlanDto> fodderPlanDtos = _fodderPlanDao.GetByMarketingYear(marketingYearId);

            List <FodderPlanViewModel> fodderPlanViewModels =
                (
                    from fodderPlan in fodderPlanDtos
                    where fodderPlan.MarketingYearId == marketingYearId
                    select new FodderPlanViewModel
            {
                Id = fodderPlan.Id,
                Type = fodderPlan.Type,
                TypeName = TypeName.GetFodderTypeName(fodderPlan.Type),
                Ton = fodderPlan.Ton
            }
                ).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var fodderPlanViewBaseModel = new FodderPlanBaseViewModel
            {
                FodderPlanViewModels  = fodderPlanViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(fodderPlanViewBaseModel);
        }
예제 #12
0
        public FodderBaseViewModel GetFodderViewModel(int marketingYearId)
        {
            IList <FodderDto> fodderDtos = _fodderDao.GetByMarketingYear(marketingYearId);

            List <FodderViewModel> fodderViewModels = fodderDtos.Select(x => new FodderViewModel
            {
                Id          = x.Id,
                Type        = x.Type,
                TypeName    = TypeName.GetFodderTypeName(x.Type),
                Kilograms   = x.Kilograms,
                Owner       = x.Owner,
                Description = x.Description,
                Date        = x.Date
            }).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var fodderPlanViewBaseModel = new FodderBaseViewModel
            {
                FodderViewModels      = fodderViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(fodderPlanViewBaseModel);
        }
예제 #13
0
        public DeerLickerBaseViewModel GetDeerLickerViewModel(int marketingYearId)
        {
            IList <DeerLickerDto> deerLickerDtos = _deerLickerDao.GetByMarketingYear(marketingYearId);

            List <DeerLickerViewModel> deerLickerViewModels = deerLickerDtos.Select(x => new DeerLickerViewModel
            {
                Id          = x.Id,
                Count       = x.Count,
                Section     = x.Section,
                District    = x.District,
                Forestry    = x.Forestry,
                Description = x.Description
            }).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(marketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var pastureBaseViewModel = new DeerLickerBaseViewModel
            {
                DeerLickerViewModels  = deerLickerViewModels,
                MarketingYearModel    = marketingYearModel,
                AnnualPlanStatusModel = annualPlanStatusModel
            };

            return(pastureBaseViewModel);
        }
예제 #14
0
        public CarcassRevenueBaseViewModel GetCarcassRevenueViewModel(int marketingYearId)
        {
            MarketingYearModel marketingYearModel = _marketingYearService.GetMarketingYearModel(marketingYearId);

            IList <CarcassRevenueDto> carcassRevenueDtos = _carcassRevenueDao.GetByMarketingYear(marketingYearId);
            IList <HuntDto>           huntDtos           = _huntDao.GetByMarketingYear(marketingYearId);
            IList <HuntedGameDto>     huntedGameDtos     = _huntedGameDao.GetByMarketingYear(marketingYearId);
            IList <GameDto>           gameDtos           = _gameDao.GetAll();
            IList <GameClassDto>      gameClassDtos      = _gameClassDao.GetAll();

            List <CarcassRevenueViewModel> carcassRevenueViewModels =
                (
                    from carcassRevenue in carcassRevenueDtos
                    join huntedGame in huntedGameDtos on carcassRevenue.HuntedGameId equals huntedGame.Id
                    join hunt in huntDtos on huntedGame.Id equals hunt.HuntedGameId
                    join game in gameDtos on huntedGame.GameId equals game.Id
                    where hunt.Date >= marketingYearModel.Start && hunt.Date <= marketingYearModel.End
                    select new CarcassRevenueViewModel
            {
                Id = carcassRevenue.Id,
                HuntedGameId = huntedGame.Id,
                GameKind = game.Kind,
                GameKindName = game.KindName,
                GameSubKind = game.SubKind,
                GameSubKindName = game.SubKindName,
                Class = huntedGame.GameClass,
                ClassName = huntedGame.GameClass.HasValue ? gameClassDtos.Single(x => x.Id == huntedGame.GameClass).ClassName : "",
                Revenue = carcassRevenue.Revenue,
                CarcassWeight = carcassRevenue.CarcassWeight,
                HuntDate = hunt.Date
            }
                ).ToList();

            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var carcassRevenueBaseViewModel = new CarcassRevenueBaseViewModel
            {
                CarcassRevenueViewModels = carcassRevenueViewModels,
                MarketingYearModel       = marketingYearModel,
                AnnualPlanStatusModel    = annualPlanStatusModel
            };

            return(carcassRevenueBaseViewModel);
        }
예제 #15
0
        public AnnualPlanViewModel GetAnnualPlanViewModel(HttpCookie userCookie, int marketingYearId)
        {
            CurrentMarketingYearId  = marketingYearId;
            PreviousMarketingYearId = marketingYearId - 1;

            var annualPlanViewModel = new AnnualPlanViewModel();

            annualPlanViewModel.MarketingYearModel = _marketingYearService.GetMarketingYearModel(CurrentMarketingYearId);

            annualPlanViewModel.AnnualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            annualPlanViewModel.AnnualPlanModel = GetAnnualPlanModel();

            annualPlanViewModel.BigGamePlanModel = _gamePlanService.GetGameAnnualPlanModel(GameType.Big, CurrentMarketingYearId);

            annualPlanViewModel.SmallGamePlanModel = _gamePlanService.GetGameAnnualPlanModel(GameType.Small, CurrentMarketingYearId);

            return(annualPlanViewModel);
        }
예제 #16
0
        public HuntPlanViewModel GetHuntPlanViewModel(int marketingYearId)
        {
            MarketingYearId = marketingYearId;

            List <GameHuntPlanViewModel> gameHuntPlanViewModels =
                (
                    from huntPlan in GameHuntPlans
                    join game in Games on huntPlan.GameId equals game.Id
                    where huntPlan.MarketingYearId == MarketingYearId
                    select new GameHuntPlanViewModel
            {
                Id = huntPlan.Id,
                GameId = game.Id,
                GameType = game.Type,
                GameKind = game.Kind,
                GameKindName = game.KindName,
                GameSubKind = game.SubKind,
                GameSubKindName = game.SubKindName,
                Class = huntPlan.Class,
                ClassName = huntPlan.Class.HasValue ? GameClassXRefs.FirstOrDefault(x => x.Id == huntPlan.Class).ClassName : String.Empty,
                Cull = huntPlan.Cull,
                Catch = huntPlan.Catch
            }
                ).ToList();

            MarketingYearModel    marketingYearModel    = _marketingYearService.GetMarketingYearModel(MarketingYearId);
            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var huntPlanViewModel = new HuntPlanViewModel
            {
                GameHuntPlanViewModels = gameHuntPlanViewModels,
                MarketingYearModel     = marketingYearModel,
                AnnualPlanStatusModel  = annualPlanStatusModel
            };

            return(huntPlanViewModel);
        }