private void btnSua_Click(object sender, EventArgs e) { if (lvwGiay.SelectedItems.Count > 0) { ListViewItem item = lvwGiay.SelectedItems[0]; DTO_Giay dtoGiay = new DTO_Giay(); dtoGiay.maGiay = item.SubItems[2].Text; dtoGiay.TenGiay = item.SubItems[3].Text; dtoGiay.moTa = item.SubItems[6].Text; dtoGiay.soLuong = int.Parse(item.SubItems[8].Text); dtoGiay.gia = float.Parse(item.SubItems[9].Text); DTO_GioiTinh dtoGioiTinh = new DTO_GioiTinh(); DTO_ThuongHieu dtoThuongHieu = new DTO_ThuongHieu(); DTO_KhuyenMai dtoKhuyenMai = new DTO_KhuyenMai(); dtoGioiTinh.tenGioiTinh = item.SubItems[4].Text; dtoThuongHieu.tenThuongHieu = item.SubItems[5].Text; dtoKhuyenMai.phanTramGiamGia = float.Parse(item.SubItems[7].Text); Tool_SuaGiay toolSuaGiayy = new Tool_SuaGiay(dtoGiay, dtoGioiTinh, dtoThuongHieu, dtoKhuyenMai); toolSuaGiayy.ShowDialog(); if (toolSuaGiayy.isClickSua) { loadDataGiay(); } } }
public Tool_SuaGiay(DTO_Giay dtoGiay, DTO_GioiTinh dtoGioiTinh, DTO_ThuongHieu dtoThuongHieu, DTO_KhuyenMai dtoKhuyenMai) { InitializeComponent(); this.dtoGiay = dtoGiay; this.dtoGioiTinh = dtoGioiTinh; this.dtoThuongHieu = dtoThuongHieu; this.dtoKhuyenMai = dtoKhuyenMai; isClickSua = false; }
public void loadGioiTinh() { List <DTO_GioiTinh> gioiTinhs = new List <DTO_GioiTinh>(); foreach (DataRow row in busGioiTinh.getAllGioiTinh().Rows) { DTO_GioiTinh gt = new DTO_GioiTinh(); gt.maGioiTinh = row["MAGIOITINH"].ToString(); gt.tenGioiTinh = row["TENGIOITINH"].ToString(); gioiTinhs.Add(gt); } cbbGioiTinh.DataSource = gioiTinhs; cbbGioiTinh.DisplayMember = "tenGioiTinh"; }
private void btnSua_Click(object sender, EventArgs e) { if (lvwGioiTinh.SelectedItems.Count > 0) { ListViewItem item = lvwGioiTinh.SelectedItems[0]; DTO_GioiTinh dtoGioiTinh = new DTO_GioiTinh(); dtoGioiTinh.maGioiTinh = item.SubItems[1].Text; dtoGioiTinh.tenGioiTinh = item.SubItems[2].Text; dtoGioiTinh.moTa = item.SubItems[3].Text; Tool_SuaGioiTinh toolSuaGioiTinh = new Tool_SuaGioiTinh(dtoGioiTinh); toolSuaGioiTinh.ShowDialog(); if (toolSuaGioiTinh.isClickSua) { loadDataGioiTinh(); } } }
public bool addGioiTinh(DTO_GioiTinh dtoGioiTinh) { String SQLInsert = "INSERT INTO GIOITINH (MAGIOITINH, TENGIOITINH, MOTA) " + "VALUES(@MAGIOITINH, @TENGIOITINH, @MOTA)"; try { conn = new DBConnection().getConnection(); conn.Open(); SqlCommand sqlCommand = new SqlCommand(SQLInsert, conn); sqlCommand.Parameters.AddWithValue("MAGIOITINH", dtoGioiTinh.maGioiTinh); sqlCommand.Parameters.AddWithValue("TENGIOITINH", dtoGioiTinh.tenGioiTinh); sqlCommand.Parameters.AddWithValue("MOTA", dtoGioiTinh.moTa); sqlCommand.ExecuteNonQuery(); conn.Close(); return(true); } catch (Exception e) { e.ToString(); return(false); } }
public bool editGioiTinh(DTO_GioiTinh dtoGioiTinh) { String SQLUpdate = "UPDATE GIOITINH " + "SET TENGIOITINH = @TENGIOITINH, MOTA = @MOTA " + "WHERE MAGIOITINH = @MAGIOITINH"; try { conn = new DBConnection().getConnection(); conn.Open(); SqlCommand sqlCommand = new SqlCommand(SQLUpdate, conn); sqlCommand.Parameters.AddWithValue("TENGIOITINH", dtoGioiTinh.tenGioiTinh); sqlCommand.Parameters.AddWithValue("MOTA", dtoGioiTinh.moTa); sqlCommand.Parameters.AddWithValue("MAGIOITINH", dtoGioiTinh.maGioiTinh); sqlCommand.ExecuteNonQuery(); conn.Close(); return(true); } catch (Exception e) { e.ToString(); return(false); } }
public Tool_SuaGioiTinh(DTO_GioiTinh dtoGioiTinh) { InitializeComponent(); this.dtoGioiTinh = dtoGioiTinh; this.isClickSua = false; }
public bool editGioiTinh(DTO_GioiTinh dtoGioiTinh) { return(dalGioiTinh.editGioiTinh(dtoGioiTinh)); }
public bool addGioiTinh(DTO_GioiTinh dtoGioiTinh) { return(dalGioiTinh.addGioiTinh(dtoGioiTinh)); }