public void deletedelRoute_DALL(DTO_delRoute_xl s) { string querry = "update DetailRoute set id_detroute = '" + s.id_delroute + "',id_route= '" + s.id_route + "', id_vehicle='" + s.id_vehicle + "', date='" + s.date + "',price='" + s.price + "',time_start='" + s.time_start + "',deleted='" + true + "' where id_detroute = '" + s.id_delroute + "'"; DB_H.Instance.Ex(querry); }
public void adddelroute_DAL(DTO_delRoute_xl r) { string query = "insert into DetailRoute values ('"; query += r.id_delroute + "', '" + r.id_route + "', '" + r.id_vehicle + "', '" + r.date + "','" + r.price + "','" + r.time_start + "','" + false + "');"; DB_H.Instance.Ex(query); }
public DTO_delRoute_xl GetsvByid_detroute(string id_delroute) { if (id_delroute == null) { return(null); } else { DTO_delRoute_xl s = new DTO_delRoute_xl(); foreach (DTO_delRoute_xl i in DAL_DelRoute.Instance.getalldelroute_xl()) { if (i.id_delroute == id_delroute) { s = i; } } return(s); } }
private void bunifuButton1_Click_1(object sender, EventArgs e) { int i = 0; DTO_delRoute_xl s = new DTO_delRoute_xl(); s.id_delroute = bunifuTextBox1.Text; if (bunifuDropdown1.Text == "Route" && bunifuDropdown2.Text == "Vehicle") { MessageBox.Show("bạn chua chon truong thich hop"); i++; } else { s.id_route = ((CBBitem)bunifuDropdown1.SelectedItem).Value; s.id_vehicle = ((CBBitem)bunifuDropdown2.SelectedItem).Value; } try { s.time_start = Convert.ToDateTime(bunifuTextBox2.Text); } catch (Exception loi1) { MessageBox.Show("gia tri thời gian không hơp le"); i++; } try { s.price = Convert.ToDouble(bunifuTextBox3.Text); } catch (Exception loi) { MessageBox.Show("gia tri không hop le"); i++; } s.date = bunifuDatePicker1.Value; if (i == 0) { BLL_delRoute.Instance.execute(s); d(((CBBitem)bunifuDropdown1.SelectedItem).Value, ""); } }
public void execute(DTO_delRoute_xl s) { bool check = false; foreach (DTO_delRoute_xl i in DAL_DelRoute.Instance.getalldelroute_xl()) { if (i.id_delroute == s.id_delroute) { check = true; } } if (check) { DAL_DelRoute.Instance.updatedelRoutebyid_delroute(s); } else { DAL_DelRoute.Instance.adddelroute_DAL(s); } }
public void setGui() { List <DTO_route> list = BLL_Route.Instance.getallRoute(); foreach (var i in list) { bunifuDropdown1.Items.Add(new CBBitem { Value = i.id_route, Text = i.departure + "-" + i.arrival }); } List <DTO_vehicle> list1 = BLL_vehicle.Instance.getallvehicle(); foreach (var i in list1) { bunifuDropdown2.Items.Add(new CBBitem { Value = i.id_vehicle, Text = i.name }); } if (BLL_delRoute.Instance.GetsvByid_detroute(id_detroute) != null) { DTO_delRoute_xl dd = new DTO_delRoute_xl(); dd = BLL_delRoute.Instance.GetsvByid_detroute(id_detroute); bunifuTextBox1.Text = dd.id_delroute; bunifuTextBox2.Text = dd.time_start.ToLongTimeString(); bunifuTextBox3.Text = dd.price.ToString(); bunifuDatePicker1.Value = dd.date; bunifuDropdown1.SelectedIndex = Convert.ToInt32(dd.id_route) - 1; bunifuDropdown2.SelectedIndex = Convert.ToInt32(dd.id_vehicle) - 1; if (bunifuTextBox1.Text != "") { bunifuTextBox1.ReadOnly = true; } bunifuDropdown1.DropDownStyle = ComboBoxStyle.DropDownList; bunifuDropdown2.DropDownStyle = ComboBoxStyle.DropDownList; } }