Exemple #1
0
        public ICollection <MachineInfo> GetLogData(ZkemClient objZkeeper, int machineNumber)
        {
            string dwEnrollNumber1 = "";
            int    dwVerifyMode    = 0;
            int    dwInOutMode     = 0;
            int    dwYear          = 0;
            int    dwMonth         = 0;
            int    dwDay           = 0;
            int    dwHour          = 0;
            int    dwMinute        = 0;
            int    dwSecond        = 0;
            int    dwWorkCode      = 0;

            ICollection <MachineInfo> lstEnrollData = new List <MachineInfo>();

            objZkeeper.ReadAllGLogData(machineNumber);

            while (objZkeeper.SSR_GetGeneralLogData(machineNumber, out dwEnrollNumber1, out dwVerifyMode, out dwInOutMode, out dwYear, out dwMonth, out dwDay, out dwHour, out dwMinute, out dwSecond, ref dwWorkCode))
            {
                string inputDate = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond).ToString();

                MachineInfo objInfo = new MachineInfo();
                objInfo.MachineNumber  = machineNumber;
                objInfo.IndRegID       = int.Parse(dwEnrollNumber1);
                objInfo.DateTimeRecord = inputDate;

                lstEnrollData.Add(objInfo);
            }

            return(lstEnrollData);
        }
Exemple #2
0
        //Getting Today's Log Data
        public ICollection <MachineInfo> GetTodayLogData(ZkemClient objZkeeper, int machineNumber)
        {
            string dwEnrollNumber1 = "";
            int    dwVerifyMode    = 0;
            int    dwInOutMode     = 0;
            int    dwYear          = 0;
            int    dwMonth         = 0;
            int    dwDay           = 0;
            int    dwHour          = 0;
            int    dwMinute        = 0;
            int    dwSecond        = 0;
            int    dwWorkCode      = 0;

            ICollection <MachineInfo> lstEnrollData = new List <MachineInfo>();

            objZkeeper.ReadAllGLogData(machineNumber);

            while (objZkeeper.SSR_GetGeneralLogData(machineNumber, out dwEnrollNumber1, out dwVerifyMode, out dwInOutMode, out dwYear, out dwMonth, out dwDay, out dwHour, out dwMinute, out dwSecond, ref dwWorkCode))
            {
                string inputDate = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond).ToString();

                DateTime dt = DateTime.Now;
                dt = DateTime.Parse(dt.ToString("yyyy-MM-dd"));

                MachineInfo objInfo = new MachineInfo();
                //objInfo.MachineNumber = machineNumber;
                objInfo.EmployeeID     = int.Parse(dwEnrollNumber1);
                objInfo.DateTimeRecord = inputDate;
                objInfo.InOut          = dwInOutMode + "";

                DateTime dt_compare = DateTime.Parse(DateTime.Parse(inputDate).ToString("yyyy-MM-dd"));

                if (dt == dt_compare)
                {
                    lstEnrollData.Add(objInfo);
                }
            }

            return(lstEnrollData);
        }
