Ejemplo n.º 1
0
 public static void AddRecord(RawDataRecord UseRecord)
 {
     if (m_Conn != null)
     {
         m_Conn.Insert(UseRecord, typeof(RawDataRecord));
     }
 }
Ejemplo n.º 2
0
        public static void AddRecord(DateTime UseTime, string UseValue)
        {
            if (m_Conn != null)
            {
                RawDataRecord rw = new RawDataRecord();
                rw.Flags     = "";
                rw.ScanValue = UseValue;
                rw.TimeStamp = UseTime;
                rw.Status    = 0;

                AddRecord(rw);
            }
        }
Ejemplo n.º 3
0
        public static List <RawDataRecord> GetPendingData()
        {
            List <ProfileRecord> _events = GetPendingRecords();
            List <RawDataRecord> resultList = new List <RawDataRecord>();
            int           Count, Count2;
            RawDataRecord rc;
            string        LastDayFile    = "0000000";
            string        LastEmployee   = "";
            string        LastProfile    = "";
            string        CurrentProfile = "";
            bool          bIsSpecialEvent;
            bool          bStartTimeSet;

            bool bSaveStart, bSaveEnd;

            for (Count = 0; Count < _events.Count; Count++)
            {
                if (_events[Count].Badge1 != "[BREAK]" && _events[Count].Badge1 != "[LUNCH]")
                {
                    //leave alone if break or lunch event, to pass through to next event
                    CurrentProfile  = "";
                    bIsSpecialEvent = false;
                    for (Count2 = 0; Count2 < 12; Count2++)
                    {
                        CurrentProfile += _events[Count].GetBadgeAt(Count2 + 1);
                    }
                }
                else
                {
                    bIsSpecialEvent = true;
                }



                if (LastEmployee != _events[Count].EmployeeID || LastDayFile != _events[Count].FileDate)
                {
                    LastProfile   = ""; //reset profile
                    bStartTimeSet = false;
                }

                if (CurrentProfile != LastProfile)
                {
                    //save profile
                    for (Count2 = 0; Count2 < 12; Count2++)
                    {
                        if (_events[Count].GetBadgeAt(Count2 + 1) == "")
                        {
                            break;
                        }
                        else
                        {
                            rc = new RawDataRecord();

                            rc.Flags     = "";
                            rc.TimeStamp = DataTrack.GetDateTimeFromTimeStamp(_events[Count].FileDate + _events[Count].StartTime).AddSeconds(-2);
                            rc.ScanValue = _events[Count].GetBadgeAt(Count2 + 1);
                            resultList.Add(rc);
                        }
                    }
                }

                //if is last event of day for employee AND start time has already been done, only endtime
                //if is special event, both times
                //if first event, always start time

                //check file/emp resets
                bSaveStart = false;
                bSaveEnd   = false;

                if (Count == _events.Count - 1)
                {
                    //last event of the list
                    bSaveStart = false;
                    bSaveEnd   = true;
                    if (_events.Count == 1)
                    {
                        bSaveStart = true;
                    }
                }
                else if (Count == 0)
                {
                    //very first event
                    bSaveStart = true;
                    bSaveEnd   = false;
                    if (_events.Count == 1)
                    {
                        bSaveEnd = true;
                    }
                }
                else if (_events[Count + 1].EmployeeID != _events[Count].EmployeeID || _events[Count + 1].FileDate != _events[Count].FileDate)
                {
                    //last event for employee/day
                    bSaveStart = false;
                    bSaveEnd   = true;
                }
                else if (bIsSpecialEvent)
                {
                    //break/lunch always save
                    bSaveStart = true;
                    bSaveEnd   = true;
                }
                else if (CurrentProfile != LastProfile)
                {
                    //profile change, need start time again
                    //if profile hasnt changed, and are just returning from break/lunch, dont need start time
                    bSaveStart = true;
                    bSaveEnd   = false;
                }
                else if (_events[Count - 1].EmployeeID != _events[Count].EmployeeID || _events[Count - 1].FileDate != _events[Count].FileDate)
                {
                    //if first scan for this employee/day
                    bSaveStart = true;
                    bSaveEnd   = false;
                }


                if (bSaveStart)
                {
                    if (_events[Count].Badge1 == "[BREAK]" || _events[Count].Badge1 == "[LUNCH]")
                    {
                        rc           = new RawDataRecord();
                        rc.Flags     = "";
                        rc.TimeStamp = DataTrack.GetDateTimeFromTimeStamp(_events[Count].FileDate + _events[Count].StartTime);
                        rc.ScanValue = _events[Count].Badge1 == "[BREAK]" ? "SBREAK" : "SLUNCH";
                        resultList.Add(rc);
                    }
                    rc = new RawDataRecord();

                    rc.Flags     = "";
                    rc.TimeStamp = DataTrack.GetDateTimeFromTimeStamp(_events[Count].FileDate + _events[Count].StartTime);
                    rc.ScanValue = _events[Count].EmployeeBadge;
                    resultList.Add(rc);
                }
                if (bSaveEnd)
                {
                    if (_events[Count].Badge1 == "[BREAK]" || _events[Count].Badge1 == "[LUNCH]")
                    {
                        rc           = new RawDataRecord();
                        rc.Flags     = "";
                        rc.TimeStamp = DataTrack.GetDateTimeFromTimeStamp(_events[Count].FileDate + _events[Count].EndTime);
                        rc.ScanValue = _events[Count].Badge1 == "[BREAK]" ? "EBREAK" : "ELUNCH";
                        resultList.Add(rc);
                    }
                    rc = new RawDataRecord();

                    rc.Flags     = "";
                    rc.TimeStamp = DataTrack.GetDateTimeFromTimeStamp(_events[Count].FileDate + _events[Count].EndTime);
                    rc.ScanValue = _events[Count].EmployeeBadge;
                    resultList.Add(rc);
                }

                LastProfile  = CurrentProfile;
                LastEmployee = _events[Count].EmployeeID;
                LastDayFile  = _events[Count].FileDate;
            }

            return(resultList);
        }