Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            reporttrips.Visible = true;
            dataGridView1.Rows.Clear();

            string cname = "";
            string dname = "";

            //string plateno,colorr,yearr,modell;
            for (int i = 0; i < Form0.loadData.List_Client.Count; i++)
            {
                if (Form0.loadData.client_Trips.ContainsKey(Form0.loadData.List_Client[i].get_id()) == true)
                {
                    cname = Form0.loadData.List_Client[i].get_name();
                    List <Trips> T = new List <Trips>();
                    T = Form0.loadData.client_Trips[Form0.loadData.List_Client[i].get_id()];

                    for (int j = 0; j < T.Count; j++)
                    {
                        for (int k = 0; k < Form0.loadData.List_Driver.Count; k++)
                        {
                            if (T[j].getid() == Form0.loadData.List_Driver[k].getDriverId())
                            {
                                dname = Form0.loadData.List_Driver[k].getDriverName();
                                break;
                            }
                        }
                        Cars carr = new Cars();

                        carr = Form0.loadData.Cars_Data[T[j].getid()];

                        dataGridView1.Rows.Add(cname, dname, T[j].getSource(), T[j].getDestination(), T[j].getPrice(),
                                               T[j].getDate(), carr.getPlateNo(), carr.getModel(), carr.getColor(), carr.getYear());
                    }
                }
            }
        }
Beispiel #2
0
        private void button5_Click_1(object sender, EventArgs e)
        {
            newcar.Visible      = false;
            newdriver.Visible   = false;
            reporttrips.Visible = false;
            string Model, colour, Year, plate, id;

            plate  = plateno.Text;
            colour = color.Text;
            Year   = year.Text;
            Model  = model.Text;
            id     = iddd.Text;
            if (plate.Length == 0 || colour.Length == 0 || Year.Length == 0 || Model.Length == 0)
            {
                MessageBox.Show("Please complete the new Car information");
            }
            if (Form0.loadData.Cars_Data.ContainsKey(int.Parse(id)) == true)
            {
                MessageBox.Show("Driver id has a car already");
                plateno.Clear();
                color.Clear();
                year.Clear();
                model.Clear();
                iddd.Clear();
            }
            else
            {
                Cars c1 = new Cars(plate, colour, int.Parse(Year), Model);
                Form0.loadData.Cars_Data.Add(int.Parse(id), c1);
                plateno.Clear();
                color.Clear();
                year.Clear();
                model.Clear();
                iddd.Clear();
            }
        }