示例#1
0
        //Wpf loaded
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            cboNCC.ItemsSource    = SanPhamBusiness.LayNCC();
            cboDonVi.ItemsSource  = SanPhamBusiness.LayDVT();
            cboNhomSP.ItemsSource = SanPhamBusiness.LayNSP();

            //Hiển thị
            txtMaSP.IsEnabled       = false;
            txtMaSP.Text            = _sp.MaSP_SP;
            txtTenSP.Text           = _sp.TenSP_SP;
            cboNhomSP.SelectedValue = _sp.NSP_SP.MaNSP_NSP;
            cboNCC.SelectedValue    = _sp.NCC_SP.MaNCC_NCC;
            txtGiaNhap.Text         = UntilitiesBusiness.ThemDauPhay(_sp.GiaNhap_SP);
            txtGiaBanLe.Text        = UntilitiesBusiness.ThemDauPhay(_sp.GiaBanLe_SP);
            txtGiaBanSi.Text        = UntilitiesBusiness.ThemDauPhay(_sp.GiaBanSi_SP);
            cboDonVi.SelectedValue  = _sp.DVT_SP.MaDVT_DVT;
            txtChietKhau.Text       = _sp.CKPhanTram_SP.ToString();

            FlowDocument fDoc = new FlowDocument();

            fDoc.Blocks.Add(new Paragraph(new Run(_sp.GhiChu_SP)));
            rtxtGhiChu.Document = fDoc;

            if (System.IO.File.Exists(_sp.Anh_SP))
            {
                BitmapImage _bit = new BitmapImage(new Uri(_sp.Anh_SP));
                picSP.Source = _bit;
            }
        }
        //Wpf loaded
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //_sp.MaSP_SP = UntilitiesBusiness.GetNextID("tbl_SANPHAM", "MaSP_SP", "SP.", 5);

            //Hiển thị
            txtMaSP.Text      = _sp.MaSP_SP;
            txtMaSP.IsEnabled = true;
            txtTenSP.Focus();

            cboNCC.ItemsSource   = SanPhamBusiness.LayNCC();
            cboDonVi.ItemsSource = SanPhamBusiness.LayDVT();

            List <NhomSanPhamPublic> _lstNSP = SanPhamBusiness.LayNSP();

            if (_lstNSP.Count == 0)
            {
                MessageBox.Show("Tạo nhóm sản phẩm.");
                this.Close();
            }
            cboNhomSP.ItemsSource = _lstNSP;
        }