public async Task <PartialViewResult> CreateOrEditQualificationModal(int?id, int employeeId)
        {
            var output = new EducationDto();

            if (id != null)
            {
                output = _employeeService.GetEducation(new GetEducationInput {
                    EducationId = id.Value
                });
            }
            var viewModel = new CreateOrEditQualificationModel(output, id == null || id == 0);

            ViewBag.EmployeeId = employeeId;

            var yearList = new List <int>();

            for (var y = Clock.Now.Year; y >= 1900; y--)
            {
                yearList.Add(y);
            }

            ViewBag.Years             = new SelectList(yearList, output.Year);
            ViewBag.EducationalLevels = new SelectList(_qualificationService.GetEducationLevels().Items, "Id", "Name",
                                                       output.LevelId);

            return(PartialView("EmployeeDetail/Qualification/_CreateOrEditQualificationModal", viewModel));
        }
Esempio n. 2
0
        public async Task <List <EducationDto> > GetEducationInfo(long userId)
        {
            if ((AbpSession.UserId.Value != userId) && !await UserManager.IsGrantedAsync(AbpSession.UserId.Value, PermissionNames.Pages_View_CVEmployee))
            {
                throw new UserFriendlyException(ErrorCodes.Forbidden.AccessOtherProfile);
            }
            var lstEdu = new List <EducationDto>();

            foreach (var edu in WorkScope.GetAll <Educations>().Where(e => e.CvemployeeId.Value == userId && e.IsDeleted == false).OrderBy(e => e.Order))
            {
                var temp = new EducationDto
                {
                    Id = edu.Id,
                    SchoolOrCenterName = edu.SchoolOrCenterName,
                    CvemployeeId       = userId,
                    DegreeType         = edu.DegreeType,
                    StartYear          = edu.StartYear,
                    EndYear            = edu.EndYear,
                    Description        = edu.Description,
                    Major = edu.Major,
                    Order = edu.Order,
                };
                lstEdu.Add(temp);
            }
            return(lstEdu);
        }
Esempio n. 3
0
 public static EducationSetDetailViewModel ToDetailViewModel(this EducationDto source)
 {
     return(new EducationSetDetailViewModel
     {
         Id = source.Id,
         Description = source.Description,
     });
 }
        public async Task <IActionResult> AddEducation(EducationDto educationDto)
        {
            var education = _mapper.Map <Education>(educationDto);

            education.UserId = UserId;
            _context.Educations.Add(education);
            await _context.SaveChangesAsync();

            return(NoContent());
        }
Esempio n. 5
0
        public IActionResult OnGet(int educationId)
        {
            Education = repository.GetEducationById(educationId);

            if (Education == null)
            {
                RedirectToPage("./NotFound");
            }

            return(Page());
        }
Esempio n. 6
0
        public async Task <EducationDto> SaveEducation(EducationDto input)
        {
            if ((!WorkScope.GetAll <User, long>().Any(u => u.Id == input.CvemployeeId) || (!input.CvemployeeId.HasValue)))
            {
                throw new UserFriendlyException(ErrorCodes.NotFound.UserNotExist);
            }
            if (AbpSession.UserId.Value != input.CvemployeeId)
            {
                throw new UserFriendlyException(ErrorCodes.Forbidden.AccessOtherProfile);
            }
            int startYear, endYear;

            if (!(int.TryParse(input.StartYear, out startYear) && int.TryParse(input.EndYear, out endYear)))
            {
                throw new UserFriendlyException(ErrorCodes.NotAcceptable.YearIsNotValid);
            }
            if (startYear > endYear)
            {
                throw new UserFriendlyException(ErrorCodes.NotAcceptable.YearOutOfRange);
            }
            if (input.Id <= 0)
            {
                var education = new Educations
                {
                    CvemployeeId       = input.CvemployeeId,
                    SchoolOrCenterName = input.SchoolOrCenterName,
                    DegreeType         = input.DegreeType,
                    Major       = input.Major,
                    StartYear   = input.StartYear,
                    EndYear     = input.EndYear,
                    Description = input.Description,
                    Order       = input.Order
                };
                await WorkScope.GetRepo <Educations, long>().InsertAsync(education);

                return(input);
            }
            else
            {
                var education = await WorkScope.GetAsync <Educations>(input.Id);

                education.CvemployeeId       = input.CvemployeeId;
                education.SchoolOrCenterName = input.SchoolOrCenterName;
                education.DegreeType         = input.DegreeType;
                education.Major       = input.Major;
                education.StartYear   = input.StartYear;
                education.EndYear     = input.EndYear;
                education.Description = input.Description;
                education.Order       = input.Order;
                await WorkScope.GetRepo <Educations, long>().UpdateAsync(education);

                return(input);
            }
        }
Esempio n. 7
0
 public static EducationViewModel ToViewModel(this EducationDto source)
 {
     return(new EducationViewModel
     {
         Id = source.Id,
         Image = source.Image,
         Title = source.Title,
         Description = source.Description,
         Files = source.Files?.ToViewModel()
     });
 }
