Ejemplo n.º 1
0
        public static void exportData()
        {
            //教室配置
            string       roomConfig       = MemoryTable.getRoomConfigJson();
            string       strReadFilePath1 = @"./config/roomConfig.txt";
            StreamWriter srWriteFile1     = new StreamWriter(strReadFilePath1);

            srWriteFile1.Write(roomConfig);
            srWriteFile1.Close();

            //设备位置映射
            EquipmentConfigCtl.clearEquipmentMapOfDB();
            string       strReadFilePath2 = @"./config/equipmentMaps.txt";
            string       equiMap          = MemoryTable.getEquipmentMapJson();
            StreamWriter srWriteFile2     = new StreamWriter(strReadFilePath2);

            srWriteFile2.Write(equiMap);
            srWriteFile2.Close();

            //学生基本信息,客户端支持更改的只有绑定的学生卡
            string       strReadFilePath3 = @"./config/Person.txt";
            string       studentInfo      = MemoryTable.getStudentInfoJson();
            StreamWriter srWriteFile3     = new StreamWriter(strReadFilePath3);

            srWriteFile3.Write(studentInfo);
            srWriteFile3.Close();
        }
Ejemplo n.º 2
0
        static void importData()
        {
            roomConfigCtl.clearRoomConfigOfDB();
            //教室配置
            string       strReadFilePath1 = @"./config/roomConfig.txt";
            StreamReader srReadFile1      = new StreamReader(strReadFilePath1);
            string       roomConfig       = srReadFile1.ReadToEnd();

            srReadFile1.Close();
            //string roomConfig = "[{\"group\":0,\"row\":3,\"column\":1},{\"group\":1,\"row\":2,\"column\":2},{\"group\":2,\"row\":3,\"column\":1}]";
            Debug.WriteLine(roomConfig);
            List <RoomConfig> list = (List <RoomConfig>)JsonConvert.DeserializeObject <List <RoomConfig> >(roomConfig);

            roomConfigCtl.AddNewConfig(list);

            EquipmentConfigCtl.clearEquipmentMapOfDB();
            //设备位置映射
            string       strReadFilePath2 = @"./config/equipmentMaps.txt";
            StreamReader srReadFile2      = new StreamReader(strReadFilePath2);
            string       equipmentMaps    = srReadFile2.ReadToEnd();

            srReadFile2.Close();
            //string equipmentMaps = "[{\"equipmentID\":\"equip000001\",\"group\":0,\"row\":1,\"column\":1},{\"equipmentID\":\"equip000002\",\"group\":0,\"row\":2,\"column\":1},{\"equipmentID\":\"equip000004\",\"group\":1,\"row\":1,\"column\":1},{\"equipmentID\":\"equip000006\",\"group\":1,\"row\":1,\"column\":2},{\"equipmentID\":\"equip000005\",\"group\":1,\"row\":2,\"column\":1},{\"equipmentID\":\"equip000007\",\"group\":1,\"row\":2,\"column\":2},{\"equipmentID\":\"equip000008\",\"group\":2,\"row\":1,\"column\":1},{\"equipmentID\":\"equip000009\",\"group\":2,\"row\":2,\"column\":1}]";
            List <equipmentPosition> listMap = (List <equipmentPosition>)JsonConvert.DeserializeObject <List <equipmentPosition> >(equipmentMaps);

            EquipmentConfigCtl.AddMapConfig(listMap);

            //学生基本信息,客户端支持更改的只有绑定的学生卡
            studentInfoCtl.clearStudentInfo();
            string       strReadFilePath3 = @"./config/Person.txt";
            StreamReader srReadFile3      = new StreamReader(strReadFilePath3);
            string       Person           = srReadFile3.ReadToEnd();

            srReadFile3.Close();
            //string Person = "[{\"id_num\":\"CE4D939787\",\"name\":\"李俊\",\"sex\":\"男\",\"email\":\"111\",\"age\":11,\"bj\":\"一班\",\"epc\":\"stu000002\"},{\"id_num\":\"CE4D9397871\",\"name\":\"李韬\",\"sex\":\"\",\"email\":\"111\",\"age\":1,\"bj\":\"二班\",\"epc\":\"stu000001\"}]";
            List <Person> personList = (List <Person>)JsonConvert.DeserializeObject <List <Person> >(Person);

            studentInfoCtl.addStudentInfo(personList);
        }
        public static void initializeTabes()
        {
            if (isInitialized)
            {
                return;
            }
            //教室座位
            dtRoomConfig = roomConfigCtl.getAllRoomConfigInfo();

            //学生信息
            studentInfoTable = studentInfoCtl.getAllStudentInfo();
            studentInfoTable.CaseSensitive = false;

            //获取设备和位置的对应数据
            mapConfigsTable = EquipmentConfigCtl.getAllMapConfigs();

            mapConfigsTable.Columns.Add("epc", typeof(string));
            for (int i = 0; i < mapConfigsTable.Rows.Count; i++)
            {
                DataRow dr = mapConfigsTable.Rows[i];
                dr["epc"] = "";
            }
            isInitialized = true;
        }