/// <summary>
        /// 导入员工
        /// </summary>
        /// <param name="dataReader"></param>
        /// <param name="staffManager"></param>
        /// <param name="userManager"></param>
        /// <param name="userLogonManager"></param>
        /// <returns></returns>
        //public int ImportStaff(IDataReader dataReader, BaseStaffManager staffManager, BaseUserExpressManager sTaffExpressManager, BaseUserManager userManager, BaseUserLogonManager userLogonManager)
        public int ImportStaff(IDataReader dataReader, BaseStaffManager staffManager, BaseUserManager userManager, BaseUserLogonManager userLogonManager)
        {
            var result = 0;

            /*
             * BaseStaffEntity staffEntity = staffManager.GetEntity(dataReader["Id"].ToString());
             * if (staffEntity == null)
             * {
             *  staffEntity = new BaseStaffEntity();
             * }
             * staffEntity.Id = int.Parse(dataReader["Id"].ToString());
             * staffEntity.Code = dataReader["EMPLOYEE_CODE"].ToString();
             * staffEntity.RealName = dataReader["EMPLOYEE_NAME"].ToString();
             * staffEntity.Telephone = dataReader["PHONE"].ToString();
             * staffEntity.HomeAddress = dataReader["ADDRESS"].ToString();
             * staffEntity.IDCard = dataReader["ID_CARD"].ToString();
             *
             * // staffEntity.CompanyId = dataReader["OWNER_SITE"].ToString();
             * staffEntity.CompanyName = dataReader["OWNER_SITE"].ToString();
             * // staffEntity.DepartmentId = dataReader["DEPT_NAME"].ToString();
             * staffEntity.DepartmentName = dataReader["DEPT_NAME"].ToString();
             * // staffEntity.WorkgroupId = dataReader["GROUP_NAME"].ToString();
             * staffEntity.WorkgroupName = dataReader["GROUP_NAME"].ToString();
             *
             * System.Console.WriteLine("ImportK8Staff:" + staffEntity.Id + ":" + staffEntity.RealName);
             * // 02:可以把读取到的数据能写入到用户中心的。
             * result = staffManager.UpdateEntity(staffEntity);
             * if (result == 0)
             * {
             *  staffManager.AddEntity(staffEntity);
             * }
             */

            /*
             * BaseUserExpressEntity sTAFF_EXPRESSEntity = sTAFF_EXPRESSManager.GetEntity(dataReader["Id"].ToString());
             * if (sTAFF_EXPRESSEntity == null)
             * {
             *  sTAFF_EXPRESSEntity = new BaseUserExpressEntity();
             * }
             * sTAFF_EXPRESSEntity.Id = int.Parse(dataReader["Id"].ToString());
             * sTAFF_EXPRESSEntity.OWNER_RANGE = dataReader["OWNER_RANGE"].ToString();
             * Decimal tRANSFER_ADD_FEE = 0;
             * if (!string.IsNullOrEmpty(dataReader["TRANSFER_ADD_FEE"].ToString()) && ValidateUtil.IsDouble(dataReader["TRANSFER_ADD_FEE"].ToString()))
             * {
             *  tRANSFER_ADD_FEE = Decimal.Parse(dataReader["TRANSFER_ADD_FEE"].ToString());
             * }
             * sTAFF_EXPRESSEntity.TRANSFER_ADD_FEE = tRANSFER_ADD_FEE;
             * Decimal dISPATCH_ADD_FEE = 0;
             * if (!string.IsNullOrEmpty(dataReader["DISPATCH__ADD_FEE"].ToString()) && ValidateUtil.IsDouble(dataReader["DISPATCH__ADD_FEE"].ToString()))
             * {
             *  dISPATCH_ADD_FEE = Decimal.Parse(dataReader["DISPATCH__ADD_FEE"].ToString());
             * }
             * sTAFF_EXPRESSEntity.DISPATCH_ADD_FEE = dISPATCH_ADD_FEE;
             *
             * System.Console.WriteLine("ImportK8Staffexpress:" + staffEntity.Id + ":" + staffEntity.RealName);
             * // 02:可以把读取到的数据能写入到用户中心的。
             * result = sTAFF_EXPRESSManager.Update(sTAFF_EXPRESSEntity);
             * if (result == 0)
             * {
             *  sTAFF_EXPRESSManager.Add(sTAFF_EXPRESSEntity);
             * }
             */

            var userEntity = new BaseUserEntity
            {
                Id          = dataReader["ID"].ToString().ToInt(),
                UserFrom    = "PDA",
                Code        = dataReader["EMPLOYEE_CODE"].ToString(),
                UserName    = dataReader["EMPLOYEE_NAME"].ToString(),
                RealName    = dataReader["REAL_NAME"].ToString(),
                Description = dataReader["PHONE"].ToString(),
                CompanyName = dataReader["OWNER_SITE"].ToString()
            };

            if (userEntity.CompanyId > 0)
            {
                if (BaseOrganizationManager.GetEntityByNameByCache(userEntity.CompanyName) == null)
                {
                    Console.WriteLine("无CompanyId " + userEntity.Id + ":" + userEntity.UserName + ":" + userEntity.RealName);
                    return(0);
                }
            }
            userEntity.DepartmentName = dataReader["DEPT_NAME"].ToString();
            userEntity.WorkgroupName  = dataReader["GROUP_NAME"].ToString();
            userEntity.HomeAddress    = dataReader["ADDRESS"].ToString();
            userEntity.IdCard         = dataReader["ID_CARD"].ToString();
            if (!string.IsNullOrEmpty(dataReader["cardnum"].ToString()))
            {
                userEntity.IdCard = dataReader["cardnum"].ToString();
            }
            userEntity.Signature = dataReader["EMPLOYEE_TYPE"].ToString();
            userEntity.SortCode  = int.Parse(dataReader["ID"].ToString());
            if (userEntity.UpdateTime == null)
            {
                userEntity.UpdateTime = DateTime.Parse(dataReader["UPDATETIME"].ToString());
            }
            else
            {
                if (userEntity.UpdateTime < DateTime.Parse(dataReader["UPDATETIME"].ToString()))
                {
                    userEntity.UpdateTime = DateTime.Parse(dataReader["UPDATETIME"].ToString());
                }
            }
            // 修改日期需要同步
            // result = userManager.UpdateEntity(userEntity);
            if (result == 0)
            {
                userManager.AddEntity(userEntity);

                var userContactEntity = new BaseUserContactEntity
                {
                    UserId    = dataReader["ID"].ToString().ToInt(),
                    Telephone = dataReader["PHONE"].ToString()
                };
                new BaseUserContactManager().AddEntity(userContactEntity);

                var userLogonEntity = new BaseUserLogonEntity
                {
                    UserId       = dataReader["ID"].ToString().ToInt(),
                    UserPassword = dataReader["BAR_PASSWORD"].ToString()
                };
                userLogonManager.AddEntity(userLogonEntity);
            }

            // 处理角色

            /*
             * string roleName = dataReader["EMPLOYEE_TYPE"].ToString();
             * // 看是否在这个角色里,若没有增加上去。
             * userManager.AddToRole("PDA", userEntity.Id, roleName);
             *
             * // 添加用户密码表
             * BaseUserLogonEntity userLogonEntity = userLogonManager.GetEntity(userEntity.Id);
             * if (userLogonEntity == null)
             * {
             *  userLogonEntity = new BaseUserLogonEntity();
             *  userLogonEntity.Id = userEntity.Id;
             *  userLogonEntity.UserPassword = dataReader["BAR_PASSWORD"].ToString();
             *  //userLogonEntity.Salt = dataReader["SALT"].ToString();
             *  //if (!string.IsNullOrEmpty(dataReader["CHANGEPASSWORDDATE"].ToString()))
             *  //{
             *  //    userLogonEntity.ChangePasswordTime = DateTime.Parse(dataReader["CHANGEPASSWORDDATE"].ToString());
             *  //}
             *  userLogonManager.AddEntity(userLogonEntity);
             * }
             * else
             * {
             *  userLogonEntity.Id = userEntity.Id;
             *  userLogonEntity.UserPassword = dataReader["BAR_PASSWORD"].ToString();
             *  //userLogonEntity.Salt = dataReader["SALT"].ToString();
             *  //if (!string.IsNullOrEmpty(dataReader["CHANGEPASSWORDDATE"].ToString()))
             *  //{
             *  //    userLogonEntity.ChangePasswordTime = DateTime.Parse(dataReader["CHANGEPASSWORDDATE"].ToString());
             *  //}
             *  result = userLogonManager.UpdateEntity(userLogonEntity);
             * }
             */

            return(result);
        }