private void comboBoxMaKieu_SelectedIndexChanged(object sender, EventArgs e) { try { string id = comboBoxMaKieu.SelectedValue.ToString(); ChiTietSP ct = ChiTietSPBUS.GetChiTietSPOderByMaCHByIDKieuSP(textBoxMaCH.Text, id); if (ct != null) { textBoxSLTon.Text = ct.SoluongSP.ToString(); textboxGiaBan.Text = ct.Gia.ToString(); comboBoxMau.SelectedValue = ct.MaMau; try { pictureBox.BackgroundImage = ConverBinaryToImage(ct.Anh); } catch { pictureBox.BackgroundImage = null; } } else { textBoxSLTon.Text = ""; textboxGiaBan.Text = ""; } } catch { textBoxSLTon.Text = ""; textboxGiaBan.Text = ""; } }
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 comboBoxCHPP_SelectedIndexChanged(object sender, EventArgs e) { try { textBoxSLTonCHPP.Text = ""; string id = comboBoxCHPP.SelectedValue.ToString(); ChiTietSP ct = new ChiTietSP(); if (textBoxMaKieu.Text.Trim(' ') != "") { ct = ChiTietSPBUS.GetChiTietSPOderByMaCHByIDKieuSP(id, textBoxMaKieu.Text); } else { ct = null; } textBoxSLTonCHPP.Text = ct.SoluongSP.ToString(); } catch { } }
private void cmBoxMaKieuSP_SelectedIndexChanged(object sender, EventArgs e) { try { string id = cmBoxMaKieuSP.SelectedValue.ToString(); //ChiTietSP sp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id); if (IDMode == "ts") { ChiTietSP sp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(id); cmBoxMauSP.DataSource = ChiTietSPBUS.GetAllMauSP(); cmBoxMauSP.ValueMember = "MaMau"; cmBoxMauSP.DisplayMember = "Mau"; cmBoxMauSP.SelectedValue = sp.MaMau; txtBoxGiaSP.Text = sp.Gia.ToString(); txtboxSoLuongAll.Text = sp.SoluongSP.ToString(); //picBoxKieuSP.Image = null; picBoxKieuSP.BackgroundImage = null; textBoxPathAnh.Text = ""; //picBoxKieuSP.Image = ConverBinaryToImage(sp.Anh); picBoxKieuSP.BackgroundImage = ConverBinaryToImage(sp.Anh); } else { ChiTietSP sp = ChiTietSPBUS.GetChiTietSPOderByMaCHByIDKieuSP(IDMode, id); cmBoxMauSP.SelectedValue = sp.MaMau; txtBoxGiaSP.Text = sp.Gia.ToString(); txtboxSoLuongAll.Text = sp.SoluongSP.ToString(); //picBoxKieuSP.Image = null; picBoxKieuSP.BackgroundImage = null; textBoxPathAnh.Text = ""; //picBoxKieuSP.Image = ConverBinaryToImage(sp.Anh); picBoxKieuSP.BackgroundImage = ConverBinaryToImage(sp.Anh); } //cmBoxMauSP.SelectedValue = sp.MaMau; //txtBoxGiaSP.Text = sp.Gia.ToString(); //txtboxSoLuongAll.Text = sp.SoluongSP.ToString(); //picBoxKieuSP.Image = null; //textBoxPathAnh.Text = ""; //picBoxKieuSP.Image = ConverBinaryToImage(sp.Anh); } catch { } }