コード例 #1
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);
        }
コード例 #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> 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);
        }
コード例 #4
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);
        }
コード例 #5
0
    protected void btnProductCodeIn_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton btn = sender as ImageButton;

        if (btn != null)
        {
            ProductCodeInList.Remove(btn.CommandArgument);
            DataListProductIn.DataBind();
        }
    }
コード例 #6
0
ファイル: ReceiptBLL.cs プロジェクト: ghostnguyen/redblood
    public Guid InsertOrUpdate(Guid ID, Func <Receipt, Receipt> loadFromGUI)
    {
        RedBloodDataContext db = new RedBloodDataContext();
        Receipt             r;

        if (ID == Guid.Empty)
        {
            r = new Receipt();
            db.Receipts.InsertOnSubmit(r);
        }
        else
        {
            r = ReceiptBLL.Get(ID, db);
        }

        loadFromGUI(r);

        //Product In
        IEnumerable <ReceiptProduct> existingProductCodeInList = r.ReceiptProducts.Where(r1 => r1.Type == ReceiptProduct.TypeX.In);

        db.ReceiptProducts.DeleteAllOnSubmit(
            existingProductCodeInList.Where(r1 => !ProductCodeInList.Contains(r1.ProductCode))
            );

        r.ReceiptProducts.AddRange(
            ProductCodeInList
            .Except(existingProductCodeInList.Select(r1 => r1.ProductCode))
            .Select(r1 => new ReceiptProduct()
        {
            ProductCode = r1, Type = ReceiptProduct.TypeX.In
        })
            );

        //Product Out
        IEnumerable <ReceiptProduct> existingProductCodeOutList = r.ReceiptProducts.Where(r1 => r1.Type == ReceiptProduct.TypeX.Out);

        db.ReceiptProducts.DeleteAllOnSubmit(
            existingProductCodeOutList.Where(r1 => !ProductCodeOutList.Contains(r1.ProductCode))
            );

        r.ReceiptProducts.AddRange(
            ProductCodeOutList
            .Except(existingProductCodeOutList.Select(r1 => r1.ProductCode))
            .Select(r1 => new ReceiptProduct()
        {
            Product = ProductBLL.Get(db, r1), Type = ReceiptProduct.TypeX.Out
        })
            );

        db.SubmitChanges();
        return(r.ID);
    }
コード例 #7
0
ファイル: Divide.aspx.cs プロジェクト: ghostnguyen/redblood
        protected void btnReset_Click(object sender, EventArgs e)
        {
            ProductCodeInList.Clear();
            DataListProductIn.DataBind();

            GridViewVolume.DataBind();

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

            rdbDINIn.Checked         = false;
            rdbProductCodeIn.Checked = true;
        }
コード例 #8
0
ファイル: ReceiptBLL.cs プロジェクト: ghostnguyen/redblood
    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.");
        }

        ProductCodeOutList.Add(productCode);

        return(ProductCodeOutList);
    }
コード例 #9
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);
                }
            }
        }
コード例 #10
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);
                }
            }
        }
コード例 #11
0
ファイル: Divide.aspx.cs プロジェクト: ghostnguyen/redblood
        protected void LinqDataSourceProductIn_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            RedBloodDataContext db = new RedBloodDataContext();

            string productCode = ProductCodeInList.FirstOrDefault();

            if (string.IsNullOrEmpty(productCode))
            {
                e.Cancel = true;
            }
            else
            {
                string productCodeShort = productCode.Substring(0, productCode.Length - 2);
                e.Result = db.Products.Where(r => r.Code.Contains(productCodeShort)).Select(r => new
                {
                    Code = productCode,
                    r.Description
                });
            }
        }
コード例 #12
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);
        }
コード例 #13
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();
    }
コード例 #14
0
ファイル: Extract.aspx.cs プロジェクト: ghostnguyen/redblood
        protected void LinqDataSourceProductIn_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            RedBloodDataContext db = new RedBloodDataContext();

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