/// <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); }
/// <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); }
public IAppraisalActionView CreateUpdatedAppraisalActionView(IAppraisalActionView appraisalActionInfo, string processingMessage) { if (appraisalActionInfo == null) { throw new ArgumentNullException(nameof(appraisalActionInfo)); } appraisalActionInfo.ProcessingMessage = processingMessage; return(appraisalActionInfo); }
/// <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); }