public StopWorksBLL GetByStopWorkID(int StopWorkID) { StopWorksBLL StopWorkBLL = null; StopWorks StopWork = new StopWorksDAL().GetByStopWorkID(StopWorkID); if (StopWork != null) { StopWorkBLL = new StopWorksBLL().MapStopWork(StopWork); } return(StopWorkBLL); }
public List <StopWorksBLL> GetStopWorks() { List <StopWorksBLL> StopWorkBLLList = new List <StopWorksBLL>(); List <StopWorks> StopWorks = new StopWorksDAL().GetStopWorks(); foreach (var item in StopWorks) { StopWorkBLLList.Add(new StopWorksBLL().MapStopWork(item)); } return(StopWorkBLLList); }
private Result IsThereStopWorkNotEnding(int EmployeeCodeID, int StopWorkID = 0) { Result result = null; List <StopWorks> StopWorks = new StopWorksDAL().GetStopWorksByEmployeeCodeID(EmployeeCodeID).Where(c => c.IsConvicted == null && c.StopWorkID != StopWorkID).ToList(); if (StopWorks.Count != 0) { return(result = new Result() { Entity = MapStopWork(StopWorks.FirstOrDefault()), EnumType = typeof(StopWorkValidationEnum), EnumMember = StopWorkValidationEnum.RejectedBecauseOfThereIsAnotherStopWorkNotEnding.ToString() }); } return(result); }
public bool IsStopWorkExistsByEmployeeCodeID(int EmployeeCareerHistoryID, DateTime Date) { List <StopWorks> StopWorkList = new StopWorksDAL().GetStopWorksByEmployeeCareerHistoryID(EmployeeCareerHistoryID, Date); return(StopWorkList.Count > 0 ? true : false); }
public Result EndStopWork() { Result result = null; #region Check EndDate Should be more than startDate if (this.StopWorkEndDate < this.StopWorkStartDate) { result = new Result(); result.Entity = this; result.EnumMember = StopWorkValidationEnum.RejectedBecauseOfEndDateShouldBeMoreThanStartDate.ToString(); result.EnumType = typeof(StopWorkValidationEnum); return(result); } #endregion #region Check is there another stopwork not ended StopWorks StopWork = new StopWorksDAL().GetByStopWorkID(this.StopWorkID); if (StopWork.EmployeesCareersHistory.EmployeeCareerHistoryID == this.EmployeeCareerHistory.EmployeeCareerHistoryID) { result = IsThereStopWorkNotEnding(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID, this.StopWorkID); if (result != null) { if (this.IsConvicted == null)// && ((StopWorksBLL)result.Entity).IsConvicted != this.IsConvicted) { return(result); } } } else { result = IsThereStopWorkNotEnding(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID); if (result != null) { return(result); } } #endregion StopWorks stopWork = new StopWorks() { StopWorkID = this.StopWorkID, EmployeeCareerHistoryID = this.EmployeeCareerHistory.EmployeeCareerHistoryID, StopWorkEndDate = this.StopWorkEndDate, StopWorkStartDate = this.StopWorkStartDate, StartStopWorkDecisionNumber = this.StartStopWorkDecisionNumber, StartStopWorkDecisionDate = this.StartStopWorkDecisionDate, EndStopWorkDecisionDate = this.EndStopWorkDecisionDate, EndStopWorkDecisionNumber = this.EndStopWorkDecisionNumber, StopPoint = this.StopPoint, IsConvicted = this.IsConvicted, StopWorkTypeID = this.StopWorkType.StopWorkTypeID, Note = this.Note, LastUpdatedDate = DateTime.Now, LastUpdatedBy = this.LoginIdentity.EmployeeCodeID }; new StopWorksDAL().EndStopWork(stopWork); this.EmployeeCareerHistory = new EmployeesCareersHistoryBLL().GetByEmployeeCareerHistoryID(this.EmployeeCareerHistory.EmployeeCareerHistoryID); new BaseAssigningsBLL() { LoginIdentity = this.LoginIdentity }.BreakLastAssigning(this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID, this.StopWorkEndDate.HasValue ? this.StopWorkEndDate.Value : DateTime.Now, AssigningsReasonsEnum.StopWorkFinished); result = new Result() { Entity = this, EnumType = typeof(StopWorkValidationEnum), EnumMember = StopWorkValidationEnum.Done.ToString() }; return(result); }