private void tvMovies_AfterSelect(object sender, TreeViewEventArgs e) { /// <summary> /// 选择一场电影事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> TreeNode node = tvMovies.SelectedNode; if (node == null) { return; } if (node.Level != 1) { return; } int sID = int.Parse(node.Name); Schedule s = null; Movie m = null; s = ScheduleDAL.GetScheduleByScheduleID(sID); if (s == null) { MessageBox.Show("s should not be null"); return; } m = MovieDAL.GetMovieByMovieID(s.MovieID); if (m == null) { MessageBox.Show("m should not be null"); return; } //将详细信息显示 this.lblMovieName.Text = m.MovieName; this.lblDirector.Text = m.Director; this.lblActor.Text = m.Actor; this.lblPrice.Text = s.Price.ToString(); this.lblTime.Text = s.DateTime; this.lblType.Text = m.MovieType; this.picMovie.Image = Image.FromFile(m.Poster); if (this.customerVIP != null) { this.lblCalcPrice.Text = (s.Price * 0.8).ToString(); } else { this.lblCalcPrice.Text = lblPrice.Text; } otherHallIDs.Clear(); foreach (int hID in AllHallIDs) { if (hID == s.HallID) { continue; } otherHallIDs.Add(hID); } //清空座位 ReSetSeats(s.HallID); //遍历该场电影的座位销售情况 foreach (Ticket t in TicketDAL.GetTicketsByScheduleID(sID)) { foreach (Seat seat in seats[s.HallID].Values) { if (t.DetailSeat == seat.SeatNum) { seat.Color = Color.LightCoral; } } } UpdateSeats(s.HallID); tbSeat.SelectedTab = tbSeat.TabPages[s.HallID - 1]; }