Example #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);
        }
Example #2
0
        public List <string> AddDIN4Divide(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.");
            }

            //Can be produce positive product for research
            //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.");
            }

            DINInList.Add(DIN);

            return(DINInList);
        }
Example #3
0
        public List <string> AddProductCodeIn4Divide(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 (ProductCodeInList.Count == 1)
            {
                throw new Exception("Sản phẩm đầu vào chỉ được 1 loại.");
            }

            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
        protected void LinqDataSourceDINIn_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            RedBloodDataContext db = new RedBloodDataContext();
            var list = db.Donations.Where(r => DINInList.Contains(r.DIN)).ToList();

            list.Reverse();
            e.Result = list;
        }
Example #5
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            LinkButton btn = sender as LinkButton;

            if (btn != null)
            {
                DINInList.Remove(btn.CommandArgument);
                DataListDINIn.DataBind();
            }
        }
Example #6
0
        protected void btnDINRemove_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton btn = sender as ImageButton;

            if (btn != null)
            {
                DINInList.Remove(btn.CommandArgument);
                DataListDINIn.DataBind();
            }
        }
Example #7
0
        protected void btnReset_Click(object sender, EventArgs e)
        {
            ProductCodeInList.Clear();
            DataListProductIn.DataBind();

            GridViewVolume.DataBind();

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

            rdbDINIn.Checked         = false;
            rdbProductCodeIn.Checked = true;
        }
Example #8
0
        public void Divide()
        {
            string err = ValidateAllList4Divide();

            if (!string.IsNullOrEmpty(err))
            {
                throw new Exception(err);
            }

            List <Pack> packList = DINInList.Select(r => PackBLL.Get4Extract(r, ProductCodeInList.FirstOrDefault())).ToList();

            foreach (Pack item in packList)
            {
                foreach (var item1 in DivisionList)
                {
                    Divide(item.ID, item1.Ext, item1.Volume);
                }
            }
        }
Example #9
0
        public void Extract()
        {
            string err = ValidateAllList();

            if (!string.IsNullOrEmpty(err))
            {
                throw new Exception(err);
            }

            List <Pack> packList = DINInList.Select(r => PackBLL.Get4Extract(r, ProductCodeInList.FirstOrDefault())).ToList();

            foreach (Pack item in packList)
            {
                foreach (string code in ProductCodeOutList)
                {
                    //TODO: display all err pack.
                    Extract(item.ID, code);
                }
            }
        }
Example #10
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);
        }