Ejemplo n.º 1
0
        /// <summary>
        /// Processes the skill set create view.
        /// </summary>
        /// <param name="skillSetInfo">The skill set information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">skillSetInfo</exception>
        public string  ProcessSkillSetCreateView(ISkillSetModelView skillSetInfo)
        {
            if (skillSetInfo == null)
            {
                throw new ArgumentNullException(nameof(skillSetInfo));
            }

            var processingMessage = string.Empty;

            if (skillSetInfo.EmployeeId == 0)
            {
                var user = this.usersRepository.GetUserById((int)this.session.GetSessionValue(SessionKey.UserId));

                var employee = this.employeeOnBoardRepository.GetEmployeeByEmail(user.Email);

                if (employee != null)
                {
                    skillSetInfo.EmployeeId = employee.EmployeeId;
                }
                else
                {
                    skillSetInfo.EmployeeId = user.UserId;
                }
            }

            //Store Skill Set Repository
            processingMessage = this.skillSetRepository.SaveSkillSetInfo(skillSetInfo);


            return(processingMessage);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the skill set information.
        /// </summary>
        /// <param name="skillSetInfo">The skill set information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">skillSetInfo</exception>
        public string UpdateSkillSetInfo(ISkillSetModelView skillSetInfo)
        {
            if (skillSetInfo == null)
            {
                throw new ArgumentNullException(nameof(skillSetInfo));
            }

            var result = string.Empty;


            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var data = dbContext.SkillSets.Find(skillSetInfo.SkillId);

                    data.SkillName        = skillSetInfo.SkillName;
                    data.SkillDescription = skillSetInfo.SkillDescription;
                    data.ExperienceId     = skillSetInfo.Experience;
                    dbContext.SaveChanges();
                }
            }
            catch (Exception e)
            {
                result = string.Format("SaveSkillSetInfo - {0} , {1}", e.Message,
                                       e.InnerException != null ? e.InnerException.InnerException.Message : "");
            }

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates the updated skill set view.
        /// </summary>
        /// <param name="skillSetInfo">The skill set information.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">skillSetInfo</exception>
        public ISkillSetModelView CreateUpdatedSkillSetView(ISkillSetModelView skillSetInfo, string processingMessage)
        {
            if (skillSetInfo == null)
            {
                throw new ArgumentNullException(nameof(skillSetInfo));
            }

            skillSetInfo.ProcessingMessage = processingMessage;

            return(skillSetInfo);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the skill set create view.
        /// </summary>
        /// <param name="skillSetInfo">The skill set information.</param>
        /// <param name="processingMessage">The processing message.</param>
        /// <returns></returns>
        public ISkillSetModelView GetSkillSetCreateView(ISkillSetModelView skillSetInfo, string processingMessage)
        {
            if (skillSetInfo == null)
            {
                throw new ArgumentNullException(nameof(skillSetInfo));
            }
            var returnViewModel = skillSetViewModelFactory.CreateUpdatedSkillSetView(skillSetInfo, processingMessage);


            return(returnViewModel);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Processes the skill set edit view.
        /// </summary>
        /// <param name="skillSetInfo">The skill set information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">skillSetInfo</exception>
        public string ProcessSkillSetEditView(ISkillSetModelView skillSetInfo)
        {
            if (skillSetInfo == null)
            {
                throw new ArgumentNullException(nameof(skillSetInfo));
            }

            var processingMessage = string.Empty;



            processingMessage = this.skillSetRepository.UpdateSkillSetInfo(skillSetInfo);

            return(processingMessage);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Saves the skill set information.
        /// </summary>
        /// <param name="skillSetInfo">The skill set information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">skillSetInfo</exception>
        public string SaveSkillSetInfo(ISkillSetModelView skillSetInfo)
        {
            if (skillSetInfo == null)
            {
                throw new ArgumentNullException(nameof(skillSetInfo));
            }

            var result = string.Empty;

            var newRecord = new SkillSet
            {
                SkillName        = skillSetInfo.SkillName,
                SkillDescription = skillSetInfo.SkillDescription,
                EmployeeId       = skillSetInfo.EmployeeId,
                ExperienceId     = skillSetInfo.Experience,
                IsActive         = true,
                DateCreated      = DateTime.UtcNow
            };

            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    dbContext.SkillSets.Add(newRecord);
                    dbContext.SaveChanges();
                }
            }
            catch (Exception e)
            {
                result = string.Format("SaveSkillSetInfo - {0} , {1}", e.Message,
                                       e.InnerException != null ? e.InnerException.InnerException.Message : "");
            }

            return(result);
        }