/// <summary>
        /// Ánh xạ từ đối tượng Document sang đối tượng DocumentViewModel
        /// </summary>
        /// <param name="documentViewModel"></param>
        /// <returns>Document</returns>
        /// Tạo bởi: NBDUONG(20/6/2019)
        public DocumentViewModel MapDocumentToDocumentViewModel(Document document)
        {
            var documentViewModel = new DocumentViewModel();
            var personBL          = new PersonBL();
            var employeeBL        = new EmployeeBL();
            var documentTypeBL    = new DocumentTypeBL();

            documentViewModel.DocumentID       = document.DocumentID;
            documentViewModel.DocumentCode     = document.DocumentCode;
            documentViewModel.DocumentDate     = document.DocumentDate;
            documentViewModel.TotalMoney       = document.TotalMoney;
            documentViewModel.Reason           = document.Reason;
            documentViewModel.DocumentAddress  = document.DocumentAddress;
            documentViewModel.ReceiverName     = document.ReceiverName;
            documentViewModel.DocumentTypeName = documentTypeBL.GetDocumentTypeByID(document.DocumentTypeID).DocumentTypeName;
            documentViewModel.PersonName       = personBL.GetPersonByID(document.PersonID).PersonName;
            documentViewModel.PersonCode       = personBL.GetPersonByID(document.PersonID).PersonCode;
            documentViewModel.EmployeeCode     = employeeBL.GetEmployeeByID(document.EmployeeID).EmployeeCode;
            documentViewModel.EmployeeName     = employeeBL.GetEmployeeByID(document.EmployeeID).EmployeeName;
            documentViewModel.MoneyHasToPay    = document.MoneyHasToPay;
            documentViewModel.MoneyHasNotPaid  = document.MoneyHasNotPaid;
            documentViewModel.AmountPaid       = document.AmountPaid;
            documentViewModel.IsPaid           = document.IsPaid;
            documentViewModel.CheckType        = document.CheckType;
            documentViewModel.DocumentTypeID   = document.DocumentTypeID;
            documentViewModel.PersonID         = document.PersonID;
            documentViewModel.EmployeeID       = document.EmployeeID;

            return(documentViewModel);
        }
Beispiel #2
0
        /// <summary>
        /// Hàm chuyển từ bản ghi Fund sang FundViewModel
        /// </summary>
        /// <param name="fund">phiếu thu</param>
        /// <returns></returns>
        /// Created by NVMANH 24/7/2019
        public FundViewModels MapFundToFundViewModel(Fund fund)
        {
            var fundViewModel = new FundViewModels();
            var employeeBL    = new EmployeeBL();
            var supplierBL    = new SupplierBL();
            var supplierID    = fund.SupplierID;
            var employeeID    = fund.EmployeeID;

            fundViewModel.FundID            = fund.FundID;
            fundViewModel.SupplierCode      = supplierBL.GetSupplierByIDBL(supplierID).SupplierCode;
            fundViewModel.FundTypeVoucher   = fund.FundTypeVoucher;
            fundViewModel.FundMoney         = fund.FundMoney;
            fundViewModel.FundObject        = fund.FundObject;
            fundViewModel.SupplierName      = supplierBL.GetSupplierByIDBL(supplierID).SupplierName;
            fundViewModel.SupplierAddress   = supplierBL.GetSupplierByIDBL(supplierID).SupplierAddress;
            fundViewModel.FundReason        = fund.FundReason;
            fundViewModel.EmployeeCode      = employeeBL.GetEmployeeByIDBL(employeeID).EmployeeCode;
            fundViewModel.EmployeeName      = employeeBL.GetEmployeeByIDBL(employeeID).EmployeeName;
            fundViewModel.FundNumberVoucher = fund.FundNumberVoucher;
            fundViewModel.FundDate          = fund.FundDate;
            fundViewModel.CheckType         = fund.CheckType;
            fundViewModel.CheckDifferent    = fund.CheckDifferent;
            fundViewModel.SupplierID        = fund.SupplierID;
            fundViewModel.EmployeeID        = fund.EmployeeID;
            return(fundViewModel);
        }