예제 #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
    protected void btnProductCodeOut_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton btn = sender as ImageButton;

        if (btn != null)
        {
            ProductCodeOutList.Remove(btn.CommandArgument);
            DataListProductOut.DataBind();
        }
    }
예제 #4
0
        protected void btnReset_Click(object sender, EventArgs e)
        {
            ProductCodeInList.Clear();
            DataListProductIn.DataBind();

            ProductCodeOutList.Clear();
            DataListProductOut.DataBind();

            DINInList.Clear();
            DataListDINIn.DataBind();

            rdbProductCodeOut.Checked = false;
            rdbDINIn.Checked          = false;
            rdbProductCodeIn.Checked  = true;
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
0
    public void DisplayToGUI()
    {
        Receipt e = ReceiptBLL.Get(ReceiptID);

        if (e == null)
        {
            e = new Receipt();
            ProductCodeInList.Clear();
            ProductCodeOutList.Clear();
            rdbProductCodeIn.Checked = true;
        }
        else
        {
            ProductCodeInList  = e.ReceiptProducts.Where(r => r.Type == ReceiptProduct.TypeX.In).Select(r => r.ProductCode).ToList();
            ProductCodeOutList = e.ReceiptProducts.Where(r => r.Type == ReceiptProduct.TypeX.Out).Select(r => r.ProductCode).ToList();
        }

        txtName.Text = e.Name;
        txtNote.Text = e.Note;

        DataListProductIn.DataBind();
        DataListProductOut.DataBind();
    }
예제 #8
0
        protected void LinqDataSourceProductOut_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            RedBloodDataContext db = new RedBloodDataContext();

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