Exemplo n.º 1
0
    void LoadPack(string productCode)
    {
        Pack p = PackBLL.Get4ReportSideEffects(DIN, productCode);

        ProductCode           = productCode;
        ImageProduct.ImageUrl = BarcodeBLL.Url4Product(p.ProductCode);
    }
    protected void LinqDataSourceEnd_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        var packBLL = new PackBLL();

        e.Result = packBLL.GetRemainByDate(ucDateRange.ToDate.Value)
            .Select(r => new { r.ProductCode, r.Donation.BloodGroup, r.Volume })
            .ToList()
            .GroupBy(r => new { r.ProductCode }, (r, sub) => new
            {
                r.ProductCode,
                ProductDesc = ProductBLL.GetDesc(r.ProductCode),
                Total = sub.Count(),
                BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                    Total = BGSub.Count(),
                    Order = BloodGroupBLL.GetOrder(r1),
                }).OrderBy(r1 => r1.Order).ThenBy(r1 => r1.BloodGroupDesc),
                VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                {
                    Volume = r1,
                    Total = VolSub.Count()
                })
            })
            .OrderBy(r => r.ProductDesc);
    }
Exemplo n.º 3
0
        void EnterDIN(string DINCode)
        {
            DIN = DINCode;

            DonationBLL.UpdateCollector(DIN, txtDefaultCollector.Text.Trim());
            if (BarcodeBLL.IsValidProductCode(txtProductCode.Text.Trim()))
            {
                PackBLL.Add(DIN, BarcodeBLL.ParseProductCode(txtProductCode.Text.Trim()), txtDefaultVolume.Text.ToInt());
            }
            LoadDIN();
        }
Exemplo n.º 4
0
    public void Extract(Guid srcPackID, string productCode)
    {
        Pack pack = PackBLL.Get4Extract(srcPackID);

        PackBLL.Add(pack.DIN, productCode, false);

        if (pack.Status != Pack.StatusX.Produced)
        {
            PackBLL.ChangeStatus(pack.ID, Pack.StatusX.Produced, PackTransaction.TypeX.Out_Product);
        }
    }
Exemplo n.º 5
0
    public static void Return(int returnID, int packOrderID, string note)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        PackOrder po = Get4Return(db, packOrderID);

        po.ReturnID = returnID;

        db.SubmitChanges();

        PackBLL.ChangeStatus(po.Pack.ID, Pack.StatusX.Product, PackTransaction.TypeX.In_Return, note);
    }
Exemplo n.º 6
0
    public static void Delete(int deleteID, Guid packID, string note)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        Pack p = Get4Delete(db, packID);

        p.DeleteID = deleteID;

        db.SubmitChanges();

        PackBLL.ChangeStatus(p.ID, Pack.StatusX.Delete, PackTransaction.TypeX.Out_Delete, note);
    }
Exemplo n.º 7
0
    //public static void Add(string DIN, string productCode)
    //{
    //    Pack toPack = new Pack();

    //    toPack.DIN = DIN;
    //    toPack.ProductCode = productCode;
    //    toPack.Status = Pack.StatusX.Product;
    //    toPack.Actor = RedBloodSystem.CurrentActor;
    //    //toPack.Volume = p.OriginalVolume;
    //    toPack.ExpirationDate = DateTime.Now.Add(p.Duration.Value - RedBloodSystem.RootTime);

    //    db.Packs.InsertOnSubmit(toPack);
    //    db.SubmitChanges();

    //    PackTransactionBLL.Add(toPack.ID, PackTransaction.TypeX.In_Product);

    //    //Update fromPack
    //    PackStatusHistory h = PackBLL.Update(db, pack, Pack.StatusX.Produced, "");
    //    if (h != null)
    //    {
    //        db.SubmitChanges();
    //        PackTransactionBLL.Add(pack.ID, PackTransaction.TypeX.Out_Product);
    //    }

    //    return PackErrEnum.Non;
    //}

    public static Pack Get4Order(string DIN, string productCode)
    {
        Pack p = PackBLL.Get(DIN, productCode);

        if (p.Status != Pack.StatusX.Product)
        {
            throw new Exception("Không thể cấp phát. Túi máu: " + p.Status);
        }

        if (p.Donation.TestResultStatus != Donation.TestResultStatusX.Negative)
        {
            throw new Exception("Không thể cấp phát túi máu này. KQ xét nghiệm sàng lọc: " + p.Donation.TestResultStatus);
        }

        return(p);
    }
