示例#1
0
        private void Shom_Click(object sender, EventArgs e)
        {
            Shom.Enabled = false;

            // Console.WriteLine(SizeCB.Items);
            string selectedValue = (string)vHouses.SelectedItem;

            Console.WriteLine(selectedValue);
            //Intialize Rooms Array
            room = new Room[Convert.ToInt32(selectedValue), Convert.ToInt32(selectedValue)];

            //Console.WriteLine(selectedValue);
            home = dbstuff.getHouseAndRooms(Convert.ToInt32(selectedValue));
            //  room = dbstuff.getRoomsAndSensorsFromFloor(Convert.ToInt32(selectedValue));
            test = CStuff.creatDG(dgv, home.size, home.size);
            Console.WriteLine(home.size);

            roomss = dbstuff.getRoomsFromFloor(home.Idhome);
            foreach (Room room in roomss)
            {
                dgv.Rows[room.X].Cells[room.Y].Value = room.Type + room.DLocations;
            }
            // Console.WriteLine(roomss[0].RoomID);
            //  Console.WriteLine(home.Rooms[home.Idhome, home.Idhome]);

            // home.Rooms[home.size,home.size];
        }
示例#2
0
        private void addRoom_Click(object sender, EventArgs e)
        {
            string selectedValue = (string)vHouses.SelectedItem;

            // room = new Room[Int32.Parse(XX.Text), Int32.Parse(YY.Text)];

            var op = (RoomType)Enum.Parse(typeof(RoomType), CBType.Text.Replace(' ', '_'));
            //  home.Rooms[Int32.Parse(XX.Text), Int32.Parse(YY.Text)] = ;
            //  Room room = home.Rooms[Int32.Parse(XX.Text), Int32.Parse(YY.Text)];
            int x = Int32.Parse(XX.Text);
            int y = Int32.Parse(YY.Text);

            room[x, y]      = new Room();
            room[x, y].Type = (RoomType)Enum.Parse(typeof(RoomType), CBType.Text);
            Console.WriteLine(room[x, y].Type);

            Test = "";

            foreach (int i in CLDL.CheckedIndices)
            {
                Test += CLDL.Items[i].ToString();
            }

            Console.WriteLine(dbstuff.insertRoom(House.homeIDs, x, y, CBType.Text, Test));
            //  Console.WriteLine(room);
            //room[Int32.Parse(YY.Text), Int32.Parse(XX.Text)].Type = (RoomType)Enum.Parse(typeof(RoomType), CBType.Text.Replace(' ', '_'));
            // Console.WriteLine(op);
            dgv.Rows[Int32.Parse(XX.Text)].Cells[Int32.Parse(YY.Text)].Value = CBType.Text;

            //Remake Table
            home = dbstuff.getHouseAndRooms(Convert.ToInt32(selectedValue));
            //  room = dbstuff.getRoomsAndSensorsFromFloor(Convert.ToInt32(selectedValue));
            test = CStuff.creatDG(dgv, home.size, home.size);
            Console.WriteLine(home.size);

            roomss = dbstuff.getRoomsFromFloor(home.Idhome);
            foreach (Room room in roomss)
            {
                dgv.Rows[room.X].Cells[room.Y].Value = room.Type + room.DLocations;
            }
        }