Esempio n. 8
0
 public Boolean deleteEducation(EducationDto obj)
 {
     try
     {
         IEducationSvc svc = (IEducationSvc)this.getService(typeof(IEducationSvc).Name);
         return svc.deleteEducation(obj);
     }
     catch (ServiceLoadException ex)
     {
         return false;
     }
 }
Esempio n. 9
0
 public EducationDto selectEducationById(EducationDto obj)
 {
     try
     {
         IEducationSvc svc = (IEducationSvc)this.getService(typeof(IEducationSvc).Name);
         return svc.selectEducationById(obj);
     }
     catch (ServiceLoadException ex)
     {
         return null;
     }
 }
Esempio n. 10
0
        public EducationDto selectEducationById(EducationDto obj)
        {
            NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient();

            try
            {
                return svc.selectEducationById(obj);
            }
            catch (Exception ex)
            {
                return null;
            }
        }
Esempio n. 11
0
 public Boolean insertEducation(EducationDto obj)
 {
     using (NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient())
     {
         try
         {
             return svc.insertEducation(obj);
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
Esempio n. 12
0
        public EducationDto UpdateEducation(EducationDto educationDto)
        {
            if (educationDto.Id <= 0)
            {
                return(null);
            }

            var education = educationDto.ToEntity();
            var updated   = _educationDao.Update(education);

            _educationDao.Commit();

            return(updated.ToDto());
        }
Esempio n. 13
0
        public IHttpActionResult CreateEducation(EducationDto educationDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var education = Mapper.Map <EducationDto, Education>(educationDto);

            _context.Educations.Add(education);
            _context.SaveChanges();

            educationDto.Id = education.Id;

            return(Created(new Uri(Request.RequestUri + "/" + education.Id), educationDto));
        }
Esempio n. 14
0
        public IActionResult OnGet(int?educationId)
        {
            if (educationId.HasValue)
            {
                Education = repository.GetEducationById(educationId.Value);
            }
            else
            {
                Education = new EducationDto();
            }

            if (Education == null)
            {
                return(RedirectToPage("/index"));
            }

            return(Page());
        }
Esempio n. 15
0
        /// <summary>
        /// Update a Education content.
        /// </summary>
        /// <param name="body">The data of the content to be created or updated.



        /// <param name="id">The id of the Education content.</param>
        /// <returns>EducationContentDto</returns>
        public EducationContentDto UpdateEducationContent(EducationDto body, string id)
        {
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling UpdateEducationContent");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling UpdateEducationContent");
            }

            var path = "/content/mycv/education/{id}";

            path = path.Replace("{format}", "json");
            path = path.Replace("{" + "id" + "}", ApiClient.ParameterToString(id));

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            postBody = ApiClient.Serialize(body);                                     // http body (model) parameter

            // authentication setting, if any
            String[] authSettings = new String[] { "squidex-oauth-auth" };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UpdateEducationContent: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling UpdateEducationContent: " + response.ErrorMessage, response.ErrorMessage);
            }

            return((EducationContentDto)ApiClient.Deserialize(response.Content, typeof(EducationContentDto), response.Headers));
        }
Esempio n. 16
0
        public IHttpActionResult UpdateEducation(int id, EducationDto educationDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var educationInDb = _context.Educations.SingleOrDefault(e => e.Id == id);

            if (educationInDb == null)
            {
                return(NotFound());
            }

            Mapper.Map(educationDto, educationInDb);

            _context.SaveChanges();

            return(Ok());
        }
Esempio n. 17
0
        public string CreateEducation(EducationDto educationDto)
        {
            string returnMessage;

            var education = educationDto.ToEntity();

            if (education.Id > 0)
            {
                _educationDao.Update(education);
                returnMessage = "Education updated";
            }
            else
            {
                _educationDao.Create(education);
                returnMessage = "Education created";
            }

            _educationDao.Commit();

            return(returnMessage);
        }
Esempio n. 18
0
        public Boolean deleteEducation(EducationDto obj)
        {
            using (NewRecruiteeService.ServiceWCFClient svc = new NewRecruiteeService.ServiceWCFClient())
            {
                try
                {
                    EducationDto rec = svc.selectEducationById(obj);

                    if (rec != null)
                    {
                        return svc.deleteEducation(obj);
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Esempio n. 19
0
 public void OnGet(int educationId)
 {
     Education = repository.GetEducationById(educationId);
 }
 public IHttpActionResult NewEducation(EducationDto educationDto)
 {
     return(Ok());
 }
 public Task <EducationDto> Post(EducationDto education)
 {
     throw new NotImplementedException();
 }
Esempio n. 22
0
 public ActionResult <EducationDto> Post(EducationDto education)
 {
     repository.CreateEducation(education);
     return(CreatedAtAction("GetEducation", education));
 }
Esempio n. 23
0
 public IActionResult Patch(EducationDto education)
 {
     repository.UpdateEducation(education);
     return(Ok("Education updated"));
 }
 public CreateOrEditQualificationModel(EducationDto input, bool isNew)
 {
     IsEditMode = !isNew;
     Education  = input;
 }