コード例 #1
0
 public ActionResult RegisterPackage(Package package)
 {
     int barcode = 0;
     if(Request.Form["Register"] != null)
     {
         barcode = packageServies.AddPackage(package, WebSecurity.CurrentUserId);
     }
     ListMedication();
     return View(package);
 }
コード例 #2
0
        public int AddPackage(Package pack, int userID)
        {
            //Form Proper package types
            pack.UserId = userID;
            pack.DistributionCenterID = employeeLoginDao.GetEmployeeLoginDetail(userID).DistributionCenterID;
            pack.ReceivingCenterID = null;
            pack.StockStatus = StockType.InStock;
            pack.TransactionDate = DateTime.Today;

            return packageDao.RegisterPackage(pack);
        }
コード例 #3
0
 public PackageTest()
 {
     packageService = new PackageService();
     packageDao = new PackageDAO();
     testPack = new Package();
     testPack.UserId = 1;
     testPack.MedicalID = 1;
     testPack.ExpiryDate = DateTime.Today;
     testPack.DistributionCenterID = 1;
     testPack.ReceivingCenterID = null;
     testPack.TransactionDate = DateTime.Today;
 }
コード例 #4
0
 public ActionResult DistributePackage(Package pack)
 {
     if (Request.Form["SearchBarcode"] != null)
     {
         return View(packageServies.CheckIfBarcodeExist(pack.Barcode, StockType.InStock));
     }
     else if (Request.Form["DistributePackageConfirm"] != null)
     {
         packageServies.UpdatePackageStatus(WebSecurity.CurrentUserId, pack.Barcode, StockType.Distributed, null);
     }
     return View();
 }
コード例 #5
0
 public ActionResult SendPackage(Package pack)
 {
     ViewBag.DistributionCenters = new DistributionCenterService().GetDistributionCenterList();
     if (Request.Form["SearchBarcode"] != null)
     {
         return View(packageServies.CheckIfBarcodeExist(pack.Barcode, StockType.InStock));
     }
     else if(Request.Form["SendPackageConfirm"] != null)
     {
         packageServies.UpdatePackageStatus(WebSecurity.CurrentUserId, pack.Barcode, StockType.InTransit, pack.ReceivingCenterID.Value);
     }
     return View();
 }
コード例 #6
0
 public Package CheckIfPackageExist(int barCode, StockType? stockType)
 {
     var pack = new Package();
     if (stockType != null)
     {
         pack = Packages.SingleOrDefault(Package => Package.Barcode == barCode && Package.StockStatus == stockType);
     }
     else
     {
         pack = Packages.SingleOrDefault(Package => Package.Barcode == barCode);
     }
     return pack;
 }
コード例 #7
0
        public ActionResult AuditPackage(Package pack, string actionType)
        {
            if (Request.Form["SearchBarcode"] != null)
            {
                return View(packageServies.CheckIfBarcodeExist(pack.Barcode, null));
            }
            else if (Request.Form["AuditFeature"] != null)
            {
                StockType stockType = StockType.InStock;
                if (actionType.CompareTo("InStock") == 0)
                    stockType = StockType.InStock;

                if (actionType.CompareTo("Discard") == 0)
                    stockType = StockType.Discarded;

                if (actionType.CompareTo("Lost") == 0)
                    stockType = StockType.Lost;

                if (actionType.CompareTo("Remove") == 0)
                {
                    packageServies.RemovePackage(pack.Barcode);
                }
                else
                    packageServies.UpdatePackageStatus(WebSecurity.CurrentUserId, pack.Barcode, stockType, null);
            }
            return View();
        }
コード例 #8
0
 public int RegisterPackage(Package pack)
 {
     Packages.Add(pack);
     SaveChanges();
     return pack.Barcode;
 }