Exemplo n.º 1
0
        public List <CheckinRecord> GetNewCheckinRecord()
        {
            List <CheckinRecord> records = new List <CheckinRecord>();
            int length = GetLength();

            int    record_count = length / SINGE_CHECKIN_RECORD_LENGTH;
            string file_content = ReadFile();

            for (int position = 0; position < record_count * SINGE_CHECKIN_RECORD_LENGTH;)
            {
                CheckinRecord record = new CheckinRecord();
                Staff         staff  = new Staff();
                staff.CardID       = file_content.Substring(position, CARDID_LENGTH);
                position          += CARDID_LENGTH;
                record.CheckinTime = file_content.Substring(position, CHECKIN_TIME_LENGTH);
                position          += CHECKIN_TIME_LENGTH;
                staff.SetInfoByCardID();
                record.staff = staff;
                records.Add(record);
            }
            return(records);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获得全部考勤信息
        /// </summary>
        /// <returns></returns>
        public List <CheckinRecord> GetAllRecords()
        {
            List <CheckinRecord> records = new List <CheckinRecord>();

            string cmd_str = "SELECT checkin_time, " +
                             "checkin_record.card_id as card_id, " +
                             "department.name as department_name," +
                             "staff.`name` as staff_name " +
                             "FROM checkin_record, staff, department " +
                             "where staff.card_id = checkin_record.card_id and staff.department_id = department.id"; //sql语句
            DataTable dataTable = SelectSql(cmd_str);                                                                //执行sql语句,获得返回结果

            foreach (DataRow row in dataTable.Rows)
            {
                CheckinRecord record = new CheckinRecord();
                record.CheckinTime          = row["checkin_time"].ToString();
                record.staff.CardID         = row["card_id"].ToString();
                record.staff.DepartmentName = row["department_name"].ToString();
                record.staff.Name           = row["staff_name"].ToString();
                records.Add(record);
            }

            return(records);
        }