Exemple #3
0
        // Filtering Data from Synced Table
        public ICollection <MachineInfo> GetFilteredData(ZkemClient objZkeeper, int machineNumber, DateTime dt)
        {
            string dwEnrollNumber1 = "";
            int    dwVerifyMode    = 0;
            int    dwInOutMode     = 0;
            int    dwYear          = 0;
            int    dwMonth         = 0;
            int    dwDay           = 0;
            int    dwHour          = 0;
            int    dwMinute        = 0;
            int    dwSecond        = 0;
            int    dwWorkCode      = 0;

            ICollection <MachineInfo> lstEnrollData = new List <MachineInfo>();

            objZkeeper.ReadAllGLogData(machineNumber);

            while (objZkeeper.SSR_GetGeneralLogData(machineNumber, out dwEnrollNumber1, out dwVerifyMode, out dwInOutMode, out dwYear, out dwMonth, out dwDay, out dwHour, out dwMinute, out dwSecond, ref dwWorkCode))
            {
                string inputDate = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond).ToString();

                // String.Format("{0:MM/dd/yyyy}", dt);

                DateTime date        = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond);
                DateTime dateCompare = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second);

                MachineInfo objInfo = new MachineInfo();
                //objInfo.MachineNumber = machineNumber;
                objInfo.EmployeeID     = int.Parse(dwEnrollNumber1);
                objInfo.DateTimeRecord = inputDate;
                objInfo.InOut          = dwInOutMode + "";

                if ((dateCompare <= date))
                {
                    lstEnrollData.Add(objInfo);
                }
            }

            return(lstEnrollData);
        }
        public ICollection <MachineInfo> GetLogData(ZkemClient objZkeeper, int machineNumber)
        {
            string dwEnrollNumber1 = "";
            int    dwVerifyMode    = 0;
            int    dwInOutMode     = 0;
            int    dwYear          = 0;
            int    dwMonth         = 0;
            int    dwDay           = 0;
            int    dwHour          = 0;
            int    dwMinute        = 0;
            int    dwSecond        = 0;
            int    dwWorkCode      = 0;

            ICollection <MachineInfo> lstEnrollData = new List <MachineInfo>();

            objZkeeper.ReadAllGLogData(machineNumber);
            cnx.Open();
            SqlCommand    cmd2 = new SqlCommand("select * from atdrecord", cnx);
            SqlDataReader dr   = cmd2.ExecuteReader();
            DataTable     tb   = new DataTable();

            tb.Load(dr);

            while (objZkeeper.SSR_GetGeneralLogData(machineNumber, out dwEnrollNumber1, out dwVerifyMode, out dwInOutMode, out dwYear, out dwMonth, out dwDay, out dwHour, out dwMinute, out dwSecond, ref dwWorkCode))
            {
                string   inputDate = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond).ToString();
                string   recDate = dwYear + "-" + dwMonth + "-" + dwDay, recTime = dwHour + ":" + dwMinute + ":" + dwSecond;
                string   RecDate2 = dwYear + "-" + dwMonth + "-" + dwDay + ' ' + dwHour + ":" + dwMinute + ":" + dwSecond;
                DateTime dateP    = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond);
                // DateTime d = new DateTime(0,0,0,dwHour, dwMinute, dwSecond);
                MachineInfo objInfo = new MachineInfo();
                objInfo.MachineNumber  = machineNumber;
                objInfo.IndRegID       = int.Parse(dwEnrollNumber1);
                objInfo.DateTimeRecord = inputDate;
                // MessageBox.Show(d.ToShortTimeString());
                if (cnx.State == ConnectionState.Open)
                {
                    if (tb.Rows.Count == 0)
                    {
                        DateTime datetime = DateTime.ParseExact(RecDate2, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);


                        cmd = new SqlCommand("insert into AtdRecord values('" + datetime.ToShortDateString() + "','" + datetime.ToShortTimeString() + "','" + datetime + "','" + dwEnrollNumber1 + "')", cnx);
                        cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        bool b = true;
                        for (int i = 0; i < tb.Rows.Count; i++)
                        {
                            if ((tb.Rows[i][2].ToString() == dwEnrollNumber1.ToString() && tb.Rows[i][5].ToString() == inputDate.ToString()))
                            {
                                b = false;
                            }
                        }
                        if (b)
                        {
                            //cmd = new SqlCommand("insert into AtdRecord values('" + dwVerifyMode + "','" + dwEnrollNumber1 + "','" + recDate + "','" + recTime + "','" + RecDate2 + "')", cnx);
                            cmd = new SqlCommand("insert into AtdRecord values('" + datetime.ToShortDateString() + "','" + datetime.ToShortTimeString() + "','" + datetime + "','" + dwEnrollNumber1 + "')", cnx);
                            cmd.ExecuteNonQuery();
                            cmd2 = new SqlCommand("select * from AtdRecord", cnx);
                            dr   = cmd2.ExecuteReader();
                            tb   = new DataTable();
                            tb.Load(dr);
                        }
                    }
                }
                else
                {
                }


                lstEnrollData.Add(objInfo);
            }
            cnx.Close();

            return(lstEnrollData);
        }