public virtual Result Update() { try { Result result = null; if (this.DirectManagerEvaluation > 50) { result = new Result(); result.Entity = null; result.EnumType = typeof(EmployeesEvaluationsValidationEnum); result.EnumMember = EmployeesEvaluationsValidationEnum.RejectedBecauseOfDirectManagerEvaluationIsNotBetweenZeroAndFifty.ToString(); return(result); } if (this.TimeAttendanceEvaluation > 35) { result = new Result(); result.Entity = null; result.EnumType = typeof(EmployeesEvaluationsValidationEnum); result.EnumMember = EmployeesEvaluationsValidationEnum.RejectedBecauseOfTimeAttendanceEvaluationIsNotBetweenZeroAndThirtyFive.ToString(); return(result); } if (this.ViolationsEvaluation > 15) { result = new Result(); result.Entity = null; result.EnumType = typeof(EmployeesEvaluationsValidationEnum); result.EnumMember = EmployeesEvaluationsValidationEnum.RejectedBecauseOfViolationsEvaluationIsNotBetweenZeroAndFifteen.ToString(); return(result); } EmployeesEvaluationsDetails EmployeeEvaluationDetail = new EmployeesEvaluationsDetails() { EmployeeEvaluationDetailID = this.EmployeeEvaluationDetailID, DirectManagerEvaluation = this.DirectManagerEvaluation, TimeAttendanceEvaluation = this.TimeAttendanceEvaluation, ViolationsEvaluation = this.ViolationsEvaluation, LastUpdatedBy = this.LoginIdentity.EmployeeCodeID, LastUpdatedDate = DateTime.Now }; int RecordID = new EmployeesEvaluationsDetailsDAL().Update(EmployeeEvaluationDetail); result = new Result() { Entity = this, EnumType = typeof(EmployeesEvaluationsValidationEnum), EnumMember = EmployeesEvaluationsValidationEnum.Done.ToString(), }; return(result); } catch { throw; } }
internal EmployeesEvaluationsDetailsBLL MapEmployeeEvaluationDetails(EmployeesEvaluationsDetails EmployeeEvaluationDetail) { try { EmployeesEvaluationsDetailsBLL EmployeeEvaluationDetailBLL = null; if (EmployeeEvaluationDetail != null) { EmployeeEvaluationDetailBLL = new EmployeesEvaluationsDetailsBLL() { EmployeeEvaluationDetailID = EmployeeEvaluationDetail.EmployeeEvaluationDetailID, EvaluationQuarter = new EvaluationsQuartersBLL().MapEvaluationQuarter(EmployeeEvaluationDetail.EvaluationsQuarters), DirectManagerEvaluation = EmployeeEvaluationDetail.DirectManagerEvaluation, TimeAttendanceEvaluation = EmployeeEvaluationDetail.TimeAttendanceEvaluation, ViolationsEvaluation = EmployeeEvaluationDetail.ViolationsEvaluation }; } return(EmployeeEvaluationDetailBLL); } catch { throw; } }
public virtual Result Add() { try { Result result = null; if (this.DirectManagerEvaluation > 50) { result = new Result(); result.Entity = null; result.EnumType = typeof(EmployeesEvaluationsValidationEnum); result.EnumMember = EmployeesEvaluationsValidationEnum.RejectedBecauseOfDirectManagerEvaluationIsNotBetweenZeroAndFifty.ToString(); return(result); } if (this.TimeAttendanceEvaluation > 35) { result = new Result(); result.Entity = null; result.EnumType = typeof(EmployeesEvaluationsValidationEnum); result.EnumMember = EmployeesEvaluationsValidationEnum.RejectedBecauseOfTimeAttendanceEvaluationIsNotBetweenZeroAndThirtyFive.ToString(); return(result); } if (this.ViolationsEvaluation > 15) { result = new Result(); result.Entity = null; result.EnumType = typeof(EmployeesEvaluationsValidationEnum); result.EnumMember = EmployeesEvaluationsValidationEnum.RejectedBecauseOfViolationsEvaluationIsNotBetweenZeroAndFifteen.ToString(); return(result); } EmployeesEvaluationsBLL EmployeesEvaluationBLL = new EmployeesEvaluationsBLL().GetByEmployeeEvaluationID(this.EmployeeEvaluation.EmployeeEvaluationID); List <EmployeesEvaluationsDetailsBLL> EmployeesEvaluationBLLList = new EmployeesEvaluationsBLL().GetByEmployeeEvaluationID(this.EmployeeEvaluation.EmployeeEvaluationID).EmployeeEvaluationDetails; if (EmployeesEvaluationBLLList.Exists(x => x.EvaluationQuarter.EvaluationQuarterID.Equals(this.EvaluationQuarter.EvaluationQuarterID)) && EmployeesEvaluationBLL.MaturityYearsBalances.MaturityYearID.Equals(this.EmployeeEvaluation.MaturityYearsBalances.MaturityYearID)) { result = new Result() { Entity = this, EnumType = typeof(EmployeesEvaluationsValidationEnum), EnumMember = EmployeesEvaluationsValidationEnum.RejectedBecauseOfEvaluationQuarterAlreadyExistsInCurrentYear.ToString(), }; return(result); } EmployeesEvaluationsDetails EmployeeEvaluationDetail = new EmployeesEvaluationsDetails() { EmployeeEvaluationID = this.EmployeeEvaluation.EmployeeEvaluationID, DirectManagerEvaluation = this.DirectManagerEvaluation, TimeAttendanceEvaluation = this.TimeAttendanceEvaluation, ViolationsEvaluation = this.ViolationsEvaluation, EvaluationQuarterID = this.EvaluationQuarter.EvaluationQuarterID, CreatedBy = this.LoginIdentity.EmployeeCodeID, CreatedDate = DateTime.Now, }; int RecordID = new EmployeesEvaluationsDetailsDAL().Insert(EmployeeEvaluationDetail); result = new Result() { Entity = this, EnumType = typeof(EmployeesEvaluationsValidationEnum), EnumMember = EmployeesEvaluationsValidationEnum.Done.ToString(), }; return(result); } catch { throw; } }