コード例 #1
0
        private void btnReCheckIn_Click(object sender, RoutedEventArgs e)
        {
            if (Tickets.Count == 1)
            {
                flight.Tickets.FirstOrDefault(t => t.ID == Tickets[0].ID).Seat = null;
                Db.Context.SaveChanges();
                selectedSeat.btnSeat.Background = new SolidColorBrush(AMONICColor.Empty);
            }
            else
            {
                flight.Tickets.FirstOrDefault(t => t.ID == Tickets[0].ID).Seat = null;
                flight.Tickets.FirstOrDefault(t => t.ID == Tickets[1].ID).Seat = null;
                Db.Context.SaveChanges();

                selectedSeat.btnSeat.Background = new SolidColorBrush(AMONICColor.Dual);

                if (directionOfSelectedSeat == "left")
                {
                    selectedSeat.Previous.btnSeat.Background = new SolidColorBrush(AMONICColor.Dual);
                }
                else if (directionOfSelectedSeat == "right")
                {
                    selectedSeat.After.btnSeat.Background = new SolidColorBrush(AMONICColor.Dual);
                }
            }

            directionOfSelectedSeat        = "";
            btnReCheckIn.IsEnabled         = false;
            btnPrintBoardingPass.IsEnabled = false;
            btnOk.IsEnabled = true;
            isCheckedIn     = false;
            selectedSeat    = null;
        }
コード例 #2
0
        private void RefreshSeat()
        {
            selectedSeat = null;
            LoadSeat();

            if (Tickets.Count == 2)
            {
                ShowDualSeat();
            }
            else
            {
                stpNote.Children.Remove(tblDualEmptySeat);
                stpNote.Children.Remove(dpnDualEmptySeat);
            }
        }
コード例 #3
0
        private void KeepSelectedSeatColor(UcSeat uc)
        {
            uc.IsSelected = selectedSeat != null && selectedSeat.Seat == uc.Seat ? true : false;

            if (selectedSeat != null)
            {
                if (directionOfSelectedSeat == "left" && uc.Previous != null && selectedSeat.Previous.Seat == uc.Previous.Seat)
                {
                    uc.Previous.IsSelected = true;
                }
                else if (directionOfSelectedSeat == "right" && uc.After != null && selectedSeat.After.Seat == uc.After.Seat)
                {
                    uc.After.IsSelected = true;
                }
            }
        }
コード例 #4
0
        private void AddSeat(Schedule flight, int from, int to, int cabinId)
        {
            string seatName1 = "AB";
            string seatName2 = "ABCD";
            string seatName3 = "ABCDEF";
            var    seatName  = cabinId == 3 ? seatName1 : (cabinId == 2 ? seatName2 : seatName3);

            UcSeat previous = new UcSeat();

            for (int i = from; i <= to; i++)
            {
                foreach (var item in seatName)
                {
                    UcSeat uc = new UcSeat();
                    uc.Seat    = i + item.ToString();
                    uc.Ticket  = flight.Tickets.Where(t => t.Seat == uc.Seat).FirstOrDefault();
                    uc.Flight  = flight;
                    uc.CabinId = cabinId;

                    if (cabinId == 2)
                    {
                        if (uc.Seat.Contains("A"))
                        {
                            previous = uc;
                        }
                        else if (uc.Seat.Contains("B"))
                        {
                            uc.Previous = previous; previous.After = uc;
                        }
                        else if (uc.Seat.Contains("C"))
                        {
                            previous = uc;
                        }
                        else if (uc.Seat.Contains("D"))
                        {
                            uc.Previous = previous; previous.After = uc;
                        }
                    }
                    else if (cabinId == 1)
                    {
                        if (uc.Seat.Contains("A"))
                        {
                            previous = uc;
                        }
                        else if (uc.Seat.Contains("B"))
                        {
                            uc.Previous = previous; previous.After = uc; previous = uc;
                        }
                        else if (uc.Seat.Contains("C"))
                        {
                            uc.Previous = previous; previous.After = uc;
                        }
                        else if (uc.Seat.Contains("D"))
                        {
                            previous = uc;
                        }
                        else if (uc.Seat.Contains("E"))
                        {
                            uc.Previous = previous; previous.After = uc; previous = uc;
                        }
                        else if (uc.Seat.Contains("F"))
                        {
                            uc.Previous = previous; previous.After = uc;
                        }
                    }

                    if (cabinId == 3)
                    {
                        if (uc.Seat.Contains("A"))
                        {
                            uc.Width = 175;
                        }
                    }
                    else if (cabinId == 2)
                    {
                        if (uc.Seat.Contains("B"))
                        {
                            uc.Width = 175;
                        }
                    }
                    else if (uc.Seat.Contains("C"))
                    {
                        uc.Width = 175;
                    }

                    wpSeats.Children.Add(uc);
                }
            }
        }
コード例 #5
0
        private void BtnSeat_Click(object sender, EventArgs e)
        {
            if (!isCheckedIn)
            {
                ResetSelectedSeatColor();

                var ucSeat = (sender as Button).Parent as UcSeat;

                if (ucSeat.Ticket == null)
                {
                    if (Tickets.Count == 1)
                    {
                        if (Tickets[0].CabinTypeID != ucSeat.CabinId)
                        {
                            MessageBox.Show("Your ticket is not in this cabin", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        else
                        {
                            selectedSeat = ucSeat;
                            selectedSeat.btnSeat.Background = new SolidColorBrush(AMONICColor.Selected);
                        }
                    }
                    else
                    {
                        if (((SolidColorBrush)ucSeat.btnSeat.Background).Color != AMONICColor.Selected)
                        {
                            if (((SolidColorBrush)ucSeat.btnSeat.Background).Color == AMONICColor.Dual)
                            {
                                if (Tickets[0].CabinTypeID != ucSeat.CabinId)
                                {
                                    MessageBox.Show("Your tickets is not in this cabin", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                                }
                                else
                                {
                                    selectedSeat = ucSeat;
                                    selectedSeat.btnSeat.Background = new SolidColorBrush(AMONICColor.Selected);
                                    if (selectedSeat.Previous != null && selectedSeat.Previous.Ticket == null)
                                    {
                                        selectedSeat.Previous.btnSeat.Background = new SolidColorBrush(AMONICColor.Selected);
                                        directionOfSelectedSeat = "left";
                                    }
                                    else
                                    {
                                        selectedSeat.After.btnSeat.Background = new SolidColorBrush(AMONICColor.Selected);
                                        directionOfSelectedSeat = "right";
                                    }
                                }
                            }
                            else
                            {
                                MessageBox.Show("This seat isn't dual seat", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("This seat was checked in", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("If you want to change seat, Please click reCheck in!", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }