示例#1
0
        public Form1()
        {
            InitializeComponent();
            RefreshTree RF = new RefreshTree(h1, treeView1, NameTxt);

            RF.refresh();
            #region Old


            /* import_xml.Load(_path);
             * XmlElement root = import_xml.DocumentElement;
             * XmlNodeList floor = root.SelectNodes("//Floor");
             *
             * List<Floor> _floors = new List<Floor>();
             *
             * foreach (XmlNode child in floor)
             * {
             *   List<Room> _rooms = new List<Room>();
             *   for (int i = 0; i < child.ChildNodes.Count; i++)
             *   {
             *
             *       Room room = new Room(Int32.Parse(child.ChildNodes[i].Attributes["Nr"].InnerText),
             *           Int32.Parse(child.ChildNodes[i].Attributes["Pers"].InnerText),
             *           child.ChildNodes[i].Attributes["Vacancy"].InnerText,
             *           child.ChildNodes[i].Attributes["Name"].InnerText,
             *           child.ChildNodes[i].Attributes["Start"].InnerText,
             *           child.ChildNodes[i].Attributes["End"].InnerText);
             *
             *       _rooms.Add(room);
             *   }
             *   _floor = new Floor(Int32.Parse(child.Attributes["Nr"].InnerText), _rooms);
             *   _floors.Add(_floor);
             * }
             * h1 = new Hotel(_floors);
             * treeView1.Nodes.Clear();
             * foreach (Floor f in h1.floors)
             * {
             *   treeView1.Nodes.Add("Floor " + f.Number);
             *   foreach (Room r in f.Rooms)
             *   {
             *       treeView1.Nodes[f.Number - 1].Nodes.Add("Room Nr." + r.Number);
             *       if (r.Vacancy == "vacant")
             *       {
             *           treeView1.Nodes[f.Number - 1].Nodes[r.Number % 10 - 1].BackColor = System.Drawing.Color.Green;
             *       }
             *       else
             *       {
             *           treeView1.Nodes[f.Number - 1].Nodes[r.Number % 10 - 1].BackColor = System.Drawing.Color.Red;
             *       }
             *   }
             * }
             */
            #endregion
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         CheckOut a = new CheckOut(treeView1, h1);
         a.DeleteReservationEntry();
         RefreshTree RF = new RefreshTree(h1, treeView1, NameTxt);
         RF.refresh();
     }
     catch
     {
         MessageBox.Show("Room already empty!");
     }
 }
示例#3
0
        private void Reserve_Click(object sender, EventArgs e)
        {
            string EndDateText = dateTimePicker1.Text;

            if ((NameTxt.Text == String.Empty))
            {
                MessageBox.Show("Please fill all fields");
            }
            else
            {
                try
                {
                    Reserve R = new Reserve(treeView1, h1, NameTxt.Text, dateTimePicker2.Text, dateTimePicker1.Text);
                    R.AddReservation();
                    RefreshTree RF = new RefreshTree(h1, treeView1, NameTxt);
                    RF.refresh();
                }
                catch
                {
                    MessageBox.Show("Select a room!");
                }
            }
        }