package com.csc.library.databean;

import com.csc.library.timeattendance.TimeZone;
import com.csc.library.utilities.CscCalendar;
import com.csc.library.utilities.MyLog;
import com.csc.library.utilities.MyTreeMap;
import com.csc.library.database.FieldManager;
import com.csc.library.session.*;

public class Tswipecard1 extends RecordCmp
    implements DbRecord
{

    public Tswipecard1(){
        super("Tswipecard1", "Tswipecard1 Table");
    }

    public MyTreeMap getDocAllTimeZone(){
        MyTreeMap hm = new MyTreeMap();
        CscCalendar begDate = new CscCalendar(this.getString("o_datein"));
        CscCalendar endDate = new CscCalendar(this.getString("o_dateout"));
        while (begDate.beforeEquals(endDate)) { 
            CscCalendar cs1 = new CscCalendar(begDate.getYYYYMMDD());
            CscCalendar cs2 = new CscCalendar(begDate.getYYYYMMDD());
            try {
                cs1.setCSCTime(this.getFloat("o_timein"));
                cs2.setCSCTime(this.getFloat("o_timeout"));
            } catch (Exception e) {
                MyLog.error(this, e);
            }
            
            TimeZone tz = new TimeZone();
            tz.setBeginZone(cs1);
            tz.setEndZone(cs2);
            hm.put(begDate.getYYYYMMDD(), tz);
            begDate.incDate();          
        }
        return hm;
    }

    public TimeZone getDocTimeZone(){
        CscCalendar cs1 = new CscCalendar(this.getString("o_datein"));
        CscCalendar cs2 = new CscCalendar(this.getString("o_dateout"));      
        try {
            cs1.setCSCTime(this.getFloat("o_timein"));
            cs2.setCSCTime(this.getFloat("o_timeout"));
        } catch (Exception e) {
            MyLog.error(this, e);
        }
        
        TimeZone tz = new TimeZone();
        tz.setBeginZone(cs1);
        tz.setEndZone(cs2);     
        return tz;
    }    
}