コード例 #1
0
ファイル: AdminBLL.cs プロジェクト: xmp01/Library
        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);
        }