Exemplo n.º 8
0
    void AddPack(string productCode)
    {
        Pack p = PackBLL.Get(CurrentDIN, productCode);

        if (PackList.Contains(p.ID))
        {
            throw new Exception("Đã nhập túi máu này.");
        }

        PackList.Add(p.ID);

        GridViewPack.DataBind();

        CurrentDIN             = "";
        imgCurrentDIN.ImageUrl = "none";
    }
    void AddPack(string DIN)
    {
        Pack p = PackBLL.Get(DIN, CurrentProductCode);

        if (PackList.Contains(p.ID))
        {
            throw new Exception("Đã nhập túi máu này.");
        }

        if (p.Donation.TestResultStatus != Donation.TestResultStatusX.Âm_tính)
        {
            throw new Exception(p.Donation.TestResultStatus.ToString());
        }

        PackList.Add(p.ID);
        ShowInfo();
    }
Exemplo n.º 10
0
    public static PackOrder Get4Return(string DIN, string productCode)
    {
        Pack p = PackBLL.Get(DIN, productCode);

        var v = p.PackOrders.Where(r => !r.ReturnID.HasValue);

        if (v.Count() > 1)
        {
            throw new Exception("Sai dữ liệu. Túi máu cấp phát 2 lần.");
        }

        if (v.Count() == 0)
        {
            throw new Exception("Chưa có cấp phát túi máu này.");
        }

        return(v.FirstOrDefault());
    }
Exemplo n.º 11
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);
            }
        }
    }
Exemplo n.º 12
0
    public static int Add(List <Guid> packIDList, string note)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        List <Pack> poL = PackBLL.Get4Delete(db, packIDList);

        Delete re = new Delete();

        re.Note = note;

        db.Deletes.InsertOnSubmit(re);
        db.SubmitChanges();

        foreach (var item in packIDList)
        {
            PackBLL.Delete(re.ID, item, note);
        }

        return(re.ID);
    }
Exemplo n.º 13
0
    public static void Add(int orderID, string DIN, string productCode)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        Order r = OrderBLL.Get4Add(orderID);
        Pack  p = PackBLL.Get4Order(DIN, productCode);

        PackOrder po = new PackOrder();

        po.OrderID = r.ID;
        po.PackID  = p.ID;

        db.PackOrders.InsertOnSubmit(po);
        db.SubmitChanges();

        PackTransaction.TypeX transType = r.Type == Order.TypeX.ForCR ? PackTransaction.TypeX.Out_Order4CR
            : r.Type == Order.TypeX.ForOrg ? PackTransaction.TypeX.Out_Order4Org
            : PackTransaction.TypeX.Out_OrderGen;

        PackBLL.ChangeStatus(p.ID, Pack.StatusX.Delivered, transType, "PackOrderID = " + po.ID.ToString());
    }
Exemplo n.º 14
0
    public static void Add(string DIN, string productCode, string fullSideEffects, string note)
    {
        Pack p = PackBLL.Get4ReportSideEffects(DIN, productCode);

        if (string.IsNullOrEmpty(fullSideEffects))
        {
            throw new Exception("Phản ứng phụ trống.");
        }

        PackSideEffect se = new PackSideEffect();

        se.PackID = p.ID;
        se.SetSideEffect(fullSideEffects);

        se.Actor = RedBloodSystem.CurrentActor;
        se.Date  = DateTime.Now;
        se.Note  = note;

        RedBloodDataContext db = new RedBloodDataContext();

        db.PackSideEffects.InsertOnSubmit(se);

        db.SubmitChanges();
    }
Exemplo n.º 15
0
 public static List <PackSideEffect> Get(string DIN, string productCode)
 {
     return(PackBLL.Get4ReportSideEffects(DIN, productCode).PackSideEffects.ToList());
 }
Exemplo n.º 16
0
 void EnterProductCode(string productCode)
 {
     PackBLL.Add(DIN, productCode, txtDefaultVolume.Text.ToInt(), true);
     LoadDIN();
 }