private void dgvHoaDon_CellClick(object sender, DataGridViewCellEventArgs e) { textBoxNSX.Visible = true; textBoxLoaiSP.Visible = true; textBoxDSP.Visible = true; textBoxMauKieu.Visible = true; textBoxMaKieuSP.Visible = true; textBoxSP.Visible = true; int r = dgvHoaDon.CurrentCell.RowIndex; string id = dgvHoaDon.Rows[r].Cells[1].Value.ToString(); USP_GETAllInfoSPNew_Result sp = ChiTietSPBUS.GetMaSPByMaKieuSP(id); textBoxNSX.Text = sp.TenHSX; textBoxLoaiSP.Text = sp.TenLSP; textBoxDSP.Text = sp.TenDong; textboxGiaBan.Text = dgvHoaDon.Rows[r].Cells[3].Value.ToString(); textBoxSLTon.Text = ChiTietSPBUS.GetChiTietSPOderByMaCHByIDKieuSP(textBoxMaCH.Text, id).SoluongSP.ToString(); textBoxMaKieuSP.Text = sp.MaKieu; textBoxTenSP.Text = sp.TenSP; textBoxSLMua.Text = dgvHoaDon.Rows[r].Cells[2].Value.ToString(); ChiTietSP ct = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id); textBoxSP.Text = ct.MaSP.ToString(); textBoxMauKieu.Text = ct.MaMau.ToString(); try { pictureBox.BackgroundImage = ConverBinaryToImage(ct.Anh); } catch { pictureBox.BackgroundImage = null; } }
private void dgvNhapHang_CellClick(object sender, DataGridViewCellEventArgs e) { try { txtboxHSX.Visible = true; txtBoxLSP.Visible = true; txtBoxDSP.Visible = true; txtboxGiaBan.Visible = true; txtBoxKieuSP.Visible = true; txtboxSP.Visible = true; txtboxGiaBan.ReadOnly = true; txtboxGiaNhap.ReadOnly = true; txtboxGiaBan.Visible = true; int r = dgvNhapHang.CurrentCell.RowIndex; string id = dgvNhapHang.Rows[r].Cells[0].Value.ToString(); USP_GETAllInfoSPNew_Result sp = ChiTietSPBUS.GetMaSPByMaKieuSP(id); txtboxHSX.Text = sp.TenHSX; txtBoxLSP.Text = sp.TenLSP; txtBoxDSP.Text = sp.TenDong; txtboxGiaBan.Text = sp.Gia.ToString(); txtBoxSLTon.Text = sp.SoluongSP.ToString(); txtBoxKieuSP.Text = sp.MaKieu; txtboxSP.Text = sp.TenSP; txtboxGiaNhap.Text = dgvNhapHang.Rows[r].Cells[2].Value.ToString(); textBoxSLNhap.Text = dgvNhapHang.Rows[r].Cells[1].Value.ToString(); } catch { } }