Пример #1
0
        /// <summary>
        /// Updates the appraisal action information.
        /// </summary>
        /// <param name="appraisalActionInfo">The appraisal action information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// appraisalActionInfo
        /// or
        /// appraisalActionData
        /// </exception>
        public string UpdateAppraisalActionInfo(IAppraisalActionView appraisalActionInfo)
        {
            if (appraisalActionInfo == null)
            {
                throw new ArgumentNullException(nameof(appraisalActionInfo));
            }

            var result = string.Empty;


            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    var appraisalActionData =
                        dbContext.AppraisalActions.SingleOrDefault(m => m.AppraisalActionId.Equals(appraisalActionInfo.AppraisalActionId));
                    if (appraisalActionData == null)
                    {
                        throw new ArgumentNullException(nameof(appraisalActionData));
                    }

                    appraisalActionData.AppraisalActionName = appraisalActionInfo.AppraisalActionName;

                    dbContext.SaveChanges();
                }
            }
            catch (Exception e)
            {
                result = string.Format("Update Appraisal Action Information - {0} , {1}", e.Message,
                                       e.InnerException != null ? e.InnerException.Message : "");
            }

            return(result);
        }
Пример #2
0
        /// <summary>
        /// Saves the appraisal action information.
        /// </summary>
        /// <param name="appraisalActionInfo">The appraisal action information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">appraisalActionInfo</exception>
        public string SaveAppraisalActionInfo(IAppraisalActionView appraisalActionInfo)
        {
            if (appraisalActionInfo == null)
            {
                throw new ArgumentNullException(nameof(appraisalActionInfo));
            }

            var result = string.Empty;

            var newRecord = new AppraisalAction
            {
                AppraisalActionName = appraisalActionInfo.AppraisalActionName
            };


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

            return(result);
        }
Пример #3
0
        public IAppraisalActionView CreateUpdatedAppraisalActionView(IAppraisalActionView appraisalActionInfo, string processingMessage)
        {
            if (appraisalActionInfo == null)
            {
                throw new ArgumentNullException(nameof(appraisalActionInfo));
            }

            appraisalActionInfo.ProcessingMessage = processingMessage;

            return(appraisalActionInfo);
        }
Пример #4
0
        /// <summary>
        /// Creates the appraisal action update view.
        /// </summary>
        /// <param name="appraisalActionInfo">The appraisal action information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">appraisalActionInfo</exception>
        public IAppraisalActionView CreateAppraisalActionUpdateView(IAppraisalActionView appraisalActionInfo)
        {
            if (appraisalActionInfo == null)
            {
                throw new ArgumentNullException(nameof(appraisalActionInfo));
            }

            var appraisalActionView = new AppraisalActionView
            {
                AppraisalActionId   = appraisalActionInfo.AppraisalActionId,
                AppraisalActionName = appraisalActionInfo.AppraisalActionName,
            };

            return(appraisalActionView);
        }