private void btn_laphoadon_Click(object sender, EventArgs e) { Frm_KhachHang fm = new Frm_KhachHang(); delPassData del = new delPassData(fm.funData); del(this.txt_tongtien, this.txt_sdt); MessageBox.Show("Thanh toán hóa đơn thành công", "Thông báo", MessageBoxButtons.OK); fm.ShowDialog(); MaTuDongTang(); for (int i = 0; i < dgv_danhsachspban.Rows.Count; i++) { string SoHD = dgv_danhsachspban.Rows[i].Cells["SoHD"].Value.ToString(); string TenKH = txt_tenkh.Text.ToString(); string SDT = txt_sdt.Text.ToString(); string MaSP = dgv_danhsachspban.Rows[i].Cells["MaSP"].Value.ToString(); string TenSP = dgv_danhsachspban.Rows[i].Cells["TenSP"].Value.ToString(); string LoaiSP = dgv_danhsachspban.Rows[i].Cells["LoaiSP"].Value.ToString(); int SoLuong = Convert.ToInt32(dgv_danhsachspban.Rows[i].Cells["SoLuongBan"].Value.ToString()); int DonGia = Convert.ToInt32(dgv_danhsachspban.Rows[i].Cells["DonGia"].Value.ToString()); string NgayLap = dgv_danhsachspban.Rows[i].Cells["NgayLap"].Value.ToString(); try { SqlHelper.ExecuteNonQuery(strCon, "BanHang_Insert", SoHD, TenKH, SDT, MaSP, TenSP, LoaiSP, SoLuong, DonGia, NgayLap); SqlHelper.ExecuteNonQuery(strCon, "ProductAfterSell_Update", MaSP, SoLuong); } catch (Exception ex) { MessageBox.Show("Lỗi" + ex.Message, "Thông Báo"); } } }
private void button1_Click(object sender, EventArgs e) { Frm_KhachHang khachhang = new Frm_KhachHang(); khachhang.Show(); dgv_danhsachspban.Refresh(); }
private void quảnLýKháchHàngToolStripMenuItem_Click(object sender, EventArgs e) { if (!CheckExistForm("Frm_KhachHang")) { Frm_KhachHang fm_KH = new Frm_KhachHang(); fm_KH.MdiParent = this; fm_KH.Show(); } else { ActiveChildForm("Frm_KhachHang"); } }