/// <summary> /// Get event with conditions /// </summary> /// <param name="SDate">start time</param> /// <param name="EDate">end time</param> /// <param name="CardNo">card no</param> /// <returns>List of events</returns> public static List <Event> LoadEventFilter(string SDate, string EDate, string CardNo) { List <Event> events = new List <Event>(); DataTable dt = null; try { ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient(); DataSet ds = client.EventQry("Q", "", CardNo, SDate, EDate); 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(); Event e = new Event(eDate, dName, dIP, ePerson, eCardNo, eDoorName, eStatus); events.Add(e); } return(events); } catch (Exception ex) { return(null); } }
/// <summary> /// statistic event from first of month to end of month /// </summary> /// <param name="SDate">start time</param> /// <param name="EDate">end time</param> /// <returns>Data set have 3 table :DENY, GRANTED, NOT_DEFINED</returns> public static DataSet LoadEventByMonth(string SDate, string EDate) { List <Event> events = new List <Event>(); DataSet ds = null; try { ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient(); ds = client.EventQry("M", "", "", SDate, EDate); return(ds); } catch (Exception ex) { return(null); } }