internal StopWorksBLL MapStopWork(StopWorks StopWork) { try { StopWorksBLL StopWorkBLL = null; if (StopWork != null) { StopWorkBLL = new StopWorksBLL() { StopWorkID = StopWork.StopWorkID, StopWorkStartDate = StopWork.StopWorkStartDate.Date, StopWorkEndDate = StopWork.StopWorkEndDate.Value.Date, StartStopWorkDecisionNumber = StopWork.StartStopWorkDecisionNumber, StartStopWorkDecisionDate = StopWork.StartStopWorkDecisionDate, // != null?StopWork.StartStopWorkDecisionDate.Value.Date : Convert.ToDateTime(null), EndStopWorkDecisionNumber = StopWork.EndStopWorkDecisionNumber, EndStopWorkDecisionDate = StopWork.EndStopWorkDecisionDate, //!= null ? StopWork.EndStopWorkDecisionDate.Value.Date : Convert.ToDateTime(null), Note = StopWork.Note, StopPoint = StopWork.StopPoint, EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(StopWork.EmployeesCareersHistory), IsConvicted = StopWork.IsConvicted, StopWorkType = new StopWorksTypesBLL().MapStopWorkType(StopWork.StopWorksTypes), CreatedBy = new EmployeesCodesBLL().MapEmployeeCode(StopWork.CreatedByNav), CreatedDate = StopWork.CreatedDate, LastUpdatedDate = StopWork.LastUpdatedDate, }; } return(StopWorkBLL); } catch { throw; } }
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 static Result IsNoConflictWithOtherProcess(int EmployeeCodeID, DateTime StartDate, DateTime EndDate, params BusinessSubCategoriesEnum[] ExcludeBusinessSubCategories) { Result result = null; if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.InternshipScholarships) == false) { #region Validaion for conflict with InternshipScholarship List <BaseInternshipScholarshipsBLL> BaseInternshipScholarshipBLLList = new BaseInternshipScholarshipsBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (BaseInternshipScholarshipBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithInternshipScholarship.ToString(); return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.OverTimes) == false) { #region Validaion for conflict with Overtime List <OverTimesBLL> OverTimesBLLList = new OverTimesBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); OverTimesBLL nn = new OverTimesBLL(); if (OverTimesBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithOverTime.ToString(); result.Entity = nn; return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.Delegations) == false) { #region Validaion for conflict with Delegation List <BaseDelegationsBLL> DelegationsBLLList = new BaseDelegationsBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (DelegationsBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithDelegation.ToString(); return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.Vacations) == false) { #region Validaion for conflict with vacation List <BaseVacationsBLL> VacationsBLLList = new BaseVacationsBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (VacationsBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithVacation.ToString(); return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.StopWork) == false) { #region Validaion for conflict with StopWorks List <StopWorksBLL> StopWorksBLLList = new StopWorksBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (StopWorksBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithStopWork.ToString(); return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.Scholarships) == false) { #region Validaion for conflict with Scholarship List <BaseScholarshipsBLL> BaseScholarshipsBLLList = new BaseScholarshipsBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (BaseScholarshipsBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithScholarship.ToString(); return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.Lenders) == false) { #region Validaion for conflict with Lenders List <LendersBLL> LendersBLLList = new LendersBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (LendersBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithLender.ToString(); return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.Assignings) == false) { #region Validaion for conflict with External Assigning List <ExternalAssigningBLL> ExternalAssigningBLLList = new ExternalAssigningBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (ExternalAssigningBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithExternalAssigning.ToString(); return(result); } #endregion } if (ExcludeBusinessSubCategories.Contains(BusinessSubCategoriesEnum.Teachers) == false) { #region Validaion for conflict with Teachers //List<TeachersBLL> TeachersBLLList = new TeachersBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); //if (TeachersBLLList.Count() != 0) //{ // result = new Result(); // result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); // result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithTeacher.ToString(); // return result; //} #endregion } return(result); }
public override Result Add() { try { Result result = base.Add(); if (result != null) { return(result); } int EmployeeCodeID = this.EmployeeCareerHistory.EmployeeCode.EmployeeCodeID; DateTime StartDate = this.AssigningStartDate; DateTime EndDate = this.AssigningEndDate ?? DateTime.Now.Date; #region Validaion for conflict with lender EmployeesCareersHistoryBLL EmployeesCareersHistory = new EmployeesCareersHistoryBLL().GetActiveByEmployeeCareerHistoryID(this.EmployeeCareerHistory.EmployeeCareerHistoryID); //if (EmployeesCareersHistory != null && EmployeesCareersHistory.EmployeeCareerHistoryID > 0) // EmployeeCodeID = EmployeesCareersHistory.EmployeeCode.EmployeeCodeID; List <LendersBLL> LendersBLLList = new LendersBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (LendersBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithLender.ToString(); return(result); } #endregion #region Validaion for conflict with StopWorks List <StopWorksBLL> StopWorksBLLList = new StopWorksBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (StopWorksBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithStopWork.ToString(); return(result); } #endregion #region Validaion for conflict with scholarship List <BaseScholarshipsBLL> BaseScholarshipsBLLList = new BaseScholarshipsBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (BaseScholarshipsBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithScholarship.ToString(); return(result); } #endregion #region Validaion for conflict with External Assigning List <ExternalAssigningBLL> ExternalAssigningBLLList = new ExternalAssigningBLL().GetByEmployeeCodeID(EmployeeCodeID, StartDate, EndDate); if (ExternalAssigningBLLList.Count() != 0) { result = new Result(); result.EnumType = typeof(NoConflictWithOtherProcessValidationEnum); result.EnumMember = NoConflictWithOtherProcessValidationEnum.RejectedBecauseOfConflictWithExternalAssigning.ToString(); return(result); } #endregion result = new Result(); Assignings assigning = DALInstance; assigning.JobID = this.Job.JobID; assigning.ManagerCodeID = this.Manager != null ? this.Manager.EmployeeCodeID : (int?)null; assigning.OrganizationID = this.Organization.OrganizationID; assigning.CreatedBy = this.LoginIdentity.EmployeeCodeID; this.AssigningID = new AssigningsDAL().Insert(assigning); if (this.AssigningID != 0) { result.Entity = this; result.EnumType = typeof(AssigningsValidationEnum); result.EnumMember = AssigningsValidationEnum.Done.ToString(); } return(result); } catch (Exception ex) { throw ex; } }