Exemple #1
0
        /// <summary>
        /// Check whether a package is unexpected and has its status/location updated
        /// </summary>
        /// <param name="medicationTypeId">medication type id</param>
        /// <param name="barcode">package barcode</param>
        /// <returns>true if status/location of the package has been updated, or false if not</returns>
        public bool CheckAndUpdatePackage(int medicationTypeId, string barcode)
        {
            bool updated = false;
            MedicationPackage package = MedicationPackageDAO.FindPackageByBarcode(barcode);

            if (package == null)
            {
                MedicationType medicationType = MedicationTypeDAO.GetMedicationTypeById(medicationTypeId);
                DateTime       expireDate     = medicationType.DefaultExpireDate;
                RegisterPackage(medicationType, expireDate, barcode);
                updated = true;
            }
            else if (package.TypeId != medicationTypeId)
            {
                throw new ENETCareException(Properties.Resources.MedicationTypeNotMatched);
            }
            else if (package.Status != PackageStatus.InStock || package.StockDCId != User.DistributionCentreId)
            {
                ManipulatePackage(package, PackageStatus.InStock, User.DistributionCentreId, null, null);
                MedicationPackageDAO.UpdatePackage(package);
                updated = true;
            }
            return(updated);
        }
Exemple #2
0
 /// <summary>
 /// Retrieves a medication package by looking up its barcode.
 /// </summary>
 /// <param name="barcode">medication package barcode</param>
 /// <returns>a medication package corresponding to the barcode, or null if no matching medication package was found</returns>
 public MedicationPackage ScanPackage(string barcode)
 {
     return(MedicationPackageDAO.FindPackageByBarcode(barcode));
 }