public bool CheckSeat(List <Schedule> listSchedule, CabinType cabinType, int nPassenger)
        {
            foreach (var a in listSchedule)
            {
                int totalSeat = 0;
                if (cabinType.ID == 1)
                {
                    totalSeat = a.Aircraft.EconomySeats;
                }
                else if (cabinType.ID == 2)
                {
                    totalSeat = a.Aircraft.BusinessSeats;
                }
                else if (cabinType.ID == 3)
                {
                    totalSeat = a.Aircraft.TotalSeats - a.Aircraft.EconomySeats - a.Aircraft.BusinessSeats;
                }

                var q = db.Tickets.Where(x => x.Confirmed &&
                                         x.ScheduleID == a.ID &&
                                         x.CabinTypeID == cabinType.ID
                                         ).Count();

                if (nPassenger > (totalSeat - q))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #2
0
 public BookingConfirmation(List <Schedule> header, List <Schedule> detail, CabinType cabinType, int nPasenger)
 {
     InitializeComponent();
     this.header    = header;
     this.detail    = detail;
     this.cabinType = cabinType;
     this.nPasenger = nPasenger;
 }
 public BillingConfirmation(List <Schedule> header, List <Schedule> detail, CabinType cabinType, List <PassengerData> listPassengerData)
 {
     InitializeComponent();
     this.header            = header;
     this.detail            = detail;
     this.cabinType         = cabinType;
     this.listPassengerData = listPassengerData;
 }
        private void button1_Click(object sender, EventArgs e)
        {
            panel2.Visible = radioButton1.Checked;

            listHeader.Clear();
            listDetail.Clear();
            dataGridView1.DataSource = null;
            dataGridView2.DataSource = null;

            string from = comboBox1.SelectedValue.ToString();
            string to   = comboBox2.SelectedValue.ToString();

            selectedCabinType = (CabinType)comboBox3.SelectedValue;
            outBoundDateTime  = dateTimePicker1.Value.Date;
            returnDateTime    = dateTimePicker2.Value.Date;
            returnStatus      = radioButton1.Checked;

            if (from == to)
            {
                MessageBox.Show("From and To Airport cannot be same");
                return;
            }

            if (returnStatus)
            {
                if (dateTimePicker2.Value.Date < dateTimePicker1.Value.Date)
                {
                    MessageBox.Show("Return date must be greater than outbound date");
                    return;
                }
            }

            for (int i = -3; i <= 3; i++)
            {
                GetRoute(from, to, outBoundDateTime.AddDays(i), new List <Schedule>(), ref listHeader);
            }

            if (returnStatus)
            {
                for (int i = -3; i <= 3; i++)
                {
                    GetRoute(to, from, returnDateTime.AddDays(i), new List <Schedule>(), ref listDetail);
                }
                panel2.Visible = true;
            }
            else
            {
                panel2.Visible = false;
            }

            ShowHeader();
            ShowDetail();
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            var from = comboBox1.SelectedValue.ToString();
            var to   = comboBox2.SelectedValue.ToString();

            outBoundDateTime = dateTimePicker1.Value.Date;
            returnDateTime   = dateTimePicker2.Value.Date;

            if (from == to)
            {
                MessageBox.Show("From and To Airport Must be different");
                return;
            }

            if (radioButton1.Checked)
            {
                if (returnDateTime < outBoundDateTime)
                {
                    MessageBox.Show("Return date must be greater than Outbound date");
                    return;
                }
            }

            selectedCabinType = (CabinType)comboBox3.SelectedValue;
            returnStatus      = radioButton1.Checked;

            listHeader.Clear();
            listDetail.Clear();

            for (int i = -3; i <= 3; i++)
            {
                GetRoute(from, to, outBoundDateTime.AddDays(i), new List <Schedule>(), ref listHeader);
            }

            if (radioButton1.Checked)
            {
                panel3.Visible = true;
                for (int i = -3; i <= 3; i++)
                {
                    GetRoute(to, from, returnDateTime.AddDays(i), new List <Schedule>(), ref listDetail);
                }
            }
            else
            {
                panel3.Visible = false;
            }

            ShowHeader();
            ShowDetail();
        }
        public decimal GetCabinPrice(List <Schedule> listSchedule, CabinType cabinType)
        {
            decimal total = 0;

            foreach (var a in listSchedule)
            {
                if (cabinType.ID == 1)
                {
                    total += Math.Floor(a.EconomyPrice);
                }
                else if (cabinType.ID == 2)
                {
                    total += Math.Floor(1.35m * Math.Floor(a.EconomyPrice));
                }
                else if (cabinType.ID == 3)
                {
                    total += Math.Floor(1.3m * Math.Floor(1.35m * Math.Floor(a.EconomyPrice)));
                }
            }
            return(total);
        }
 public DestinationItem(Schedule s, CabinType cabinType)
 {
     InitializeComponent();
     this.s         = s;
     this.cabinType = cabinType;
 }
 public DestinationItem(Schedule s, CabinType ct)
 {
     InitializeComponent();
     this.s  = s;
     this.ct = ct;
 }
Exemple #9
0
 partial void DeleteCabinType(CabinType instance);
Exemple #10
0
 partial void UpdateCabinType(CabinType instance);
Exemple #11
0
 partial void InsertCabinType(CabinType instance);