public virtual Result Add() { Result result = new Result(); EndOfServices EndOfService = new EndOfServices(); if (new StopWorksBLL().IsStopWorkExistsByEmployeeCodeID(this.EmployeeCareerHistory.EmployeeCareerHistoryID, this.EndOfServiceDate)) { result = new Result(); result.Entity = this; result.EnumMember = EndOfServicesValidationEnum.RejectedBecauseOfConflictWithStopWorks.ToString(); result.EnumType = typeof(EndOfServicesValidationEnum); return(result); } EndOfService.EndOfServiceDate = this.EndOfServiceDate; EndOfService.EmployeeCareerHistoryID = this.EmployeeCareerHistory.EmployeeCareerHistoryID; EndOfService.EndOfServiceDecisionNo = this.EndOfServiceDecisionNo; EndOfService.EndOfServiceDecisionDate = this.EndOfServiceDecisionDate; EndOfService.EndOfServiceReasonID = this.EndOfServiceReason.EndOfServiceReasonID; EndOfService.CreatedDate = DateTime.Now; EndOfService.CreatedBy = this.LoginIdentity.EmployeeCodeID; this.EndOfServiceID = new EndOfServicesDAL().Insert(EndOfService); if (this.EndOfServiceID != 0) { result.Entity = this; result.EnumType = typeof(EndOfServicesValidationEnum); result.EnumMember = EndOfServicesValidationEnum.Done.ToString(); } return(result); }
public virtual Result Update() { Result result = new Result(); EndOfServices EndOfService = new EndOfServices(); if (this.EndOfServiceID > 0) { this.EmployeeCareerHistory = new EmployeesCareersHistoryBLL() { EmployeeCareerHistoryID = GetByEndOfServiceID(this.EndOfServiceID).EmployeeCareerHistory.EmployeeCareerHistoryID } } ; if (new StopWorksBLL().IsStopWorkExistsByEmployeeCodeID(this.EmployeeCareerHistory.EmployeeCareerHistoryID, this.EndOfServiceDate)) { result = new Result(); result.Entity = this; result.EnumMember = EndOfServicesValidationEnum.RejectedBecauseOfConflictWithStopWorks.ToString(); result.EnumType = typeof(EndOfServicesValidationEnum); return(result); } else if (this.EndOfServiceDate <= DateTime.Now.Date) { result = new Result(); result.Entity = this; result.EnumMember = EndOfServicesValidationEnum.RejectedBecauseOfEndOfServicesDateIsPassedAway.ToString(); result.EnumType = typeof(EndOfServicesValidationEnum); return(result); } EndOfService.EndOfServiceID = this.EndOfServiceID; EndOfService.EndOfServiceDate = this.EndOfServiceDate; EndOfService.EmployeeCareerHistoryID = this.EmployeeCareerHistory.EmployeeCareerHistoryID; EndOfService.EndOfServiceDecisionNo = this.EndOfServiceDecisionNo; EndOfService.EndOfServiceDecisionDate = this.EndOfServiceDecisionDate; EndOfService.EndOfServiceReasonID = this.EndOfServiceReason.EndOfServiceReasonID; EndOfService.LastUpdatedDate = DateTime.Now; EndOfService.LastUpdatedBy = this.LoginIdentity.EmployeeCodeID; this.EndOfServiceID = new EndOfServicesDAL().Update(EndOfService); if (this.EndOfServiceID != 0) { result.Entity = this; result.EnumType = typeof(LookupsValidationEnum); result.EnumMember = LookupsValidationEnum.Done.ToString(); } return(result); }
internal EndOfServicesBLL MapEndOfService(EndOfServices item) { return(item != null ? new EndOfServicesBLL() { EndOfServiceID = item.EndOfServiceID, EndOfServiceDate = item.EndOfServiceDate, EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(item.EmployeesCareersHistory), EndOfServiceDecisionNo = item.EndOfServiceDecisionNo, EndOfServiceDecisionDate = item.EndOfServiceDecisionDate, EndOfServiceReason = new EndOfServicesReasonsBLL().MapEndOfServiceReason(item.EndOfServicesReasons), CreatedDate = item.CreatedDate, CreatedBy = new EmployeesCodesBLL().MapEmployeeCode(item.CreatedByNav) } : null); }