private void btnxoa_Click(object sender, EventArgs e) { if (txtmahoadon.Text.Trim() != "") { DialogResult kq = MessageBox.Show("Bạn Chắc Chắc Muốn Xóa Mã Hóa Đơn : " + txtmahoadon.Text.Trim() + " !", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (kq == DialogResult.Yes) { DTO_HoaDon hoadon = new DTO_HoaDon(); hoadon.ma_hoa_don = txtmahoadon.Text.Trim(); int i = new BLL_HoaDon()._Xoa_Hoa_Don_Van_Chuyen(hoadon); if (i == 0) { MessageBox.Show("Xóa Hóa Đơn Thành Công !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); _List_View_Hoa_Don(); lvchitiethoadon.Items.Clear(); } else { MessageBox.Show("Xóa Hóa Đơn Thất Bại !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { MessageBox.Show("Bạn Chưa Chọn Hóa Đơn Cần Xóa !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnthem_Click(object sender, EventArgs e) { string message = ""; if (txtmakhachhang.Text.Trim() == "") { message += "Chưa Nhập Mã Khách Hàng "; } if (cbmahopdong.Text.Trim() == "") { message += string.IsNullOrEmpty(message) ? "" : "-" + " Chưa Nhập Mã Hợp Đồng "; } if (txtmahoadon.Text.Trim() == "") { message += string.IsNullOrEmpty(message) ? "" : "-" + " Chưa Nhập Mã Hóa Đơn "; } if (message == "") { DTO_HopDong hopdong = new DTO_HopDong(); hopdong.ma_hop_dong = cbmahopdong.Text.Trim(); hopdong.ma_khach_hang = txtmakhachhang.Text.Trim(); DTO_HoaDon hoadon = new DTO_HoaDon(); hoadon.ma_hoa_don = txtmahoadon.Text.Trim(); hoadon.ngay_Xuat_hoa_don = dtvngayxuathoadon.Value; int i = new BLL_HoaDon()._Lap_Hoa_Hon_Van_Chuyen(hopdong, hoadon); if (i == 0) { MessageBox.Show("Lập Hóa Đơn Thành Công !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); _List_View_Hoa_Don(); txtmahoadon.Text = new BLL_HoaDon()._Ma_Hoa_Don(); } if (i == 1) { MessageBox.Show("Lập Hóa Đơn Thất Bại !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (i == 2) { MessageBox.Show("Mã Hóa Đã Tồn Tại Không Thể Lập Hóa Đơn.Vui Lòng Chọn Mã Hóa Đơn Mới !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (message != "") { MessageBox.Show("Bạn " + message + " !", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void mntsxoalv_Click(object sender, EventArgs e) { DialogResult kq = MessageBox.Show("Bạn Chắc Chắc Muốn Xóa Hóa Đơn!", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (kq == DialogResult.Yes) { foreach (ListViewItem item in lvhoadon.Items) { if (item.Selected) { DTO_HoaDon hoadon = new DTO_HoaDon(); hoadon.ma_hoa_don = item.SubItems[1].Text; int i = new BLL_HoaDon()._Xoa_Hoa_Don_Van_Chuyen(hoadon); if (i == 0) { } } } _List_View_Hoa_Don(); lvchitiethoadon.Items.Clear(); } }