private void TaiDuLieu() { DataTable dtLoaiSanPham = _LoaiSanPhamBUS.LayBangLoaiSanPham(); cboLoaiSP.DataSource = dtLoaiSanPham; cboLoaiSP.DisplayMember = "TenLoaiSanPham"; cboLoaiSP.ValueMember = "MaLoaiSanPham"; DataTable dtHangSanXuat = _HangSanXuatBUS.LayBangHangSanXuat(); cboHSX.DataSource = dtHangSanXuat; cboHSX.DisplayMember = "TenHangSanXuat"; cboHSX.ValueMember = "MaHangSanXuat"; if (strMaSP != null) { dtSanPham = _SanPhamBUS.LayBangSanPham(strMaSP); txtTenSP.Text = dtSanPham.Rows[0]["TenSanPham"].ToString(); txtDonViTinh.Text = dtSanPham.Rows[0]["DonViTinh"].ToString(); numBH.Value = Convert.ToInt16(dtSanPham.Rows[0]["BaoHanh"].ToString()); txtGiaMua.Text = dtSanPham.Rows[0]["GiaMua"].ToString(); txtGiaBan.Text = dtSanPham.Rows[0]["GiaBan"].ToString(); TienIch.DinhDangSoTextBox(txtGiaBan); TienIch.DinhDangSoTextBox(txtGiaMua); txtKhuyenMai.Text = dtSanPham.Rows[0]["KhuyenMai"].ToString(); cboLoaiSP.SelectedValue = dtSanPham.Rows[0]["MaLoaiSanPham"].ToString(); cboHSX.SelectedValue = dtSanPham.Rows[0]["MaHangSanXuat"].ToString(); rtbMota.Text = dtSanPham.Rows[0]["MoTa"].ToString(); txtGhiChu.Text = dtSanPham.Rows[0]["GhiChu"].ToString(); picHinh.Image = new Bitmap(dtSanPham.Rows[0]["Hinh"].ToString()); lblSL.Text = dtSanPham.Rows[0]["SoLuong"].ToString(); } }
private void TaiDuLieu() { dtSanPham = _SanPhamBUS.LayBangSanPham(); foreach (DataRow dr in dtSanPham.Rows) { dr["GiaBan"] = Convert.ToDecimal(dr["GiaBan"]) - (Convert.ToDecimal(dr["GiaBan"]) / 100 * Convert.ToInt16(dr["KhuyenMai"])); } dvSanPham = new DataView(dtSanPham); dgvSanPham.DataSource = dvSanPham; }
public frmThemSLSP(string strMaSP, int iSLMua, Loai loai) { InitializeComponent(); this.strMaSP = strMaSP; dtSP = _SanPhamBUS.LayBangSanPham(strMaSP); picHinh.Image = new Bitmap(dtSP.Rows[0]["Hinh"].ToString()); lblTenSP.Text = dtSP.Rows[0]["TenSanPham"].ToString(); this.iSLMua = iSLMua; this.loai = loai; if (loai == Loai.ChinhSua || loai == Loai.ChinhSuaMua) { numSL.Value = iSLMua; } }
private void TaiDuLieu() { dtSanPham = _SanPhamBUS.LayBangSanPham(); dvSanPham = new DataView(dtSanPham); dgvSanPham.DataSource = dvSanPham; dtLoaiSanPham = _LoaiSanPhamBUS.LayBangLoaiSanPham(); cboLoaiSP.DataSource = dtLoaiSanPham; cboLoaiSP.DisplayMember = "TenLoaiSanPham"; cboLoaiSP.ValueMember = "MaLoaiSanPham"; dtHangSanXuat = _HangSanXuatBUS.LayBangHangSanXuat(); cboHSX.DataSource = dtHangSanXuat; cboHSX.DisplayMember = "TenHangSanXuat"; cboHSX.ValueMember = "MaHangSanXuat"; }
private void TaiDuLieu() { dtSanPham = _SanPhamBUS.LayBangSanPham(); dtSanPham.Columns.Add("TongTriGia", typeof(System.Int64)); long lSL = 0; long lTongTriGia = 0; foreach (DataRow dr in dtSanPham.Rows) { dr["TongTriGia"] = Convert.ToInt64(dr["SoLuong"]) * Convert.ToInt64(dr["GiaMua"]); } foreach (DataRow dr in dtSanPham.Rows) { lSL += Convert.ToInt64(dr["SoLuong"]); lTongTriGia += Convert.ToInt64(dr["TongTriGia"]); } txtTongSL.Text = lSL.ToString(); txtTongTriGia.Text = TienIch.ChuyenSoSangVND(lTongTriGia); dgvTonKho.DataSource = dtSanPham; }
private void TaiDuLieu() { dtSanPham = _SanPhamBUS.LayBangSanPham(); dgvSanPham.DataSource = dtSanPham; }