예제 #1
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);
    }
예제 #2
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("");
    }
예제 #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);
    }