public List <AttendanceInAndOutRecord> GetEmployeeInAndOutRecordByCondition(int employeeID, string employeeName, int departmentID, string doorCardNo,
                                                                             DateTime iOTimeFrom, DateTime iOTimeTo, InOutStatusEnum iOStatus,
                                                                             OutInRecordOperateStatusEnum operateStatus, DateTime operateTimeFrom,
                                                                             DateTime operateTimeTo, Account loginUser)
 {
     return(new AttendanceOutInRecord(loginUser).GetEmployeeInAndOutRecordByCondition(employeeID, employeeName,
                                                                                      departmentID, doorCardNo, iOTimeFrom,
                                                                                      iOTimeTo, iOStatus, operateStatus,
                                                                                      operateTimeFrom, operateTimeTo));
 }
        public static string GetOutInRecordOperateNameByOutInRecordOperateStatus(OutInRecordOperateStatusEnum outInRecordOperateStatusEnum)
        {
            switch (outInRecordOperateStatusEnum)
            {
            case OutInRecordOperateStatusEnum.AddByOperator:
                return("新增");

            case OutInRecordOperateStatusEnum.ModifyByOperator:
                return("修改");

            case OutInRecordOperateStatusEnum.ReadFromDataBase:
                return("从ACCESS导入");

            case OutInRecordOperateStatusEnum.ImportByOperator:
                return("从XLS导入");

            default:
                return("");
            }
        }
        /// <summary>
        /// 用于查询某个员工更多信息
        /// </summary>
        public List <AttendanceInAndOutRecord> GetEmployeeInAndOutRecordByCondition(int employeeID, string employeeName,
                                                                                    int departmentID, string doorCardNo,
                                                                                    DateTime iOTimeFrom,
                                                                                    DateTime iOTimeTo,
                                                                                    InOutStatusEnum iOStatus,
                                                                                    OutInRecordOperateStatusEnum
                                                                                    operateStatus,
                                                                                    DateTime operateTimeFrom,
                                                                                    DateTime operateTimeTo)
        {
            List <Account> accountList = _IAccountBll.GetAccountByBaseCondition(employeeName, departmentID, -1, null, true, null);

            if (departmentID == -1)
            {
                accountList = Tools.RemoteUnAuthAccount(accountList, AuthType.HRMIS, _LoginUser, HrmisPowers.A504);
            }

            List <AttendanceInAndOutRecord> records =
                _dalAttendanceInAndOutRecord.GetAttendanceInAndOutRecordByCondition(employeeID, doorCardNo, iOTimeFrom,
                                                                                    iOTimeTo,
                                                                                    iOStatus, operateStatus,
                                                                                    operateTimeFrom,
                                                                                    operateTimeTo);

            for (int i = records.Count - 1; i >= 0; i--)
            {
                Account temp = Tools.FindAccountById(accountList, records[i].EmployeeId);

                if (temp == null)
                {
                    records.RemoveAt(i);
                }
                else
                {
                    records[i].EmployeeName = temp.Name;
                }
            }
            return(records);
        }
        public List <AttendanceInAndOutRecord> GetAttendanceInAndOutRecordByCondition(int employeeID, string doorCardNo,
                                                                                      DateTime iOTimeFrom,
                                                                                      DateTime iOTimeTo,
                                                                                      InOutStatusEnum iOStatus,
                                                                                      OutInRecordOperateStatusEnum
                                                                                      operateStatus,
                                                                                      DateTime operateTimeFrom,
                                                                                      DateTime operateTimeTo)
        {
            List <AttendanceInAndOutRecord> records = new List <AttendanceInAndOutRecord>();
            SqlCommand sqlCommmand = new SqlCommand();

            sqlCommmand.Parameters.Add(_EmployeeId, SqlDbType.Int).Value            = employeeID;
            sqlCommmand.Parameters.Add(_IOTimeStart, SqlDbType.DateTime).Value      = iOTimeFrom;
            sqlCommmand.Parameters.Add(_IOTimeEnd, SqlDbType.DateTime).Value        = iOTimeTo;
            sqlCommmand.Parameters.Add(_IOStatus, SqlDbType.Int).Value              = iOStatus;
            sqlCommmand.Parameters.Add(_OperateStatus, SqlDbType.Int).Value         = operateStatus;
            sqlCommmand.Parameters.Add(_OperateTimeStart, SqlDbType.DateTime).Value = operateTimeFrom;
            sqlCommmand.Parameters.Add(_OperateTimeEnd, SqlDbType.DateTime).Value   = operateTimeTo;
            sqlCommmand.Parameters.Add(_DoorCardNo, SqlDbType.NVarChar, 50).Value   = doorCardNo;

            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetEmployeeInAndOutByCondition", sqlCommmand))
            {
                while (sdr.Read())
                {
                    AttendanceInAndOutRecord record = new AttendanceInAndOutRecord();
                    record.RecordID      = (Int32)sdr[_DBRecordID];
                    record.EmployeeId    = (Int32)sdr[_DBEmployeeId];
                    record.DoorCardNo    = sdr[_DBDoorCardNo].ToString();
                    record.IOStatus      = (InOutStatusEnum)sdr[_DBIOStatus];
                    record.IOTime        = Convert.ToDateTime(sdr[_DBIOTime]);
                    record.OperateStatus = (OutInRecordOperateStatusEnum)sdr[_DBOperateStatus];
                    record.OperateTime   = Convert.ToDateTime(sdr[_DBOperateTime]);
                    records.Add(record);
                }
            }
            return(records);
        }