public virtual List <GovernmentFundsBLL> GetGovernmentFunds(out int totalRecordsOut, out int recFilterOut) { try { List <GovernmentFunds> GovernmentFundsList = new GovernmentFundsDAL() { search = Search, order = Order, orderDir = OrderDir, startRec = StartRec, pageSize = PageSize, orderByColumnName = OrderByColumnName }.GetGovernmentFunds(out totalRecordsOut, out recFilterOut); List <GovernmentFundsBLL> GovernmentFundsBLLList = new List <GovernmentFundsBLL>(); if (GovernmentFundsList.Count > 0) { foreach (var item in GovernmentFundsList) { GovernmentFundsBLLList.Add(new GovernmentFundsBLL().MapGovernmentFund(item)); } } return(GovernmentFundsBLLList); } catch { throw; } }
public virtual Result Deactivate() { try { Result result = null; #region Validation Deactivation this.IsActive = new GovernmentFundsBLL().GetByGovernmentFundID(this.GovernmentFundID).IsActive; if (this.IsActive == false) { result = new Result(); result.EnumType = typeof(GovernmentFundsValidationEnum); result.EnumMember = GovernmentFundsValidationEnum.RejectedBecauseOfAlreadyDeactivated.ToString(); return(result); } #endregion #region DeactiveDate Validation if (this.DeactiveDate < this.DeductionStartDate) { result = new Result(); result.EnumType = typeof(GovernmentFundsValidationEnum); result.EnumMember = GovernmentFundsValidationEnum.RejectedBecauseOfDeactivationDateShouldNotBeLessThanDeductionStartDate.ToString(); return(result); } #endregion GovernmentFunds GovernmentFund = new GovernmentFunds(); GovernmentFund.GovernmentFundID = this.GovernmentFundID; GovernmentFund.LetterDate = this.LetterDate; GovernmentFund.LetterNo = this.LetterNo; GovernmentFund.Notes = this.Notes; GovernmentFund.DeactiveDate = this.DeactiveDate; GovernmentFund.IsActive = false; GovernmentFund.LastUpdatedDate = DateTime.Now; GovernmentFund.LastUpdatedBy = this.LoginIdentity.EmployeeCodeID; GovernmentFund.GovernmentFundDeactiveReasonID = this.GovernmentFundDeactiveReason.GovernmentFundDeactiveReasonID; int UpdateResult = new GovernmentFundsDAL().Deactivate(GovernmentFund); if (UpdateResult != 0) { result = new Result(); result.Entity = this; result.EnumType = typeof(GovernmentFundsValidationEnum); result.EnumMember = GovernmentFundsValidationEnum.Done.ToString(); } return(result); } catch { throw; } }
public List <GovernmentFundsBLL> GetActiveGovernmentFundsByEmployeeCodeID(int EmployeeCodeID) { List <GovernmentFundsBLL> GovernmentFundsBLLList = new List <GovernmentFundsBLL>(); List <GovernmentFunds> GovernmentFundsList = new GovernmentFundsDAL().GetByEmployeeCodeID(EmployeeCodeID); foreach (var item in GovernmentFundsList.Where(x => x.IsActive.Equals(true))) { GovernmentFundsBLLList.Add(new GovernmentFundsBLL().MapGovernmentFund(item)); } return(GovernmentFundsBLLList); }
public virtual GovernmentFundsBLL GetByGovernmentFundID(int GovernmentFundID) { try { GovernmentFundsBLL GovernmentFundBLL = null; GovernmentFunds GovernmentFund = new GovernmentFundsDAL().GetByGovernmentFundTypeID(GovernmentFundID); if (GovernmentFund != null) { GovernmentFundBLL = new GovernmentFundsBLL().MapGovernmentFund(GovernmentFund); } return(GovernmentFundBLL); } catch { throw; } }
public virtual List <GovernmentFundsBLL> GetGovernmentFunds(string EmployeeCodeNo) { try { List <GovernmentFunds> GovernmentFundsList = new GovernmentFundsDAL().GetGovernmentFunds(EmployeeCodeNo); List <GovernmentFundsBLL> GovernmentFundsBLLList = new List <GovernmentFundsBLL>(); if (GovernmentFundsList.Count > 0) { foreach (var item in GovernmentFundsList) { GovernmentFundsBLLList.Add(new GovernmentFundsBLL().MapGovernmentFund(item)); } } return(GovernmentFundsBLLList); } catch { throw; } }
public virtual Result Update() { try { Result result = null; #region Validation for vacation creation during probation period EmployeesCareersHistoryBLL HiringRecord = new EmployeesCareersHistoryBLL().GetHiringRecordByEmployeeCodeID(this.EmployeeCode.EmployeeCodeID); if (HiringRecord != null) { // probation period = hiring date + 1 year DateTime ProbationEndDate = HiringRecord.ProbationEndDate;//.JoinDate.AddYears(1).AddDays(-10); if (ProbationEndDate > this.DeductionStartDate) { result = new Result(); result.Entity = HiringRecord; result.EnumType = typeof(GovernmentFundsValidationEnum); result.EnumMember = GovernmentFundsValidationEnum.RejectedBecauseOfBeforeHiringDate.ToString(); return(result); } } #endregion #region Validation Loan Ammount if (this.MonthlyDeductionAmount > this.TotalDeductionAmount) { result = new Result(); result.Entity = HiringRecord; result.EnumType = typeof(GovernmentFundsValidationEnum); result.EnumMember = GovernmentFundsValidationEnum.RejectedBecauseOfMonthlyDeductionAmountShouldNotGreaterThanTotalDeductionAmount.ToString(); return(result); } #endregion #region Validation Deactivation this.IsActive = new GovernmentFundsBLL().GetByGovernmentFundID(this.GovernmentFundID).IsActive; if (this.IsActive == false) { result = new Result(); result.EnumType = typeof(GovernmentFundsValidationEnum); result.EnumMember = GovernmentFundsValidationEnum.RejectedBecauseOfAlreadyDeactivated.ToString(); return(result); } #endregion GovernmentFunds GovernmentFund = new GovernmentFunds(); GovernmentFund.GovernmentFundID = this.GovernmentFundID; GovernmentFund.EmployeeCodeID = this.EmployeeCode.EmployeeCodeID; GovernmentFund.GovernmentDeductionTypeID = this.GovernmentDeductionType.GovernmentDeductionTypeID; GovernmentFund.GovernmentFundTypeID = this.GovernmentFundType.GovernmentFundTypeID; GovernmentFund.LoanNo = this.LoanNo; GovernmentFund.LoanDate = this.LoanDate; GovernmentFund.DeductionStartDate = this.DeductionStartDate; GovernmentFund.MonthlyDeductionAmount = this.MonthlyDeductionAmount; GovernmentFund.TotalDeductionAmount = this.TotalDeductionAmount; GovernmentFund.SponserToIDNo = this.GovernmentDeductionType.GovernmentDeductionTypeID == Convert.ToInt16(GovernmentDeductionsTypesEnum.Sponser) ? this.SponserToIDNo : null; GovernmentFund.SponserToName = this.GovernmentDeductionType.GovernmentDeductionTypeID == Convert.ToInt16(GovernmentDeductionsTypesEnum.Sponser) ? this.SponserToName : null; GovernmentFund.ContractNo = this.ContractNo; GovernmentFund.BankIPAN = this.BankIPAN; GovernmentFund.KSACityID = this.KSACity.KSACityID; GovernmentFund.LastUpdatedDate = DateTime.Now; GovernmentFund.LastUpdatedBy = this.LoginIdentity.EmployeeCodeID; int UpdateResult = new GovernmentFundsDAL().Update(GovernmentFund); if (UpdateResult != 0) { result = new Result(); result.Entity = this; result.EnumType = typeof(GovernmentFundsValidationEnum); result.EnumMember = GovernmentFundsValidationEnum.Done.ToString(); } return(result); } catch { throw; } }