Ejemplo n.º 1
0
        /// <summary>
        /// Get attendance of each person by date
        /// </summary>
        /// <param name="attendanceDate">date need to get attendance data</param>
        /// <returns>List of event</returns>
        public static List <Event> LoadAttendance(DateTime attendanceDate)
        {
            List <Event> events = new List <Event>();
            DataTable    dt     = null;

            try
            {
                ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient();
                DataSet ds = client.AttendanceQuery("A", attendanceDate);
                dt = ds.Tables[0];
                foreach (DataRow dr in dt.Rows)
                {
                    DateTime eDate     = Convert.ToDateTime(dr["eventDate"].ToString());
                    string   dName     = dr["deviceName"].ToString();
                    string   dIP       = dr["device"].ToString();
                    string   ePerson   = dr["personName"].ToString();
                    string   eCardNo   = dr["cardNo"].ToString();
                    string   eDoorName = dr["doorName"].ToString();
                    string   eStatus   = dr["status"].ToString();
                    string   eGroup    = dr["company"].ToString();

                    Event e = new Event(eDate, dName, dIP, ePerson, eCardNo, eDoorName, eStatus, eGroup);
                    events.Add(e);
                }
                return(events);
            }
            catch (Exception ex)
            {
                return(events);
            }
        }