Ejemplo n.º 1
0
 public void Update(AttLog u)
 {
     attLogDAO.Update(u);
 }
Ejemplo n.º 2
0
        //GetGeneralLogs From Device (string type and extended type)
        public static List <AttLog> GetAttlog(int iMachineNumber, ref string sError, int iDisplay, int iType, string sIP, int iPort)
        {
            var con      = new ConnectionClass();
            var lLogs    = new List <AttLog>();
            var bConnect = false;

            switch (iType)
            {
            case 1:
                bConnect = con.ConnectViaUSB();
                break;

            case 2:
                con.SIP   = sIP;
                con.IPort = iPort;
                bConnect  = con.ConnectViaNet();
                break;

            default:
                break;
            }
            if (bConnect == true)
            {
                int idwEnrollNumber = 0;
                int idwVerifyMode   = 0;
                int idwInOutMode    = 0;
                int idwYear         = 0;
                int idwMonth        = 0;
                int idwDay          = 0;
                int idwHour         = 0;
                int idwMinute       = 0;
                int idwSecond       = 0;
                int idwWorkCode     = 0;
                int idwReserved     = 0;

                string sdwTime = string.Empty;

                int idwErrorCode = 0;
                int iGLCount     = 0;
                int iIndex       = 0;

                con.EnableDevice(false);                            //disable the device
                if (con.DDevice.ReadGeneralLogData(iMachineNumber)) //read all the attendance records to the memory
                {
                    if (iDisplay == 1)
                    {
                        while (con.DDevice.GetGeneralLogDataStr(iMachineNumber, ref idwEnrollNumber, ref idwVerifyMode,
                                                                ref idwInOutMode, ref sdwTime))
                        //get the records from memory
                        {
                            var a = new AttLog();
                            iGLCount++;
                            a.EMachineNumber = iMachineNumber;
                            a.MachineNo      = iMachineNumber;
                            a.EnrolleeNo     = idwEnrollNumber;
                            a.GLCount        = iGLCount;
                            a.EnrollNumber   = idwEnrollNumber;
                            a.VerifyCode     = idwVerifyMode;
                            a.InOutCode      = idwInOutMode;
                            a.STime          = sdwTime;
                            iIndex++;
                            lLogs.Add(a);
                        }
                    }
                    else if (iDisplay == 2)
                    {
                        while (con.DDevice.GetGeneralExtLogData(iMachineNumber, ref idwEnrollNumber, ref idwVerifyMode, ref idwInOutMode,
                                                                ref idwYear, ref idwMonth, ref idwDay, ref idwHour, ref idwMinute, ref idwSecond, ref idwWorkCode, ref idwReserved))//get records from the memory
                        {
                            var a = new AttLog();
                            iGLCount++;
                            a.GLCount        = iGLCount;
                            a.EMachineNumber = iMachineNumber;
                            a.MachineNo      = iMachineNumber;
                            a.EnrolleeNo     = idwEnrollNumber;
                            a.EnrollNumber   = idwEnrollNumber;
                            a.VerifyCode     = idwVerifyMode;
                            a.InOutCode      = idwInOutMode;
                            a.IYear          = idwYear;
                            a.IMonth         = idwMonth;
                            a.IDay           = idwDay;
                            a.IHour          = idwHour;
                            a.IMinute        = idwMinute;
                            a.ISecond        = idwSecond;
                            a.IWorkCode      = idwWorkCode;
                            a.IReserved      = idwReserved;
                            iIndex++;
                            lLogs.Add(a);
                        }
                    }
                }
                else
                {
                    con.DDevice.GetLastError(ref idwErrorCode);
                    if (idwErrorCode != 0)
                    {
                        sError = "Reading data from terminal failed,ErrorCode: " + idwErrorCode.ToString();
                    }
                    else
                    {
                        sError = "No data from terminal returns!";
                    }
                }
            }
            else
            {
                lLogs.Clear();
            }
            con.DDevice.EnableDevice(iMachineNumber, true);//enable the device
            con.DDevice.Disconnect();
            return(lLogs);
        }
Ejemplo n.º 3
0
 public void Save(AttLog att)
 {
     attLogDAO.Save(att);
 }