Exemplo n.º 1
0
        public static HREmployee employee(string accountName)
        {
            try
            {
                if (accountName.Trim().Equals(string.Empty))
                {
                    throw new System.ArgumentException("Employee account name not provided.");
                }



                HRHMN_EMPL_REF HREmp = Context.HRHMN_EMPL_REF
                                       .Where(x => x.ACTIVE_IND == "Y")
                                       .Where(x => x.USER_ID.ToLower().Equals(accountName.ToLower())).FirstOrDefault();



                if (HREmp == null)
                {
                    string ErrorMessage = string.Format(@"Unable to retrieve database record for employee with account name ""{0}""", accountName);
                    throw new NullReferenceException(ErrorMessage);
                }

                return(Adapter.EmpHrToEmpDomain(HREmp));
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public static HREmployee EmpHrToEmpDomain(HRHMN_EMPL_REF HREmp)
        {
            HREmployee emp = new HREmployee();


            emp.AccountName = HREmp.USER_ID;
            emp.FirstName   = HREmp.ALIAS_NAME;
            emp.LastName    = HREmp.FAMILY_NAME;
            emp.ID_NUMBER   = HREmp.ID_NUMBER;

            //Lookup codes
            emp.ADDRSS_POSTAL_CODE = HREmp.ADDRSS_POSTAL_CODE;
            emp.ADDRSS_STREET_CODE = HREmp.ADDRSS_STREET_CODE;

            return(emp);
        }
Exemplo n.º 3
0
        // public   Employee this[int ID_NUMBER]
        public static HREmployee employee(int ID_NUMBER)
        {
            //    get
            //   {
            HRHMN_EMPL_REF HREmp = Context.HRHMN_EMPL_REF
                                   .Where(x => x.ACTIVE_IND == "Y")
                                   .Where(x => x.ID_NUMBER == ID_NUMBER)
                                   .FirstOrDefault();


            if (HREmp == null)
            {
                string ErrorMessage = string.Format(@"Unable to retrieve database record for employee with ID_NUMBER ""{0}""", ID_NUMBER);
                throw new NullReferenceException(ErrorMessage);
            }


            return(Adapter.EmpHrToEmpDomain(HREmp));
        }