public virtual Result Update()
        {
            Result result = new Result();

            result.EnumType = typeof(AllowanceValidationEnum);
            EmployeesAllowances        EmployeeAllowance     = new EmployeesAllowances();
            EmployeesCareersHistoryBLL EmployeeCareerHistory = new EmployeesCareersHistoryBLL().GetActiveByEmployeeCareerHistoryID(this.EmployeeCareerHistory.EmployeeCareerHistoryID);

            //if ((new JobsAllowancesBLL()).IsAllowedAllowanceForJob(EmployeeCareerHistory.OrganizationJob.Job.JobID, this.Allowance.AllowanceID) == AllowanceAllowEnum.NotAllowedBecauseOfNotAllowedForJob)          // not in jobAllowance table
            //{
            //    result.EnumMember = AllowanceValidationEnum.RejectedBecauseOfNotAllowedForJob.ToString();
            //}

            if ((new AllowancesBLL()).IsAllowanceActive(this.Allowance.AllowanceID) == AllowanceAllowEnum.NotAllowedBecauseOfStoped)               // allowance inactive
            {
                result.EnumMember = AllowanceValidationEnum.RejectedBecauseOfStoped.ToString();
            }

            //else if ((new JobsAllowancesBLL()).IsJobAllowanceActive(EmployeeCareerHistory.OrganizationJob.Job.JobID, this.Allowance.AllowanceID) == AllowanceAllowEnum.NotAllowedBecauseOfStopedForJob)         // job inactive
            //{
            //    result.EnumMember = AllowanceValidationEnum.RejectedBecauseOfStopedForJob.ToString();
            //}

            else
            {
                result.Entity     = this;
                result.EnumMember = AllowanceValidationEnum.Done.ToString();
            }


            if (result.EnumMember == AllowanceValidationEnum.Done.ToString())
            {
                EmployeeAllowance.EmployeeAllowanceID     = this.EmployeeAllowanceID;
                EmployeeAllowance.AllowanceID             = this.Allowance.AllowanceID;
                EmployeeAllowance.EmployeeCareerHistoryID = this.EmployeeCareerHistory.EmployeeCareerHistoryID;
                EmployeeAllowance.AllowanceStartDate      = this.AllowanceStartDate;
                EmployeeAllowance.IsActive        = this.IsActive;
                EmployeeAllowance.LastUpdatedDate = DateTime.Now;
                EmployeeAllowance.LastUpdatedBy   = this.LoginIdentity.EmployeeCodeID;
                this.EmployeeAllowanceID          = new EmployeesAllowancesDAL().Update(EmployeeAllowance);
                if (this.EmployeeAllowanceID != 0)
                {
                    result.Entity     = this;
                    result.EnumMember = AllowanceValidationEnum.Done.ToString();
                }
            }

            return(result);
        }
 internal EmployeesAllowancesBLL MapEmployeeAllowance(EmployeesAllowances EmployeeAllowance)
 {
     try
     {
         EmployeesAllowancesBLL EmployeeAllowanceBLL = null;
         if (EmployeeAllowance != null)
         {
             EmployeeAllowanceBLL = new EmployeesAllowancesBLL()
             {
                 EmployeeAllowanceID   = EmployeeAllowance.EmployeeAllowanceID,
                 Allowance             = new AllowancesBLL().MapAllowance(EmployeeAllowance.Allowances),
                 EmployeeCareerHistory = new EmployeesCareersHistoryBLL().MapEmployeeCareerHistory(EmployeeAllowance.EmployeesCareersHistory),
                 AllowanceStartDate    = EmployeeAllowance.AllowanceStartDate.Date,
                 IsActive    = EmployeeAllowance.IsActive,
                 CreatedDate = EmployeeAllowance.CreatedDate
             };
         }
         return(EmployeeAllowanceBLL);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }