public bool CheckRemoveSeat(string seatid) { SeatObject tmp = null; SeatObject seat = this.panelSeat.Controls[seatid].Tag as SeatObject; List <SeatObject> rowSelectList = new List <SeatObject>(); for (int i = 0; i < this.SeatList.Count; i++) { tmp = this.SeatList[i]; if (tmp.RowNum == seat.RowNum && this.panelSeat.Controls[tmp.SeatId].BackColor.R == (byte)253) { rowSelectList.Add(tmp); } } if (rowSelectList.Count > 0) { int gapSelect = 0; for (int i = 0; i < rowSelectList.Count; i++) { tmp = rowSelectList[i]; if (tmp.SeatNo == seat.SeatNo + 1 || tmp.SeatNo == seat.SeatNo - 1) { gapSelect++; // break; } } if (gapSelect == 2) { // GlobalTools.PopSeatSelectHint(); return(false); } } return(true); }
public bool CheckAddSeat(SeatObject seat) { SeatObject tmp = null; List <SeatObject> rowSelectList = new List <SeatObject>(); for (int i = 0; i < this.SeatList.Count; i++) { tmp = this.SeatList[i]; if (tmp.RowNum == seat.RowNum && this.panelSeat.Controls[tmp.SeatId].BackColor.R == (byte)253) { rowSelectList.Add(tmp); } } if (rowSelectList.Count > 0) { bool gapSelect = true; for (int i = 0; i < rowSelectList.Count; i++) { tmp = rowSelectList[i]; if (tmp.SeatNo == seat.SeatNo + 1 || tmp.SeatNo == seat.SeatNo - 1) { gapSelect = false; break; } } if (gapSelect) { //GlobalTools.PopSeatSelectHint(); return(false); } } return(true); }
public void AddSeat(SeatObject seat) { // if (ctr.BackColor.R == (byte)125)//未选中 //else if (ctr.BackColor.R == (byte)253)//已经选中 this.selectedSeat.Add(seat.SeatId, seat); this.selectedSeatLine.Add(seat); this.panelSeat.Controls[seat.SeatId].BackColor = selectedColor; }
void lb_Click(object sender, EventArgs e) { if (this.loaded == false) { return; } Control ctr = sender as Control; SeatObject seat = ctr.Tag as SeatObject; //253,208,0 if (seat.LockState == "0") { if (ctr.BackColor.R == (byte)125)//未选中 { if (this.selectedSeat.Count < 8) { if (this.CheckAddSeat(seat)) { this.AddSeat(seat); this.RefreshSelectedPanel(); } else { GlobalTools.PopSeatSelectHint(); } } } else if (ctr.BackColor.R == (byte)253)//已经选中 { if (this.CheckRemoveSeat(seat.SeatId)) { this.RemoveSeat(seat.SeatId); this.RefreshSelectedPanel(); } else { GlobalTools.PopSeatSelectHint(); } } else { //this.selectedSeat.Add(seat.SeatId, seat); // ctr.BackColor = Color.FromArgb(253, 208, 0); // this.RefreshSelectedPanel(); //this.selectedSeat.Remove(seat.SeatId); } } //MessageBoxHelper.Show("选中位置"); //throw new NotImplementedException(); }
public void RefreshSelectedPanel() { SeatObject seat = null; System.Collections.IDictionaryEnumerator enumerator = seatPanel.selectedSeat.GetEnumerator(); while (enumerator.MoveNext()) { seat = enumerator.Value as SeatObject; this.panelSeats.Controls[seat.SeatId].BackColor = seatPanel.selectedColor; } //this.selectedSeatTmp = this.seatPanel.selectedSeat.Clone() as Hashtable; }
public void RemoveAllSelected() { System.Collections.IDictionaryEnumerator enumerator = selectedSeat.GetEnumerator(); SeatObject seat = null; while (enumerator.MoveNext()) { seat = enumerator.Value as SeatObject; this.panelSeat.Controls[seat.SeatId].BackColor = emptyColor; } selectedSeat.Clear(); this.selectedSeatLine.Clear(); this.panelSelectedSeat.Controls.Clear(); }
public void RemoveSeat(string seatid) { SeatObject tmp = null; this.selectedSeat.Remove(seatid); this.panelSeat.Controls[seatid].BackColor = emptyColor; // SeatObject tmp=null; for (int i = 0; i < this.selectedSeatLine.Count; i++) { tmp = this.selectedSeatLine[i] as SeatObject; if (tmp.SeatId == seatid) { this.selectedSeatLine.RemoveAt(i); break; } } }
private void btnPay_Click(object sender, EventArgs e) { if (selectedSeat.Count == 0) { return; } if (GlobalTools.GetLoginUser().Balance < Convert.ToDouble(this.lbTotalPrice.Text)) { GlobalTools.Pop(new BuyMoneyHint()); return; } List <TicketPrintObject> tickets = new List <TicketPrintObject>(); System.Collections.IDictionaryEnumerator enumerator = selectedSeat.GetEnumerator(); TicketPrintObject ticket = null; SeatObject seat = null; SystemConfig config = FT.Commons.Cache.StaticCacheManager.GetConfig <SystemConfig>(); while (enumerator.MoveNext()) { ticket = new TicketPrintObject(); seat = enumerator.Value as SeatObject; ticket.Seat = string.Format("{0}排{1}号", seat.RowNum, seat.SeatNo);; ticket.MovieName = movie.Name; ticket.Cinema = config.Cinema; ticket.TicketId = "0000FED001"; ticket.RoomName = roomPlan.RoomName; ticket.Price = Convert.ToInt32(roomPlan.SPrice); ticket.PrintTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ticket.PlayTime = roomPlan.Playtime; ticket.PlayDate = Convert.ToDateTime(roomPlan.Playtime).ToString("yyyy.MM.dd"); ticket.PlanId = roomPlan.PlanId; //ticket.PlanId = roomPlan.PlanId.Substring(0, 16); ticket.SeatId = seat.SeatId; ticket.Phone = GlobalTools.GetLoginUser().Mobile; tickets.Add(ticket); } //GlobalTools.Pop(new CosumeDetailPanel(tickets, movie, moviePlan)); // GlobalTools.GoPanel(new WaitTicketPrintPanel(tickets, movie, moviePlan)); GlobalTools.GoPanel(new UserPayCheckPanel(tickets, movie, moviePlan, roomPlan, dt)); }
public void RefreshSelectedPanel() { this.panelSelectedSeat.Controls.Clear(); this.lbTotalNum.Text = selectedSeat.Count.ToString() + "张"; //{0:C2} this.lbTotalPrice.Text = string.Format("{0}.00", (roomPlan.SPrice * selectedSeat.Count)); // int sep =10; //int y = 35; // int x=10; int sep = 4; int y = 4; int x = 4; SeatObject seat = null; // System.Collections.IDictionaryEnumerator enumerator = selectedSeat.GetEnumerator(); int i = 0; Font font = new Font("方正兰亭纤黑简体", 12, FontStyle.Bold); // while (enumerator.MoveNext()) for (int j = 0; j < this.selectedSeatLine.Count; j++) { //seat = enumerator.Value as SeatObject; seat = this.selectedSeatLine[j] as SeatObject; this.panelSeat.Controls[seat.SeatId].BackColor = selectedColor; Label lbTmp = new Label(); lbTmp.Font = font; lbTmp.ForeColor = Color.FromArgb(80, 79, 79); lbTmp.AutoSize = false; lbTmp.Width = 194; lbTmp.Height = 37; lbTmp.Image = Properties.Resources.BuyTicket_Seat_Select_Hint; lbTmp.TextAlign = ContentAlignment.MiddleLeft; lbTmp.Text = string.Format("座位号:{0}排{1}号", seat.RowNum, seat.SeatNo); lbTmp.Click += new EventHandler(lbTmp_Click); lbTmp.Tag = seat.SeatId; lbTmp.Location = new Point(x, y + (lbTmp.Height + sep) * i); this.panelSelectedSeat.Controls.Add(lbTmp); // Hashtable值 i++; } }