Ejemplo n.º 1
0
        public double GetAge(DatabaseConnection dbConn, DateTime AsOfDate)
        {
            if (string.IsNullOrEmpty(m_EmpNo))
            {
                EEmpPersonalInfo dummyEmpInfo = new EEmpPersonalInfo();
                if (dummyEmpInfo.LoadDBObject(dbConn, EmpID))
                {
                    return(dummyEmpInfo.GetAge(dbConn, AsOfDate));
                }
                else
                {
                    return(0);
                }
            }
            if (this.EmpDateOfBirth.Ticks.Equals(0))
            {
                return(0);
            }
            DateTime tmpDateOfBirth = this.EmpDateOfBirth;

            return(HROne.CommonLib.Utility.YearDifference(tmpDateOfBirth, AsOfDate.AddDays(-1)));
        }
Ejemplo n.º 2
0
        public double GetYearOfServer(DatabaseConnection dbConn, DateTime AsOfDate)
        {
            if (string.IsNullOrEmpty(m_EmpNo))
            {
                EEmpPersonalInfo dummyEmpInfo = new EEmpPersonalInfo();
                if (dummyEmpInfo.LoadDBObject(dbConn, EmpID))
                {
                    return(dummyEmpInfo.GetYearOfServer(dbConn, AsOfDate));
                }
                else
                {
                    return(0);
                }
            }
            if (this.EmpServiceDate.Ticks.Equals(0))
            {
                return(0);
            }
            DateTime tmpYearOfService = this.EmpServiceDate;

            if (tmpYearOfService > AsOfDate)
            {
                return(0);
            }

            EEmpTermination empTerm = EEmpTermination.GetObjectByEmpID(dbConn, m_EmpID);

            if (empTerm != null)
            {
                if (empTerm.EmpTermLastDate < AsOfDate)
                {
                    AsOfDate = empTerm.EmpTermLastDate;
                }
            }
            return(HROne.CommonLib.Utility.YearDifference(tmpYearOfService, AsOfDate));
        }