public string getDemoRTInfo() { DoorDAL doorDAL = new DoorDAL(); List <doorRecord> doorRecordList = doorDAL.getDemoDoorInfo(); RfidDAL rfidDAL = new RfidDAL(); List <RFIDRecord> RFIDRecordList = rfidDAL.getDemoRFIDInfo(); bookDAL bookDAL = new bookDAL(); ReaderDAL readerDAL = new ReaderDAL(); LocationDAL locationDAL = new LocationDAL(); string demoInfoInJson = "["; bool flag = true; //Door_RT_info foreach (doorRecord doorRecord in doorRecordList) { if (!flag) { demoInfoInJson += ","; } string locationName = locationDAL.getLocationByDoorIp(doorRecord.Door_ip); string readerName = readerDAL.getReaderNameBySC(doorRecord.Signal_code); string each = "{\"action\":\"" + doorRecord.Action + "\","; each += "\"reader_name\":\"" + readerName + "\","; each += "\"generate_date\":\"" + doorRecord.Generate_date + "\","; each += "\"location_door\":\"" + locationName + "\","; each += "\"door_ip\":\"" + doorRecord.Door_ip + "\"}"; demoInfoInJson += each; flag = false; } //RFID_RT_info foreach (RFIDRecord RFIDRecord in RFIDRecordList) { if (!flag) { demoInfoInJson += ","; } string locationName = locationDAL.getLocationByRFIDIp(RFIDRecord.Ip); string bookName = bookDAL.getbookNameBySC(RFIDRecord.Signal_code); string each = "{\"signal_code\":\"" + RFIDRecord.Signal_code + "\","; each += "\"book_name\":\"" + bookName + "\","; each += "\"action_date\":\"" + RFIDRecord.Action_date + "\","; each += "\"location_rfid\":\"" + locationName + "\","; each += "\"ip\":\"" + RFIDRecord.Ip + "\"}"; demoInfoInJson += each; flag = false; } demoInfoInJson += "]"; return(demoInfoInJson); }
public MainWindow() { InitializeComponent(); //this.InitializeComponent(); //CoreWindow.GetForCurrentThread().KeyDown += MyPage_KeyDown; instituteDAL = new InstituteDAL(); studentDAL = new StudentDAL(); miscDAL = new MiscDAL(); rfidDAL = new RfidDAL(); ReadDatabaseFile(); try { if (DateTime.Now.Hour > 10) { btnInOut.Content = "OUT"; } else { btnInOut.Content = "IN"; } institue = instituteDAL.GetInstitute(); this.DataContext = institue; date_TB.Text = DateTime.Now.ToString("dd-MMMM-yyy"); AllStudentList = studentDAL.get_all_admissions(); absentAllStudents(); m_SMSEngine = new SMSEngine(ConnectionString.con_string); StartRefreshTimer(); } catch (Exception ex) { //Debug.WriteLine(ex); msgGRID.Visibility = Visibility.Visible; msgTB.Text = ex.ToString(); } }