Exemple #1
0
 private void Button4_Click(System.Object sender, System.EventArgs e)
 {
     DGV.Rows.Clear();
     SeatCapacity.Clear();
     BookingNo.Clear();
     SC2.Clear();
     SeatAvailability.Clear();
     RadioButton1.Checked = false;
     RadioButton2.Checked = false;
     RNo.Text             = "Select";
     BusSerialNo.Text     = "Select";
 }
Exemple #2
0
 public void btnclear_Click(System.Object sender, System.EventArgs e)
 {
     Rno.Text            = "Select";
     cmbstartpoint.Text  = "";
     cmbdestination.Text = "";
     BusSerialNo.Text    = "Select";
     BusNumber.Text      = "Select";
     BusType.Text        = "Select";
     BusReservation.Text = "Select";
     Arrivaltime.Value   = Convert.ToDateTime(DateTime.Now);
     Departuretime.Value = Convert.ToDateTime(DateTime.Now);
     SeatCapacity.Clear();
     S1.Clear();
     S2.Clear();
     SeatAvailability.Clear();
     SC2.Clear();
 }
Exemple #3
0
 public void FormControls(string CLR)
 {
     if (CLR == "CLR")
     {
         BusSerialNo.Clear();
         BusNumber.Text         = "Select";
         BusRoute.Text          = "Select";
         BusType.Text           = "Select";
         BusReservation.Text    = "Select";
         BusSerialNo.Enabled    = false;
         BusNumber.Enabled      = false;
         BusRoute.Enabled       = false;
         BusType.Enabled        = false;
         BusReservation.Enabled = false;
         SeatCapacity.Clear();
         btnsave.Enabled   = false;
         btnedit.Enabled   = false;
         btndelete.Enabled = false;
         btnadd.Enabled    = true;
         btnfind.Enabled   = true;
         Left1.Enabled     = false;
         Right1.Enabled    = false;
     }
     if (CLR == "Save")
     {
         btnsave.Enabled        = true;
         btnadd.Enabled         = false;
         btnfind.Enabled        = false;
         btndelete.Enabled      = false;
         btnedit.Enabled        = false;
         BusNumber.Enabled      = true;
         BusRoute.Enabled       = true;
         BusType.Enabled        = true;
         BusReservation.Enabled = true;
         BusNumber.Focus();
     }
 }
Exemple #4
0
        /**
         * Returns a SeatCapacity object, separated into
         * a count of each SeatType
         */
        public SeatCapacity GetSeatCapacities(int venueId)
        {
            var capacity = new SeatCapacity();
            var allSeats = _seatRepository
                           .Collection()
                           .Where(seat => seat.VenueId == venueId)
                           .ToList();

            capacity.Budget = allSeats
                              .Where(seat => seat.SeatType.Equals(SeatType.Budget))
                              .Count();

            capacity.Moderate = allSeats
                                .Where(seat => seat.SeatType == SeatType.Moderate)
                                .Count();

            capacity.Premier = allSeats
                               .Where(seat => seat.SeatType == SeatType.Premier)
                               .Count();

            capacity.Total = allSeats.Count();

            return(capacity);
        }
        public SeatCapacity GetSeatsRemaining(int performanceId)
        {
            var capacity = new SeatCapacity();

            capacity.Budget = _reservationRepository.Collection()
                              .Where(res => res.PerformanceId == performanceId)
                              .Where(res => res.Seat.SeatType == SeatType.Budget)
                              .Where(res => res.IsTaken == false)
                              .Count();

            capacity.Moderate = _reservationRepository.Collection()
                                .Where(res => res.PerformanceId == performanceId)
                                .Where(res => res.Seat.SeatType == SeatType.Moderate)
                                .Where(res => res.IsTaken == false)
                                .Count();

            capacity.Premier = _reservationRepository.Collection()
                               .Where(res => res.PerformanceId == performanceId)
                               .Where(res => res.Seat.SeatType == SeatType.Premier)
                               .Where(res => res.IsTaken == false)
                               .Count();

            return(capacity);
        }
Exemple #6
0
        private SeatCapacity CountRemainingReservations(Performance performance)
        {
            SeatCapacity capacity = new SeatCapacity();

            return(reservationService.GetSeatsRemaining(performance.Id));
        }
Exemple #7
0
        private void Button3_Click(System.Object sender, System.EventArgs e)
        {
            //Try
            DialogResult res = MessageBox.Show("Do U Want To Cancel Waiting Booking?", "Cancel Booking?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res == DialogResult.Yes)
            {
                if (string.IsNullOrEmpty(BookingNo.Text.Trim()))
                {
                    MessageBox.Show("Give Booking No..");
                }
                else
                {
                    string CN2 = null;
                    con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=Bus_System;Integrated Security=True");
                    con.Open();
                    cmd = new SqlCommand("Select max(CancellationNo) From Cancellation", con);
                    dr  = cmd.ExecuteReader();
                    dr.Read();
                    if ((!object.ReferenceEquals(dr[0], DBNull.Value)))
                    {
                        t = Convert.ToInt32(dr[0]) + 1;
                    }
                    else
                    {
                        t = 1;
                    }
                    CN2 = t.ToString();
                    dr.Close();
                    cmd = new SqlCommand("Select * From APaymentPassenger Where BookingNo=" + BookingNo.Text + "", con);
                    dr  = cmd.ExecuteReader();
                    dr.Read();
                    string a1 = null;
                    string a2 = null;
                    string a3 = null;
                    string a4 = null;
                    string a5 = null;
                    string a6 = null;
                    string a7 = null;
                    a1 = dr.GetValue(0).ToString();
                    a2 = dr.GetValue(1).ToString();
                    a3 = dr.GetValue(2).ToString();
                    a4 = dr.GetValue(6).ToString();
                    a5 = dr.GetValue(7).ToString();
                    a6 = dr.GetValue(8).ToString();
                    a7 = dr.GetValue(9).ToString();
                    dr.Close();
                    cmd = new SqlCommand("Insert Into Cancellation Values(" + CN2 + ",'" + a1 + "','" + a2 + "','" + a3 + "','" + DateAndTime.Today + " " + DateAndTime.TimeOfDay + "','" + a4 + "','" + a5 + "','" + a6 + "','" + a7 + "','" + Strings.Format(Arrivaltime.Value, "hh:MM:ss tt") + "')", con);
                    cmd.ExecuteNonQuery();
                    cmd = new SqlCommand("Delete From APassengerDetails Where BookingNo=" + BookingNo.Text + "", con);
                    cmd.ExecuteNonQuery();
                    cmd = new SqlCommand("Delete From APaymentPassenger Where BookingNo=" + BookingNo.Text + "", con);
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Done");
                    con.Close();
                    DGV.Rows.Clear();
                    SeatCapacity.Clear();
                    BookingNo.Clear();
                    SC2.Clear();
                    SeatAvailability.Clear();
                    RadioButton1.Checked = false;
                    RadioButton2.Checked = false;
                }
            }
            else
            {
                MessageBox.Show("Not Cancelled");
            }
            //Catch ex As Exception
            //    MsgBox("Nothing Selected..!")
            //End Try
        }