private void SetRow(int row, BuyRecordObject record, int listIndex) { Console.WriteLine(string.Format("row:{0},listIndex{1}", row, listIndex)); if (row < 1 || row > 6) { return; } Label lb1 = this.Controls["panelRow" + row.ToString() + "Col1"].Controls["lbRow" + row.ToString() + "Col1"] as Label; Label lb2 = this.Controls["panelRow" + row.ToString() + "Col2"].Controls["lbRow" + row.ToString() + "Col2"] as Label; Label lb3 = this.Controls["panelRow" + row.ToString() + "Col3"].Controls["lbRow" + row.ToString() + "Col3"] as Label; //Label lb4 = this.Controls["panelRow" + row.ToString() + "Col3"].Controls["lbRow" + row.ToString() + "Col4"] as Label; Label lb4 = lb1; Panel btn = this.Controls["panelRow" + row.ToString() + "Col4"] as Panel; if (record != null && lb1 != null) { lb1.Text = record.BuyTime.ToString("yyyy-MM-dd HH:mm"); //listIndex.ToString() + "-"+ // lb2.Text = string.Format("《{0}》 {1} 张 {2}元/张",record.Tickets[0].Movie.Name,record.Tickets.Count.ToString(),record.Tickets[0].Price.ToString()); // lb3.Text = record.Tickets[0].Seat.Room.Name+"-"+record.Tickets[0].Seat.Room.Cinema.Name ; // lb4.Text = record.TotalPrice.ToString(); lb2.Text = record.Tickets[0].Seat.Room.Cinema.Name; lb3.Text = record.TotalPrice.ToString(); btn.BackgroundImage = Properties.Resources.Account_FeeDetail_RowCol4_detail; btn.Tag = record; // lb4.Text = string.Empty; } else { btn.Tag = null; lb1.Text = lb2.Text = lb3.Text = lb4.Text = string.Empty; btn.BackgroundImage = Properties.Resources.Account_FeeDetail_RowCol4; } }
public SingleFeeDetailPanel(BuyRecordObject record) { InitializeComponent(); //record.BuyTime; TicketObject ticket = record.Tickets[0]; string movieName = ticket.Movie.Name; this.lbCinema.Text = string.Format(this.lbCinema.Text, record.Tickets[0].Seat.Room.Cinema.Name); this.lbMovieName.Text = string.Format(this.lbMovieName.Text, movieName, ticket.Movie.Type == null || ticket.Movie.Type.Length == 0 ? "" : "(" + ticket.Movie.Type + ")"); DateTime playDate = Convert.ToDateTime(ticket.PlayTime); this.lbDate.Text = string.Format(this.lbDate.Text, ticket.PlayTime.ToString("yyyy-MM-dd / HH:mm")); //this.lbRoom.Location = new Point(this.lbTimeHint.Location.X + this.lbTimeHint.Width, this.lbTimeHint.Location.Y); int num = 4; string seat = string.Empty; string[] seatArray = record.Tickets[0].Seat.SeatId.Split(','); for (int i = 0; i < seatArray.Length; i++) { if (i != 0 && i % num == 0) { // seat += "\n座位:" seat += "\n "; } if (i == 0) { seat += seatArray[i]; } else { seat += "、" + seatArray[i]; } } int totalPrice = record.TotalPrice; // WinFormHelper.LocationAfter(this.lbPrice, this.lbTicketPriceHint); this.lbNum.Text = string.Format(this.lbNum.Text, record.Tickets.Count.ToString()); // WinFormHelper.LocationAfter(this.lbTicketPriceHint, this.lbTicketCount); //WinFormHelper.LocationAfter(this.lbTicketCount, this.lbTicketCountHint); this.lbRoom.Text = string.Format(this.lbRoom.Text, ticket.Seat.Room.Name, seat); this.lbAllFee.Text = string.Format(this.lbAllFee.Text, totalPrice.ToString()); FT.Commons.Tools.WinFormHelper.VerLocationAfter(this.lbRoom, this.lbAllFee, 14); }