Beispiel #1
0
        private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            gridControl2.DataSource = null;
            int intSelectRow = gridView1.FocusedRowHandle;

            if ((intSelectRow >= 0) && (intSelectRow < gridView1.RowCount))
            {
                string strDonHangID = gridView1.GetRowCellValue(intSelectRow, "PhieuNhapID").ToString();
                gridControl2.DataSource = PhieuNhapController.GetSanPham(strDonHangID); //DonHangController.GetSanPham(strDonHangID);
                gridView2.ExpandAllGroups();
                gridView2.BestFitColumns();
            }
        }
        private void frmAddPhieuNhap_Load(object sender, EventArgs e)
        {
            //KhoiTaoDuLieuSearch();
            //txtSanPham.Properties.DataSource = SanPhamController.GetActiveList();
            KhoiTaoLuoi();
            KhoiTaoDSNhaCungCap();
            //------------------------------------------
            dateEditNgayBan.DateTime        = DateTime.Now;
            txtNhanVien.Text                = Utility.NguoiSuDung.NguoiDungID;
            txtNhanVien.Properties.ReadOnly = true;
            txtMaPhieu.Properties.ReadOnly  = true;


            txtTienHang.Properties.ReadOnly = true;
            txtTienHang.Properties.DisplayFormat.FormatType    = DevExpress.Utils.FormatType.Numeric;
            txtTienHang.Properties.DisplayFormat.FormatString  = "# ##0";
            txtTienHang.Properties.Mask.UseMaskAsDisplayFormat = true;



            txtConNo.Properties.ReadOnly = true;
            txtConNo.Properties.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            txtConNo.Properties.DisplayFormat.FormatString = "# ##0";

            txtThanhToan.Properties.DisplayFormat.FormatType   = DevExpress.Utils.FormatType.Numeric;
            txtThanhToan.Properties.DisplayFormat.FormatString = "# ##0";

            //Chế độ view đơn hang
            if ((forMode.ToUpper().Equals("VIEW")) && (ViewItem != null))
            {
                txtMaPhieu.Text          = ViewItem.PhieuNhapID;
                dateEditNgayBan.DateTime = ViewItem.NgayNhap;
                if (ViewItem.NhaCungCapID != null)
                {
                    lookUpEditNhaCungCap.EditValue = ViewItem.NhaCungCapID;
                }
                txtNhanVien.Text   = ViewItem.NhanVienID;
                txtGhiChu.Text     = ViewItem.GhiChu;
                txtTienHang.Value  = ViewItem.TienHang;
                txtThanhToan.Value = ViewItem.ThanhToan;
                txtConNo.Value     = ViewItem.ConNo;

                //lay danh sach san pham
                gridControl1.DataSource = PhieuNhapController.GetSanPham(ViewItem.PhieuNhapID);

                btnSave.Enabled = false;
            }
        }