private void btnThemKhachHang_Click(object sender, EventArgs e) { FrmNhapKhachHang frm = new FrmNhapKhachHang(); frm.btnThemKhachHang.Tag = "add"; string strMaKhachHang = cf.CreateId("KHA", "KHACHHANG"); frm.txtMaKH.Text = strMaKhachHang; frm.ShowDialog(); LoadCMBKhachHang(); }
private void btnThem_Click(object sender, EventArgs e) { try { FrmNhapKhachHang frmNhapKhachHang = new FrmNhapKhachHang(); frmNhapKhachHang.btnThemKhachHang.Tag = "add"; string strMaKH = cf.CreateId("KHA", "KHACHHANG"); frmNhapKhachHang.txtMaKH.Text = strMaKH.ToString(); frmNhapKhachHang.ShowDialog(); } catch { } }
private void btnCapNhat_Click(object sender, EventArgs e) { try { FrmNhapKhachHang frmNhapKhachHang = new FrmNhapKhachHang(); frmNhapKhachHang.btnThemKhachHang.Tag = "up"; int index = dgvKhachHang.SelectedRows[0].Index; string strMaKH = dgvKhachHang.Rows[index].Cells["colMaKhachHang"].Value.ToString(); frmNhapKhachHang.txtMaKH.Text = strMaKH; string strTen = dgvKhachHang.Rows[index].Cells["colTenKhachHang"].Value.ToString(); frmNhapKhachHang.txtTenKhachHang.Text = strTen; string strSoTaiKhoan = dgvKhachHang.Rows[index].Cells["colSoTaiKhoan"].Value.ToString(); if (strSoTaiKhoan == "") { strSoTaiKhoan = " Không có thông tin."; frmNhapKhachHang.txtSoTaiKhoan.Text = strSoTaiKhoan; } else { frmNhapKhachHang.txtSoTaiKhoan.Text = strSoTaiKhoan; } string strNganHang = dgvKhachHang.Rows[index].Cells["colNganHang"].Value.ToString(); if (strNganHang == "") { strNganHang = " Không có thông tin."; frmNhapKhachHang.txtNganHang.Text = strNganHang; } else { frmNhapKhachHang.txtNganHang.Text = strNganHang; } string strMaSoThue = dgvKhachHang.Rows[index].Cells["colMaSoThue"].Value.ToString(); if (strMaSoThue == "") { strMaSoThue = " Không có thông tin."; frmNhapKhachHang.txtMaSoThue.Text = strMaSoThue; } else { frmNhapKhachHang.txtMaSoThue.Text = strMaSoThue; } int intSoDienThoai = 0; if (dgvKhachHang.Rows[index].Cells["colSoDienThoai"].Value.ToString() == "") { intSoDienThoai = 0000000; } else { intSoDienThoai = int.Parse(dgvKhachHang.Rows[index].Cells["colSoDienThoai"].Value.ToString()); frmNhapKhachHang.txtDienThoai.Value = intSoDienThoai; } string strEmail = dgvKhachHang.Rows[index].Cells["colEmail"].Value.ToString(); if (strEmail == "") { strEmail = " Không có thông tin."; frmNhapKhachHang.txtEmail.Text = strEmail; } else { frmNhapKhachHang.txtEmail.Text = strEmail; } string strDiaChi = dgvKhachHang.Rows[index].Cells["colDiaChi"].Value.ToString(); if (strDiaChi == "") { strDiaChi = " Không có thông tin."; frmNhapKhachHang.txtDiaChi.Text = strDiaChi; } else { frmNhapKhachHang.txtDiaChi.Text = strDiaChi; } string strGhiChu = dgvKhachHang.Rows[index].Cells["colGhiChu"].Value.ToString(); if (strGhiChu == "") { strGhiChu = " Không có thông tin."; frmNhapKhachHang.txtGhiChu.Text = strGhiChu; } else { frmNhapKhachHang.txtGhiChu.Text = strGhiChu; } frmNhapKhachHang.ShowDialog(); LoadKhachHang(); } catch { } }