Ejemplo n.º 1
0
        private void btn_show_garage_Click(object sender, EventArgs e)
        {
            string  search_query = "Select * from ";
            string  TableName    = "Garage ;";
            methods m            = new methods();

            m.show_table_element(TableName, search_query, dataGrid_Garage);
        }
Ejemplo n.º 2
0
        private void btn_src_driver_Click(object sender, EventArgs e)
        {
            //string search_query = "Select Employee.[First Name] from";
            //string TableName = "Employee,Bus_Driver where Employee.E_id= Bus_Driver.E_id and Bus_Driver.Salary=1200;";
            string search_query = "Select Employee.[First Name] ,Employee.[Last Name],"
                                  + "Employee.Contact,Employee.E_Address as Location ,Bus_Driver.Salary from ";
            string  TableName = "Employee,Bus_Driver where Employee.E_id= Bus_Driver.E_id;";
            methods m         = new methods();

            m.show_table_element(TableName, search_query, DriverGrid);
        }
Ejemplo n.º 3
0
        private void btn_src_Bus_Click(object sender, EventArgs e)
        {
            string search_query = "Select Bus.Bus_number As [Bus Number],Employee.[First Name] as "
                                  + "[Current Driver Name],Seat_plan.[Number of Seat],Garage.[Garage Name],Garage.Place as "
                                  + "[Garage Place],Garage.Contact as [Garage Contact] from ";
            string TableName = "Bus,Employee,Bus_Driver,Seat_plan,Garage where "
                               + "Bus.G_id=Garage.G_id and Bus.Sp_id=Seat_plan.Sp_id "
                               + "and Bus.BD_id= Bus_Driver.BD_id and Bus_Driver.E_id=Employee.E_id ";
            methods m = new methods();

            m.show_table_element(TableName, search_query, BusDataGrid);
        }
Ejemplo n.º 4
0
        private void btn_src_info_ticket_Click(object sender, EventArgs e)
        {
            bool    bo  = false;
            string  sql = null;
            methods m   = new methods();

            if (comboBox_search_ticket.Text == "-----Pleade Select------")
            {
                MessageBox.Show("Pleade Select Search By");
                bo = true;
            }
            if (!bo)
            {
                if (comboBox_search_ticket.Text == "All")
                {
                    sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                          + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                          + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
                    string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                                  + "where Ticket.P_id=Passenger.P_id and Ticket.Ts_id=Ticket_seller.Ts_id and "
                                  + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                                  + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";
                    m.show_table_element(sql2, sql, dataGridView3);
                }
                if (comboBox_search_ticket.Text == "Ticket ID")
                {
                    sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                          + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                          + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
                    string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                                  + "where Ticket.P_id=Passenger.P_id and Ticket.T_id='" + textBox_src_ticket_info.Text + "' and Ticket.Ts_id=Ticket_seller.Ts_id and "
                                  + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                                  + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";
                    m.show_table_element(sql2, sql, dataGridView3);
                    MessageBox.Show("Search Complete");
                }
            }
        }
Ejemplo n.º 5
0
        private void Search_all_ticket_Click(object sender, EventArgs e)
        {
            string  sql = null;
            methods m   = new methods();

            sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                  + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                  + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
            string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                          + "where Ticket.P_id=Passenger.P_id and Ticket.Ts_id=Ticket_seller.Ts_id and "
                          + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                          + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";

            m.show_table_element(sql2, sql, dataGrid_admin_Ticket);
        }
Ejemplo n.º 6
0
        private void btn_add_garage_Click(object sender, EventArgs e)
        {
            string sql = null;



            sql = "Insert into Garage ([Garage Name],Contact,Place) values "
                  + "('" + txtBox_garage_name.Text + "','" + txtbox_contact.Text + "','" + txtBox_Place.Text + "');";
            methods m = new methods();

            m.single_tab_data_Insert(sql);

            string search_query = "Select * from ";
            string TableName    = "Garage order by Garage.G_id DESC;";

            m.show_table_element(TableName, search_query, dataGrid_Garage);
            //Select Garage.[Garage Name],Garage.Place,Garage.Contact from Garage order by Garage.G_id DESC;
        }
Ejemplo n.º 7
0
        private void btn_submit_Click(object sender, EventArgs e)
        {
            int cou;

            bool    bo = true;
            string  sql = null, member = null, P_id = null, Ts_id = null, BS_id = null, S_id = null, name_of_seat = null;
            methods m = new methods();

            sql = "select [Bus Management System].dbo.Shedule.S_id from [Bus Management System].dbo.Shedule where"
                  + "[Bus Management System].dbo.Shedule.S_Time='" + combo_bustime.Text + "' and"
                  + " [Bus Management System].dbo.Shedule.Ro_id=(select Road.Road_id from Road "
                  + "where Road.[Route Name]='" + combo_route.Text + "')";
            member = "S_id";
            S_id   = m.id_sender(sql, member);
            cou    = checkedListBox_admin_Seat.SelectedItems.Count;
            if (cou == 0)
            {
                MessageBox.Show("No Seat Selected");
                bo = false;
            }
            if (S_id == null)
            {
                MessageBox.Show("Wrong Schedule");
                bo = false;
            }
            if (combo_Gender.Text == "------- Please Select -----")
            {
                MessageBox.Show("Please Select a Gender");
                bo = false;
            }
            if (bo)
            {
                sql = "insert into Passenger (Name,Gender,Contact) values ('" + txtbox_name_pass.Text + "','" + combo_Gender.Text + "','" + textBox_contact_pass.Text + "')";
                m.single_tab_data_Insert(sql);
                sql    = "select TOP 1 P_id from Passenger  order by P_id DESC ;";
                member = "P_id";
                P_id   = m.id_sender(sql, member);
                // Console.WriteLine("PID::" + P_id);
                sql    = "select Ts_id from Ticket_seller where Ticket_seller.[User ID]='" + Aid + "'";
                member = "Ts_id";
                Ts_id  = m.id_sender(sql, member);

                sql = "(select BS_id from [Bus Management System].dbo.Bus_Shedule_manage where "
                      + "[Bus Management System].dbo.Bus_Shedule_manage.Date='" + dateTimePicker_ticket.Text + "' and "
                      + "[Bus Management System].dbo.Bus_Shedule_manage.S_id="
                      + "(select S_id from [Bus Management System].dbo.Shedule where "
                      + "[Bus Management System].dbo.Shedule.S_Time='" + combo_bustime.Text + "' and "
                      + "[Bus Management System].dbo.Shedule.Ro_id="
                      + "(select Road.Road_id from Road where Road.[Route Name]='" + combo_route.Text + "')))";
                member       = "BS_id";
                BS_id        = m.id_sender(sql, member);
                name_of_seat = checkedListBox_admin_Seat.SelectedItem.ToString();
                sql          = "insert into Ticket (Ticket.BS_id,[Name Of Seat],[No of Seat],Ticket.P_id,[Total Fare],Ticket.Ts_id) "
                               + "values ('" + BS_id + "','" + name_of_seat + "','1','" + P_id + "','" + textBox_total_fare.Text + "','" + Ts_id + "')";
                m.single_tab_data_Insert(sql);
                sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                      + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                      + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
                string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                              + "where Ticket.P_id=Passenger.P_id and Ticket.Ts_id=Ticket_seller.Ts_id and "
                              + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                              + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";
                m.show_table_element(sql2, sql, dataGrid_admin_Ticket);
                load_new_ticket_ID();
                MessageBox.Show("Ticket Purchased Successfully");

                //Console.WriteLine("cou::" + cou);
            }
        }