Ejemplo n.º 1
0
        public JsonResult Edit(EmploymentPlanViewModel model, int marketingYearId)
        {
            string message = String.Empty;

            try
            {
                _employmentPlanService.UpdateEmploymentPlan(model, marketingYearId);
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(Json(new { message }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public void UpdateEmploymentPlan(EmploymentPlanViewModel model, int marketingYearId)
        {
            if (model.EmploymentType <= 0)
            {
                throw new Exception("Nie można edytować planu gospodarczego zatrudnienia");
            }

            var dto = new EmploymentPlanDto
            {
                EmploymentType  = model.EmploymentType,
                Count           = model.Count,
                MarketingYearId = marketingYearId
            };

            _employmentPlanDao.Update(dto);
        }
Ejemplo n.º 3
0
        public void AddEmploymentPlan(EmploymentPlanViewModel model, int marketingYearId)
        {
            if (model.EmploymentType == 0)
            {
                throw new Exception("Nie można dodać planu gospodarczego zatrudnienia");
            }

            IList <EmploymentPlanDto> existingEquipmentPlanDtos = _employmentPlanDao.GetByMarketingYear(marketingYearId);

            if (existingEquipmentPlanDtos.Any(x => x.EmploymentType == model.EmploymentType))
            {
                throw new Exception($"Plan zatrudnienia {GetEmploymentTypeName(model.EmploymentType)} już istnieje! Proszę użyć opcji edycji istniejącego już planu.");
            }

            var dto = new EmploymentPlanDto
            {
                EmploymentType  = model.EmploymentType,
                Count           = model.Count,
                MarketingYearId = marketingYearId
            };

            _employmentPlanDao.Insert(dto);
        }