Exemplo n.º 1
0
        private void bunifuButton4_Click_1(object sender, EventArgs e)
        {
            DTO_vehicle r = new DTO_vehicle();

            if (bunifuTextBox1.Text == "" || bunifuTextBox2.Text == "" || bunifuTextBox3.Text == "" || bunifuTextBox4.Text == "" || bunifuDataGridView1.SelectedRows.Count != 1)
            {
                MessageBox.Show(" thông tin không chính xác");
            }
            else
            {
                r.id_vehicle = bunifuTextBox1.Text;
                r.type       = bunifuTextBox2.Text;
                r.name       = bunifuTextBox3.Text;

                r.number_seat = Convert.ToInt32(bunifuTextBox4.Text);
            }
            try
            {
                BLL_vehicle.Instance.edit(r);
                load();
            }
            catch (Exception l)
            {
                MessageBox.Show(" không thanh công");
            }
        }
Exemplo n.º 2
0
        public void deleteVehicle_DALL(DTO_vehicle s)
        {
            string querry = "update Vehicle set id_vehicle = '" + s.id_vehicle + "', type = '" + s.type
                            + "', name = '" + s.name + "', status_vehicle = '" + true + "', number_seat = '" + s.number_seat
                            + "' where id_vehicle = '" + s.id_vehicle + "'";

            DB_H.Instance.Ex(querry);
        }
Exemplo n.º 3
0
        public void updatevehiclebyid_vehicle(DTO_vehicle s)
        {
            string querry = "update Vehicle set id_vehicle = '" + s.id_vehicle + "', type = '" + s.type
                            + "', name = '" + s.name + "', status_vehicle = '" + false + "', number_seat = '" + s.number_seat
                            + "' where id_vehicle = '" + s.id_vehicle + "'";

            DB_H.Instance.Ex(querry);
        }
Exemplo n.º 4
0
        public void addvehicle_DAL(DTO_vehicle r)
        {
            string query = "insert into Vehicle values ('";

            query += r.id_vehicle + "', '" + r.type + "', '" + r.name + "', '" + r.number_seat + "','"
                     + false + "');";
            DB_H.Instance.Ex(query);
        }
Exemplo n.º 5
0
        public List <DTO_vehicle> sort(Compare cmp)
        {
            List <DTO_vehicle> data = BLL_vehicle.Instance.getallvehicle();

            for (int i = 0; i < data.Count - 1; i++)
            {
                for (int j = i + 1; j < data.Count; j++)
                {
                    if (cmp(data[i], data[j]))
                    {
                        DTO_vehicle t = data[i];
                        data[i] = data[j];
                        data[j] = t;
                    }
                }
            }
            return(data);
        }
Exemplo n.º 6
0
 public DTO_vehicle Getid_vehicle(string id_vehicle)
 {
     if (id_vehicle == null)
     {
         return(null);
     }
     else
     {
         DTO_vehicle s = new DTO_vehicle();
         foreach (DTO_vehicle i in DALL_vehicle.Instance.getallvehicle())
         {
             if (i.id_vehicle == id_vehicle)
             {
                 s = i;
             }
         }
         return(s);
     }
 }
Exemplo n.º 7
0
 private void bunifuButton3_Click_1(object sender, EventArgs e)
 {
     if (bunifuTextBox1.Text == "" || bunifuTextBox2.Text == "" || bunifuTextBox3.Text == "" || bunifuTextBox4.Text == "")
     {
         MessageBox.Show(" thông tin không đầy đủ");
     }
     else
     {
         DTO_vehicle r = new DTO_vehicle();
         r.id_vehicle  = bunifuTextBox1.Text;
         r.type        = bunifuTextBox2.Text;
         r.name        = bunifuTextBox3.Text;
         r.number_seat = Convert.ToInt32(bunifuTextBox4.Text);
         try
         {
             BLL_vehicle.Instance.add_vehicle(r);
             load();
         }
         catch (Exception l)
         {
             MessageBox.Show(" không thanh công");
         }
     }
 }
Exemplo n.º 8
0
 public void edit(DTO_vehicle s)
 {
     DALL_vehicle.Instance.updatevehiclebyid_vehicle(s);
 }
Exemplo n.º 9
0
 public void add_vehicle(DTO_vehicle s)
 {
     DALL_vehicle.Instance.addvehicle_DAL(s);
 }