private void bunifuButton3_Click_1(object sender, EventArgs e) { DTO_route r = new DTO_route(); if (bunifuTextBox1.Text == "" || bunifuTextBox2.Text == "" || bunifuTextBox3.Text == "") { MessageBox.Show(" thông tin không đầy đủ"); } else { r.id_route = bunifuTextBox1.Text; r.departure = bunifuTextBox2.Text; r.arrival = bunifuTextBox3.Text; r.deleted = false; try { BLL_Route.Instance.add_route(r); load(); } catch (Exception l) { MessageBox.Show(" không thanh công"); } } }
private void bunifuButton4_Click_1(object sender, EventArgs e) { DTO_route r = new DTO_route(); if (bunifuTextBox1.Text == "" || bunifuTextBox2.Text == "" || bunifuTextBox3.Text == "" || bunifuDataGridView1.SelectedRows.Count != 1) { MessageBox.Show(" thông tin không chính xác"); } else { r.id_route = bunifuTextBox1.Text; r.departure = bunifuTextBox2.Text; r.arrival = bunifuTextBox3.Text; r.deleted = false; try { BLL_Route.Instance.edit(r); load(); } catch (Exception l) { MessageBox.Show(" không thanh công"); } } }
public void deleteRoute_DALL(DTO_route s) { string querry = "update Route set id_route = '" + s.id_route + "', departure = '" + s.departure + "', arrival = '" + s.arrival + "', deleted = '" + true + "' where id_route = '" + s.id_route + "'"; DB_H.Instance.Ex(querry); }
public void updateRoutebyid_route(DTO_route s) { string querry = "update Route set id_route = '" + s.id_route + "', departure = N'" + s.departure + "', arrival = N'" + s.arrival + "', deleted = '" + false + "' where id_route = '" + s.id_route + "'"; DB_H.Instance.Ex(querry); }
public void addroute_DAL(DTO_route r) { string query = "insert into Route values ('"; query += r.id_route + "', N'" + r.departure + "', N'" + r.arrival + "', '" + false + "');"; DB_H.Instance.Ex(query); }
public List <DTO_route> sort(Compare cmp) { List <DTO_route> data = BLL_Route.Instance.getallRoute(); 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_route t = data[i]; data[i] = data[j]; data[j] = t; } } } return(data); }
public DTO_route Getid_route(string id_route) { if (id_route == null) { return(null); } else { DTO_route s = new DTO_route(); foreach (DTO_route i in DALL_route.Instance.getallroute()) { if (i.id_route == id_route) { s = i; } } return(s); } }
public void edit(DTO_route s) { DALL_route.Instance.updateRoutebyid_route(s); }
public void add_route(DTO_route s) { DALL_route.Instance.addroute_DAL(s); }