/// <summary> /// Открытие гостиницы /// </summary> private void OpenHotel(object sender, EventArgs e) { Control pb = (Control)sender; HotelUC hf = new HotelUC(pb.Tag.ToString()); Controls.Clear(); Controls.Add(hf); hf.Dock = DockStyle.Fill; }
/// <summary> /// Клик на дерево /// </summary> private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node == null) { return; } #region Выбран список гостиниц if (e.Node.Level == 0 && e.Node.Text == "Города" && !HotelsPanel.Contains(listUC)) { listUC = new UserControls.HotelsListUC(""); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } else if (e.Node.Level == 1 && e.Node.Parent.Text == "Города") { listUC = new UserControls.HotelsListUC(e.Node.Text); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } #endregion #region Выбрана гостиница else if (e.Node.Level == 2 && e.Node.Parent.Parent.Text == "Города") { hotelUC = new UserControls.HotelUC(e.Node.Tag.ToString()); hotelUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(hotelUC); } #endregion #region Выбрана комната else if (e.Node.Level == 3 && e.Node.Parent.Parent.Parent.Text == "Города") { roomUC = new UserControls.RoomUC(e.Node.Tag.ToString()); roomUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } #endregion #region Выбрана админка else if (e.Node.Level == 0 && e.Node.Text == "Админка") { Admin.AdminForm listUC = new Admin.AdminForm(); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } else if (e.Node.Level == 1 && e.Node.Parent.Text == "Админка" && e.Node.Text == "Гостиницы") { Admin.AdminHotelsForm listUC = new Admin.AdminHotelsForm(); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } else if (e.Node.Level == 1 && e.Node.Parent.Text == "Админка" && e.Node.Text == "Комнаты") { Admin.AdminRoomsForm listUC = new Admin.AdminRoomsForm(); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } else if (e.Node.Level == 1 && e.Node.Parent.Text == "Админка" && e.Node.Text == "Бронирования") { Admin.AdminBookingForm listUC = new Admin.AdminBookingForm(); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } else if (e.Node.Level == 1 && e.Node.Parent.Text == "Админка" && e.Node.Text == "Ошибки") { Admin.AdminLogForm listUC = new Admin.AdminLogForm(); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } else if (e.Node.Level == 1 && e.Node.Parent.Text == "Админка" && e.Node.Text == "Пользователи") { Admin.AdminUsersForm listUC = new Admin.AdminUsersForm(); listUC.Dock = DockStyle.Fill; HotelsPanel.Controls.Clear(); HotelsPanel.Controls.Add(listUC); } #endregion }