private List <Punches> GetPunches(FileInfo fi)
        {
            List <Punches> lst_punches = new List <Punches>();
            StreamReader   sr          = fi.OpenText();
            string         aLine       = string.Empty;

            string[] data_split;

            Punches punch;
            string  pin         = string.Empty;
            int     terminalNum = 0;


            while ((aLine = sr.ReadLine()) != null)
            {
                //for the encrypt dataformat 'attlog.dat'.
                if (aLine.IndexOf("SN=") >= 0 || aLine.IndexOf("CHECKSUM") >= 0)
                {
                    continue;
                }
                data_split = aLine.Split('\t');

                if (data_split.Length < 3)
                {
                    continue;
                }

                pin = data_split[0].Trim();
                if (data_split.Length >= 6)
                {
                    punch = new Punches
                    {
                        pin        = pin,
                        punch_time = Convert.ToDateTime(data_split[1].Trim()),
                        workstate  = ToInt(data_split[3].Trim()),
                        verifycode = data_split[4].Trim(),
                        punch_type = "0",
                        workcode   = Convert.ToInt32(data_split[5].Trim())
                    };
                    lst_punches.Add(punch);
                }
                else if (data_split.Length >= 5)
                {
                    punch = new Punches
                    {
                        pin        = pin,
                        punch_time = Convert.ToDateTime(data_split[1].Trim()),
                        workstate  = ToInt(data_split[3].Trim()),
                        verifycode = data_split[4].Trim(),
                        punch_type = "0",
                        workcode   = 0
                    };
                    lst_punches.Add(punch);
                }
            }
            return(lst_punches);
        }
        private List <Punches> GetEntryPunches(FileInfo fi)
        {
            List <Punches> lst_punches = new List <Punches>();

            List <string> spunchesList = ReadEntryFile(fi);

            string[] data_split;
            Punches  punch;
            string   pin         = string.Empty;
            int      terminalNum = 0;

            foreach (string spunch in spunchesList)
            {
                data_split = spunch.Split('\t');

                if (data_split.Length < 3)
                {
                    continue;
                }

                pin = data_split[0].Trim();

                if (data_split.Length >= 6)
                {
                    punch = new Punches
                    {
                        pin        = pin,
                        punch_time = Convert.ToDateTime(data_split[1].Trim()),
                        //terminal = terminal,
                        workstate  = ToInt(data_split[3].Trim()),
                        verifycode = data_split[4].Trim(),
                        punch_type = "0",
                        workcode   = Convert.ToInt32(data_split[5].Trim())
                    };
                    lst_punches.Add(punch);
                }
                else if (data_split.Length >= 5)
                {
                    punch = new Punches
                    {
                        pin        = pin,
                        punch_time = Convert.ToDateTime(data_split[1].Trim()),
                        //terminal = terminal,
                        workstate  = ToInt(data_split[3].Trim()),
                        verifycode = data_split[4].Trim(),
                        punch_type = "0",
                        workcode   = Convert.ToInt32(data_split[5].Trim())
                    };
                    lst_punches.Add(punch);
                }
            }
            return(lst_punches);
        }