Example #1
0
        public string ValidateAllList()
        {
            if (ProductCodeInList.Count == 0)
            {
                return("Không có sản phẩm đầu vào.");
            }

            if (ProductCodeOutList.Count == 0)
            {
                return("Không có sản phẩm đầu ra.");
            }

            if (DINInList.Count == 0)
            {
                return("Không có túi máu đầu vào.");
            }

            ReceiptBLL.ValidateOnTherapyReceipt(ProductCodeInList, ProductCodeOutList);

            if (ProductCodeInList.Where(r => ProductCodeOutList.Contains(r)).Count() != 0)
            {
                return("Danh sách sản phẩm đầu ra và đầu vào có sản phẩm trùng.");
            }

            return("");
        }
Example #2
0
        public List <string> AddProductCodeOut(string productCode)
        {
            if (ProductCodeInList.Contains(productCode))
            {
                throw new Exception("Sản phẩm đầu ra đã có trong danh sách đầu vào.");
            }

            if (ProductCodeOutList.Contains(productCode))
            {
                throw new Exception("Sản phẩm đầu ra đã có trong danh sách đầu ra.");
            }

            List <string> tempList = ProductCodeOutList.ToList();

            tempList.Add(productCode);
            ReceiptBLL.ValidateOnTherapyReceipt(ProductCodeInList, tempList);

            RedBloodDataContext db = new RedBloodDataContext();
            int count = db.Packs.Where(r => r.ProductCode == productCode && DINInList.Contains(r.DIN)).Count();

            if (count > 0)
            {
                throw new Exception("Sản phẩm đầu ra đã sản xuất.");
            }

            ProductCodeOutList.Add(productCode);

            return(ProductCodeOutList);
        }
Example #3
0
        public List <string> AddProductCodeIn(string productCode)
        {
            if (ProductCodeInList.Contains(productCode))
            {
                throw new Exception("Sản phẩm đầu vào đã có trong danh sách đầu vào.");
            }

            if (ProductCodeOutList.Contains(productCode))
            {
                throw new Exception("Sản phẩm đầu vào đã có trong danh sách đầu ra.");
            }

            if (ProductCodeInList.Count == 1)
            {
                throw new Exception("Sản phẩm đầu vào chỉ được 1 loại.");
            }

            List <string> tempList = ProductCodeInList.ToList();

            tempList.Add(productCode);
            ReceiptBLL.ValidateOnTherapyReceipt(tempList, ProductCodeOutList);

            RedBloodDataContext db = new RedBloodDataContext();
            int count = db.Packs.Where(r => r.ProductCode == productCode && DINInList.Contains(r.DIN)).Count();

            if (count < DINInList.Count)
            {
                throw new Exception("Sản phẩm đầu vào không có túi máu.");
            }

            if (count > DINInList.Count)
            {
                throw new Exception("Sản phẩm đầu vào có túi máu bị trùng dữ liệu.");
            }


            ProductCodeInList.Add(productCode);

            return(ProductCodeInList);
        }
Example #4
0
        public List <string> AddDIN(string DIN)
        {
            if (DINInList.Contains(DIN))
            {
                throw new Exception("Mã túi máu này đã có.");
            }

            Donation d = DonationBLL.Get(DIN);

            if (d == null)
            {
                throw new Exception("Không có mã túi máu này.");
            }

            //Allow positive to be produced for lab.
            //if (d.TestResultStatus == Donation.TestResultStatusX.Positive)
            //{
            //    throw new Exception("Xét nghiệm sàng lọc: Dương tính.");
            //}

            RedBloodDataContext db = new RedBloodDataContext();
            int count = db.Packs.Where(r => ProductCodeInList.Contains(r.ProductCode) && r.DIN == DIN).Count();

            if (count == 0)
            {
                throw new Exception("Mã túi máu này không có sản phẩm đầu vào.");
            }

            count = db.Packs.Where(r => ProductCodeOutList.Contains(r.ProductCode) && r.DIN == DIN).Count();
            if (count > 0)
            {
                throw new Exception("Mã túi máu này đã có sản phẩm đầu ra.");
            }

            DINInList.Add(DIN);

            return(DINInList);
        }
Example #5
0
        protected void LinqDataSourceProductOut_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            RedBloodDataContext db = new RedBloodDataContext();

            e.Result = db.Products.Where(r => ProductCodeOutList.Contains(r.Code));
        }