コード例 #1
0
        public ActionResult Delete(ScholarshipsViewModel ScholarshipVM)
        {
            BaseScholarshipsBLL baseScholarshipsBLL = new HCMBLL.BaseScholarshipsBLL();

            baseScholarshipsBLL.LoginIdentity = UserIdentity;
            baseScholarshipsBLL.Remove(ScholarshipVM.ScholarshipID);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
ファイル: BaseScholarshipsBLL.cs プロジェクト: hanyweal/HCM
        internal BaseScholarshipsBLL MapScholarship(Scholarships Scholarship)
        {
            try
            {
                BaseScholarshipsBLL BaseScholarshipBLL = null;
                if (Scholarship != null)
                {
                    if (Scholarship.ScholarshipTypeID == Convert.ToInt16(ScholarshipsTypesEnum.Internal))
                    {
                        BaseScholarshipBLL = GenericFactoryPattern <BaseScholarshipsBLL, InternalScholarshipsBLL> .CreateInstance();

                        ((InternalScholarshipsBLL)BaseScholarshipBLL).KSACity  = new KSACitiesBLL().MapKSACity(Scholarship.KSACities);
                        ((InternalScholarshipsBLL)BaseScholarshipBLL).Location = Scholarship.Location;
                    }
                    else if (Scholarship.ScholarshipTypeID == Convert.ToInt16(ScholarshipsTypesEnum.External))
                    {
                        BaseScholarshipBLL = GenericFactoryPattern <BaseScholarshipsBLL, ExternalScholarshipsBLL> .CreateInstance();

                        ((ExternalScholarshipsBLL)BaseScholarshipBLL).Country = new CountriesBLL().MapCountry(Scholarship.Countries);
                    }
                    else
                    {
                        BaseScholarshipBLL = new BaseScholarshipsBLL();
                    }


                    BaseScholarshipBLL.ScholarshipType      = new ScholarshipsTypesBLL().MapScholarshipType(Scholarship.ScholarshipsTypes);
                    BaseScholarshipBLL.ScholarshipID        = Scholarship.ScholarshipID;
                    BaseScholarshipBLL.ScholarshipStartDate = Scholarship.ScholarshipStartDate.Date;
                    BaseScholarshipBLL.ScholarshipEndDate   = Scholarship.ScholarshipEndDate.Date;
                    BaseScholarshipBLL.CreatedDate          = Scholarship.CreatedDate;
                    BaseScholarshipBLL.IsCanceled           = Scholarship.IsCanceled;
                    //BaseScholarshipBLL.Employee = new EmployeesCodesBLL().MapEmployeeCode(Scholarship.EmployeesCodes);

                    BaseScholarshipBLL.CreatedBy = Scholarship.CreatedByNav != null ? new EmployeesCodesBLL().MapEmployeeCode(Scholarship.CreatedByNav) : null;

                    BaseScholarshipBLL.Employee            = Scholarship.EmployeesCodes != null ? new EmployeesCodesBLL().MapEmployeeCode(Scholarship.EmployeesCodes) : null;//new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(Vacation.EmployeesCareersHistory) : null;
                    BaseScholarshipBLL.Qualification       = new QualificationsBLL().MapQualification(Scholarship.Qualifications);
                    BaseScholarshipBLL.ScholarshipTypeEnum = (ScholarshipsTypesEnum)Scholarship.ScholarshipTypeID;
                    BaseScholarshipBLL.ScholarshipReason   = Scholarship.ScholarshipReason;
                    BaseScholarshipBLL.ScholarshipJoinDate = Scholarship.ScholarshipJoinDate;
                    BaseScholarshipBLL.IsPassed            = Scholarship.IsPassed;
                }
                return(BaseScholarshipBLL);
            }
            catch
            {
                throw;
            }
        }
コード例 #3
0
ファイル: BaseScholarshipsBLL.cs プロジェクト: hanyweal/HCM
        public virtual List <BaseScholarshipsBLL> GetScholarships()
        {
            List <BaseScholarshipsBLL> ScholarshipBLLList = new List <BaseScholarshipsBLL>();
            List <Scholarships>        Scholarships       = new ScholarshipsDAL().GetScholarships();

            foreach (var item in Scholarships)
            {
                BaseScholarshipsBLL ScholarshipBLL = null;
                switch (item.ScholarshipTypeID)
                {
                case (Int32)ScholarshipsTypesEnum.Internal:
                    ScholarshipBLL = new InternalScholarshipsBLL()
                    {
                        Location = item.Location,
                        KSACity  = new KSACitiesBLL().MapKSACity(item.KSACities),
                    };
                    break;

                case (Int32)ScholarshipsTypesEnum.External:
                    ScholarshipBLL = new ExternalScholarshipsBLL()
                    {
                        Country = new CountriesBLL().MapCountry(item.Countries),
                    };
                    break;

                default:
                    break;
                }

                ScholarshipBLL.ScholarshipID        = item.ScholarshipID;
                ScholarshipBLL.ScholarshipStartDate = item.ScholarshipStartDate;
                ScholarshipBLL.ScholarshipEndDate   = item.ScholarshipEndDate;
                ScholarshipBLL.ScholarshipTypeEnum  = (ScholarshipsTypesEnum)item.ScholarshipTypeID;//new ScholarshipsTypesBLL().MapScholarshipType(item.ScholarshipsTypes);
                ScholarshipBLL.ScholarshipType      = new ScholarshipsTypesBLL().MapScholarshipType(item.ScholarshipsTypes);
                ScholarshipBLL.Employee             = new EmployeesCodesBLL().MapEmployeeCode(item.EmployeesCodes);
                ScholarshipBLL.Qualification        = new QualificationsBLL().MapQualification(item.Qualifications);
                ScholarshipBLL.ScholarshipReason    = item.ScholarshipReason;
                ScholarshipBLL.ScholarshipJoinDate  = item.ScholarshipJoinDate;
                ScholarshipBLL.IsPassed             = item.IsPassed;
                ScholarshipBLL.CreatedDate          = item.CreatedDate;
                ScholarshipBLLList.Add(ScholarshipBLL);
            }
            return(ScholarshipBLLList);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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;
            }
        }