Exemplo n.º 1
0
        protected void LinqDataSourceRpt_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            ucDateRange.Validated();

            RedBloodDataContext db = new RedBloodDataContext();

            e.Result = db.Campaigns.Where(r => ucDateRange.FromDate <= r.Date && r.Date <= ucDateRange.ToDate)
                       .ToList()
                       .Select(r => new
            {
                r.ID,
                Url = RedBloodSystem.Url4CollectRpt920
                      + "CampaignID=" + r.ID.ToString(),
                r.Name,
                r.Date,
                Total         = r.CollectedDonations.Count(),
                HostName      = r.HostOrg.Name,
                CoopName      = r.CoopOrg.Name,
                TestResultPos = RedBloodSystem.CheckingInfection.Select(r1 => new
                {
                    r1.Name,
                    Total = r.Donations.Where(r2 => r2.OrgPackID.HasValue && r1.Decode(r2.InfectiousMarkers) == TR.pos.Name).Count()
                }).Where(r1 => r1.Total > 0),
                TestResultNA = RedBloodSystem.CheckingInfection.Select(r1 => new
                {
                    r1.Name,
                    Total = r.Donations.Where(r2 => r2.OrgPackID.HasValue && r1.Decode(r2.InfectiousMarkers) == TR.na.Name).Count()
                }).Where(r1 => r1.Total > 0),
                BloodGroupSumary = r.Donations.Where(r2 => r2.OrgPackID.HasValue).GroupBy(r1 => r1.BloodGroup, (r2, BGSub) => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r2),
                    Total          = BGSub.Count()
                }).OrderBy(r1 => r1.BloodGroupDesc)
            });
        }
Exemplo n.º 2
0
    public void Fill_Letter(Donation e)
    {
        LabelName.Text = e.People.Name;
        LabelDOB.Text  = e.People.DOBToString;

        LabelPackCode.Text = e.DIN;
        LabelAddress.Text  = e.People.FullResidentalAddress;

        LabelHIV.Text = e.Markers.HIV;
        //if (e.Markers.HIV == TR.na.Name)
        //    LabelHIV.Text = "Không có";
        //else if (e.Markers.HIV == TR.neg.Name)
        //    LabelHIV.Text = "Âm tính";
        //else if (e.Markers.HIV == TR.pos.Name)
        //    LabelHIV.Text = "Dương tính";
        //else
        //    LabelHIV.Text = e.Markers.HIV;

        LabelHCV.Text = e.Markers.HCV_Ab;
        //if (e.Markers.HCV_Ab == TR.na.Name)
        //    LabelHCV.Text = TR.na.Name;
        //else if (e.Markers.HCV_Ab == TR.neg.Name)
        //    LabelHCV.Text = "Âm tính";
        //else if (e.Markers.HCV_Ab == TR.pos.Name)
        //    LabelHCV.Text = "Dương tính";
        //else
        //    LabelHCV.Text = e.Markers.HCV_Ab;

        LabelHBsAg.Text = e.Markers.HBs_Ag;
        //if (e.Markers.HBs_Ag == TR.na.Name)
        //    LabelHBsAg.Text = "Không có";
        //else if (e.Markers.HBs_Ag == TR.neg.Name)
        //    LabelHBsAg.Text = "Âm tính";
        //else if (e.Markers.HBs_Ag == TR.pos.Name)
        //    LabelHBsAg.Text = "Dương tính";
        //else
        //    LabelHBsAg.Text = e.Markers.HBs_Ag;

        LabelMalaria.Text = e.Markers.Malaria;
        //if (e.Markers.Malaria == TR.na.Name)
        //    LabelMalaria.Text = "Không có";
        //else if (e.Markers.Malaria == TR.neg.Name)
        //    LabelMalaria.Text = "Âm tính";
        //else if (e.Markers.Malaria == TR.pos.Name)
        //    LabelMalaria.Text = "Dương tính";
        //else
        //    LabelMalaria.Text = e.Markers.Malaria;

        LabelSyphilis.Text = e.Markers.Syphilis;
        //if (e.Markers.Syphilis == TR.na.Name)
        //    LabelSyphilis.Text = "Không có";
        //else if (e.Markers.Syphilis == TR.neg.Name)
        //    LabelSyphilis.Text = "Âm tính";
        //else if (e.Markers.Syphilis == TR.pos.Name)
        //    LabelSyphilis.Text = "Dương tính";
        //else
        //    LabelSyphilis.Text = e.Markers.Syphilis;

        LabelABO_Rh.Text = BloodGroupBLL.GetDescription(e.BloodGroup);
    }
Exemplo n.º 3
0
    public string GetResult(string type, string result)
    {
        string str = "";

        if (type == "BloodGroup")
        {
            str = BloodGroupBLL.GetDescription(result);
        }

        if (type == "Markers")
        {
            if (InfectiousMarker.IsValidate(result))
            {
                InfectiousMarker maker = new InfectiousMarker();
                maker.Code = result;
                str        = maker.Description;
            }
            else
            {
                str = "";
            }
        }

        return(str);
    }
Exemplo n.º 4
0
    protected void LinqDataSourceSum_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        var v = db.PackOrders.Where(r => r.OrderID.Value == OrderID &&
                                    !r.ReturnID.HasValue).ToList()
                .GroupBy(r => r.Pack.ProductCode)
                .Select(r => new
        {
            ProductCode      = r.Key,
            Sum              = r.Count(),
            BloodGroupSumary = r.GroupBy(r1 => r1.Pack.Donation.BloodGroup).Select(r1 => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                Total          = r1.Count(),
                VolumeSumary   = r1.GroupBy(r2 => r2.Pack.Volume).Select(r2 => new
                {
                    Volume = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                    Total  = r2.Count()
                }).OrderBy(r2 => r2.Volume)
            }).OrderBy(r1 => r1.BloodGroupDesc),
        });

        e.Result = v;
    }
Exemplo n.º 5
0
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.vw_ProductCounts.Where(r => r.Status == Pack.StatusX.Product)
                   .ToList()
                   .GroupBy(r => new { r.ProductCode, r.ProductDesc, r.Status }, (r, sub) => new
        {
            r.ProductCode,
            r.ProductDesc,
            r.Status,
            Total        = sub.Sum(r1 => r1.Count),
            TotalExpired = sub.Where(r1 => r1.ExpirationDate.Value.Expired())
                           .Sum(r1 => r1.Count).ToStringRemoveZero(),
            TotalExpiredInDays = sub.Where(r1 => r1.ExpirationDate.Value.ExpiredInDays(ExpiredInDays))
                                 .Sum(r1 => r1.Count).ToStringRemoveZero(),
            TotalTRNA = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Non)
                        .Sum(r1 => r1.Count).ToStringRemoveZero(),
            TotalTRNeg = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Negative)
                         .Sum(r1 => r1.Count).ToStringRemoveZero(),
            TotalTRPos = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Positive)
                         .Sum(r1 => r1.Count).ToStringRemoveZero(),
            BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                Total          = BGSub.Sum(r3 => r3.Count)
            }),
            VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
            {
                Volume = r1.HasValue ? r1.Value.ToString() : "_",
                Total  = VolSub.Sum(r3 => r3.Count)
            })
        })
                   .OrderBy(r => r.ProductDesc);
    }
Exemplo n.º 6
0
 protected void LinqDataSourcePack_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
     if (CampaignDetail1.CampaignID > 0)
     {
         e.Result =
             DonationBLL.GetUnLock(CampaignDetail1.CampaignID)
             .Select(r => new
         {
             r.DIN,
             r.Status,
             r.People.Name,
             CollectedDate = r.CollectedDate.ToStringVN_Hour(),
             r.BloodGroup,
             r.BloodGroupDesc,
             ABOLog = r.DonationTestLogs.Where(r1 => r1.Type == DonationTestLog.TypeX.BloodGroup)
                      .Select(r1 => new
             {
                 BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Result),
                 Date           = r1.Date.ToStringVN_Hour()
             })
         });
     }
     else
     {
         e.Cancel = true;
     }
 }
Exemplo n.º 7
0
    protected void LinqDataSourceStart_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.vw_PackRemainDailies.Where(r => r.Date == ucDateRange.FromDate.Value.AddDays(-1))
                   .ToList()
                   .GroupBy(r => new { r.ProductCode, r.ProductDesc }, (r, sub) => new
        {
            r.ProductCode,
            r.ProductDesc,
            Total            = sub.Sum(r1 => r1.Count),
            BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                Total          = BGSub.Sum(r3 => r3.Count)
            }),
            VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
            {
                Volume = r1,
                Total  = VolSub.Sum(r3 => r3.Count)
            })
        })
                   .OrderBy(r => r.ProductDesc);
    }
Exemplo n.º 8
0
    protected void LinqDataSourceOut_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.vw_PackTrans.Where(r => PackTransactionBLL.OutTypeList.Contains(r.Type) &&
                                         ucDateRange.FromDate <= r.Date &&
                                         r.Date <= ucDateRange.ToDate)
                   .ToList()
                   .GroupBy(r => new { r.ProductCode, r.ProductDesc }, (r, sub) => new
        {
            r.ProductCode,
            r.ProductDesc,
            Total         = sub.Sum(r1 => r1.Count),
            TotalOutOrder = sub.Where(r1 => PackTransactionBLL.OutOrderTypeList.Contains(r1.Type))
                            .Sum(r1 => r1.Count),
            TotalOutProduct = sub.Where(r1 => r1.Type == PackTransaction.TypeX.Out_Product)
                              .Sum(r1 => r1.Count),
            TotalOutDelete = sub.Where(r1 => r1.Type == PackTransaction.TypeX.Out_Delete)
                             .Sum(r1 => r1.Count),
            BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                Total          = BGSub.Sum(r3 => r3.Count)
            }),
            VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
            {
                Volume = r1,
                Total  = VolSub.Sum(r3 => r3.Count)
            })
        })
                   .OrderBy(r => r.ProductDesc);
    }
Exemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strOrderID = Request["OrderID"];

            if (!string.IsNullOrEmpty(strOrderID))
            {
                order = OrderBLL.Get(strOrderID.ToInt());

                if (order.Type == Order.TypeX.ForOrg)
                {
                    LabelTitle1.Text = "BIÊN BẢN BÀN GIAO";

                    LoadOrder();

                    RedBloodDataContext db = new RedBloodDataContext();


                    var v1 = db.PackOrders.Where(r => r.OrderID.Value == order.ID &&
                                                 !r.ReturnID.HasValue).ToList();

                    var v = v1.GroupBy(r => r.Pack.ProductCode)
                            .Select(r => new
                    {
                        ProductCode      = r.Key,
                        Sum              = r.Count(),
                        BloodGroupSumary = r.GroupBy(r1 => r1.Pack.Donation.BloodGroup).Select(r1 => new
                        {
                            BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                            Total          = r1.Count(),
                            VolumeSumary   = r1.GroupBy(r2 => r2.Pack.Volume).Select(r2 => new
                            {
                                Volume = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                                Total  = r2.Count(),
                                //DINList = string.Join(",", r2.Select(r3 => r3.Pack.DIN).ToArray()),
                                DINList = r2.Select(r3 => new { DIN = r3.Pack.DIN }).OrderBy(r4 => r4.DIN),
                            }).OrderBy(r2 => r2.Volume)
                        }).OrderBy(r1 => r1.BloodGroupDesc),
                    });

                    GridViewSum.DataSource = v;
                    GridViewSum.DataBind();

                    LableCount.Text = v1.Count().ToStringRemoveZero();

                    //var v2 = db.PackOrders.Where(r => r.OrderID.Value == order.ID
                    //    && !r.ReturnID.HasValue).ToList().OrderBy(r => r.Pack.DIN);
                    //GridViewPack.DataSource = v2;
                    //GridViewPack.DataBind();
                }
            }
        }
    }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string code    = "";
        string addText = "";
        int    count   = 0;

        try
        {
            code = Request["code"];
        }
        catch (Exception)
        {
        }

        try
        {
            count = Request["count"].ToInt();
        }
        catch (Exception)
        {
        }

        try
        {
            addText = Request["addText"];
        }
        catch (Exception)
        {
        }

        PrintSettingBLL.Reload();
        RedBloodDataContext db = new RedBloodDataContext();
        string desc            = BloodGroupBLL.GetDescription(code);

        for (int i = 0; i < count; i++)
        {
            Panel p = new Panel();
            p.Style.Add("position", "relative");
            p.Style.Add("page-break-after", "always");
            p.Style.Apply(PrintSettingBLL.BloodGroupLabel.PaperSize);
            p.Style.Add("border", "1px solid white");
            divCon.Controls.Add(p);

            AddDINLabelControl(code, desc + addText, PrintSettingBLL.BloodGroupLabel.Label1, p);
            AddDINLabelControl(code, desc + addText, PrintSettingBLL.BloodGroupLabel.Label2, p);
            AddDINLabelControl(code, desc + addText, PrintSettingBLL.BloodGroupLabel.Label3, p);
        }
    }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strParamID = Request["ReturnID"];

            if (!string.IsNullOrEmpty(strParamID))
            {
                returnObj = ReturnBLL.Get(strParamID.ToInt());

                if (returnObj != null)
                {
                    LabelTitle1.Text = "BIÊN BẢN THU HỒI";

                    LoadReturn();

                    RedBloodDataContext db = new RedBloodDataContext();

                    var v1 = db.PackOrders.Where(r => r.ReturnID.Value == returnObj.ID)
                             .Select(r => r.Pack)
                             .ToList();

                    var v = v1.GroupBy(r => r.ProductCode)
                            .Select(r => new
                    {
                        ProductCode      = r.Key,
                        Sum              = r.Count(),
                        BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
                        {
                            BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                            Total          = r1.Count(),
                            VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                            {
                                Volume  = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                                Total   = r2.Count(),
                                DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN),
                            }).OrderBy(r2 => r2.Volume)
                        }).OrderBy(r1 => r1.BloodGroupDesc),
                    });

                    GridViewSum.DataSource = v;
                    GridViewSum.DataBind();

                    LableCount.Text = v1.Count().ToStringRemoveZero();
                }
            }
        }
    }
Exemplo n.º 12
0
        public void LoadDIN()
        {
            Donation e = DonationBLL.Get(DIN);

            Clear();
            if (e != null)
            {
                lblName.Text = e.People.Name;

                imgDIN.ImageUrl = BarcodeBLL.Url4DIN(e.DIN, "00");

                lblDINDate.Text = e.CollectedDate.ToStringVN();


                if (e.Pack != null)
                {
                    imgProduct.ImageUrl   = BarcodeBLL.Url4Product(e.Pack.ProductCode);
                    lblProductDesc.Text   = ProductBLL.GetDesc(e.Pack.ProductCode);
                    btnRemovePack.Visible = e.CanRemoveOriginalPack;

                    lblDate.Text = e.Pack.Date.ToStringVN_Hour();

                    txtVolume.Text = e.Pack.Volume.ToString();

                    if (!string.IsNullOrEmpty(e.BloodGroup))
                    {
                        ImageBloodGroup.ImageUrl = BarcodeBLL.Url4BloodGroup(e.BloodGroup);
                        lblBloodGroup.Text       = BloodGroupBLL.GetDescription(e.BloodGroup);
                    }
                }
                else
                {
                    btnRemovePack.Visible = false;
                }

                txtCollector.Text = e.Collector;

                txtNote.Text = e.Note;

                //btnSave.Enabled = DonationBLL.CanUpdateTestResult(e);
            }
        }
Exemplo n.º 13
0
    void LoadData()
    {
        DateTime?dtFrom = txtDateFrom.Text.ToDatetimeFromVNFormat();
        DateTime?dtTo   = txtDateTo.Text.ToDatetimeFromVNFormat();

        if (dtFrom.HasValue)
        {
            DateTime hourFrom;
            if (DateTime.TryParse(txtHourFrom.Text, out hourFrom))
            {
                dtFrom = dtFrom.Value.AddHours(hourFrom.Hour).AddMinutes(hourFrom.Minute);
            }
        }

        if (dtTo.HasValue)
        {
            DateTime hourTo;
            if (DateTime.TryParse(txtHourTo.Text, out hourTo))
            {
                dtTo = dtTo.Value.AddHours(hourTo.Hour).AddMinutes(hourTo.Minute);
            }
        }

        RedBloodDataContext db = new RedBloodDataContext();

        var packs = db.Packs.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo &&
                                   r.Donation.OrgPackID != r.ID).OrderBy(r => r.ProductCode).ThenBy(r => r.Date);

        var v = packs.ToList().GroupBy(r => r.ProductCode)
                .Select(r => new
        {
            ProductCode      = r.Key,
            ProductDesc      = ProductBLL.GetDesc(r.Key),
            Sum              = r.Count(),
            PrintUrl         = "~/Production/FinalLabelPrint.aspx?PackList=" + string.Join(",", r.Where(r1 => r1.Donation.TestResultStatus == Donation.TestResultStatusX.Negative).Select(r1 => r1.ID.ToString())),
            PrintCount       = r.Where(r1 => r1.Donation.TestResultStatus == Donation.TestResultStatusX.Negative).Count(),
            BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                Total          = r1.Count(),
                VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                {
                    Volume  = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                    Total   = r2.Count(),
                    DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN),
                }).OrderBy(r2 => r2.Volume)
            }).OrderBy(r1 => r1.BloodGroupDesc),
        });

        GridViewSum.DataSource = v;
        GridViewSum.DataBind();

        GridView1.DataSource = packs.ToList().Select(r => new
        {
            r.ID,
            Date = r.Date.ToStringVN_Hour(),
            r.DIN,
            r.ProductCode,
            Description = ProductBLL.GetDesc(r.ProductCode),
            r.Note,
        });
        GridView1.DataBind();

        btnSelectedPack.Visible = packs.Count() > 0;
    }
        public void Fill_Letter(Pack e)
        {
            if (e == null)
            {
                return;
            }

            lblLine1.Style.Apply(PrintSettingBLL.FinalLabel.Line1);

            imgDINBarcode.ImageUrl = BarcodeBLL.Url4DIN(e.DIN, "00", false);
            imgDINBarcode.Style.Apply(PrintSettingBLL.FinalLabel.DINBarcode);

            lblDIN.Text = e.DIN;
            lblDIN.Style.Apply(PrintSettingBLL.FinalLabel.DIN);

            lblCheckChar.Text = BarcodeBLL.CalculateISO7064Mod37_2(e.DIN);
            lblCheckChar.Style.Apply(PrintSettingBLL.FinalLabel.CheckChar);

            imgABOBarcode.ImageUrl = BarcodeBLL.Url4BloodGroup(e.Donation.BloodGroup, false);
            imgABOBarcode.Style.Apply(PrintSettingBLL.FinalLabel.ABOBarcode);

            lblABOCode.Text = e.Donation.BloodGroup;
            lblABOCode.Style.Apply(PrintSettingBLL.FinalLabel.ABOCode);

            lblABOLetter.Text = BloodGroupBLL.GetLetter(e.Donation.BloodGroup);
            lblABOLetter.Style.Apply(PrintSettingBLL.FinalLabel.ABOLetter);

            lblABORh.Text = BloodGroupBLL.GetRh(e.Donation.BloodGroup);
            lblABORh.Style.Apply(PrintSettingBLL.FinalLabel.ABORh);

            lblGeo.Text = e.Donation.Campaign != null
                ? string.Format("Nguồn: {0} - {1}",
                                e.Donation.Campaign.Source == null? "" : e.Donation.Campaign.Source.Name,
                                e.Donation.Campaign.ID.ToString(),
                                e.Donation.Campaign.CoopOrg == null? "" :
                                (e.Donation.Campaign.CoopOrg.Geo1 == null ? "" : e.Donation.Campaign.CoopOrg.Geo1.Name)) : "";

            lblGeo.Style.Apply(PrintSettingBLL.FinalLabel.Geo);

            lblCollectedDateLabel.Text = "Ngày lấy máu: ";
            lblCollectedDateLabel.Style.Apply(PrintSettingBLL.FinalLabel.CollectedDateLabel);

            lblCollectedDate.Text = e.Date.ToStringVN();
            lblCollectedDate.Style.Apply(PrintSettingBLL.FinalLabel.CollectedDate);

            imgProductBarcode.ImageUrl = BarcodeBLL.Url4Product(e.ProductCode, false);
            imgProductBarcode.Style.Apply(PrintSettingBLL.FinalLabel.ProductBarcode);

            lblProductCode.Text = e.ProductCode;
            lblProductCode.Style.Apply(PrintSettingBLL.FinalLabel.ProductCode);

            lblProductDesc.Text = ProductBLL.GetFinalLabelDesc(e.ProductCode);
            lblProductDesc.Style.Apply(PrintSettingBLL.FinalLabel.ProductDesc);

            lblVolumeLabel.Text = "Thể tích      ml";
            lblVolumeLabel.Style.Apply(PrintSettingBLL.FinalLabel.VolumeLabel);

            lblVolume.Text = e.Volume.ToString();
            lblVolume.Style.Apply(PrintSettingBLL.FinalLabel.Volume);

            lblExpiryDateLabel.Text = "Hạn sử dụng";
            lblExpiryDateLabel.Style.Apply(PrintSettingBLL.FinalLabel.ExpiryDateLabel);

            lblExpiryDate.Text = e.ExpirationDate.ToStringVN_Hour();
            lblExpiryDate.Style.Apply(PrintSettingBLL.FinalLabel.ExpiryDate);

            lblOrgLine1.Text = Resources.Resource.OrgLine1;
            lblOrgLine1.Style.Apply(PrintSettingBLL.FinalLabel.OrgLine1);

            lblOrgLine2.Text = Resources.Resource.OrgLine2;
            lblOrgLine2.Style.Apply(PrintSettingBLL.FinalLabel.OrgLine2);

            lblOrgLine3.Text = Resources.Resource.OrgLine3;
            lblOrgLine3.Style.Apply(PrintSettingBLL.FinalLabel.OrgLine3);

            lblOrgLine4.Text = Resources.Resource.OrgLine4;
            lblOrgLine4.Style.Apply(PrintSettingBLL.FinalLabel.OrgLine4);

            DivUC.Style.Apply(PrintSettingBLL.FinalLabel.FinalLabelSize);
        }
Exemplo n.º 15
0
        public object GetData(bool?IsNeg)
        {
            RedBloodDataContext db = new RedBloodDataContext();

            var v =
                //db.vw_ProductCounts
                db.Packs
                .Where(r => r.Status == Pack.StatusX.Product)
                .Select(r => new
            {
                TestResultStatus = r.Donation.TestResultStatus,
                r.ProductCode,
                r.Status,
                r.ExpirationDate,
                BloodGroup = r.Donation.BloodGroup,
                r.Volume,
            })
                .ToList()

                .Where(r => !IsNeg.HasValue || (IsNeg.Value ? r.TestResultStatus == Donation.TestResultStatusX.Negative
                    : r.TestResultStatus != Donation.TestResultStatusX.Negative))


                .GroupBy(r => new { r.ProductCode, r.Status }, (r, sub) => new
            {
                r.ProductCode,
                ProductDesc = ProductBLL.GetDesc(r.ProductCode),
                r.Status,
                //Total = sub.Sum(r1 => r1.Count),
                Total        = sub.Count(),
                TotalExpired = sub.Where(r1 => r1.ExpirationDate.Value.Expired())
                               .Count().ToStringRemoveZero(),
                //.Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalExpiredInDays = sub.Where(r1 => r1.ExpirationDate.Value.ExpiredInDays(ExpiredInDays))
                                     .Count().ToStringRemoveZero(),
                //.Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalTRNA = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Non)
                            .Count().ToStringRemoveZero(),
                //.Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalTRNeg = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Negative)
                             .Count().ToStringRemoveZero(),
                //.Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalTRPos = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Positive)
                             .Count().ToStringRemoveZero(),
                //.Sum(r1 => r1.Count).ToStringRemoveZero(),
                BloodGroupSumary = sub.GroupBy(r1 => BloodGroupBLL.GetLetter(r1.BloodGroup), (r1, BGSub) => new
                {
                    //BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                    BloodGroupDesc = r1,
                    Total          = BGSub.Count(), // BGSub.Sum(r3 => r3.Count),
                    VolumeSumary   = BGSub.GroupBy(r2 => r2.Volume, (r2, VolSub) => new
                    {
                        Volume = r2.HasValue ? r2.Value.ToString() : "_",
                        Total  = VolSub.Count(),   // VolSub.Sum(r3 => r3.Count)
                    }).OrderBy(r2 => r2.Volume)
                }).OrderBy(r1 => r1.BloodGroupDesc),
                VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                {
                    Volume = r1.HasValue ? r1.Value.ToString() : "_",
                    Total  = VolSub.Count(),   // VolSub.Sum(r3 => r3.Count)
                }).OrderBy(r1 => r1.Volume)
            })
                .OrderBy(r => r.ProductDesc);

            return(v);
        }
Exemplo n.º 16
0
    void LoadData()
    {
        DateTime?dtFrom = txtDateFrom.Text.ToDatetimeFromVNFormat();
        DateTime?dtTo   = txtDateTo.Text.ToDatetimeFromVNFormat();

        if (dtFrom.HasValue)
        {
            DateTime hourFrom;
            if (DateTime.TryParse(txtHourFrom.Text, out hourFrom))
            {
                dtFrom = dtFrom.Value.AddHours(hourFrom.Hour).AddMinutes(hourFrom.Minute);
            }
        }

        if (dtTo.HasValue)
        {
            DateTime hourTo;
            if (DateTime.TryParse(txtHourTo.Text, out hourTo))
            {
                dtTo = dtTo.Value.AddHours(hourTo.Hour).AddMinutes(hourTo.Minute);
            }
        }

        RedBloodDataContext db = new RedBloodDataContext();

        //var packs = db.Packs.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo
        //   && r.Donation.OrgPackID != r.ID).OrderBy(r => r.Date);

        var v = db.Deletes.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo)
                .OrderBy(r => r.Date)
                .ToList()
                .Select(r => new
        {
            r.ID,
            Date = r.Date.ToStringVN_Hour(),
            r.Note,
            r.Actor,
            r.Packs
        });



        GridView1.DataSource = v;
        GridView1.DataBind();

        var s = v.SelectMany(r => r.Packs).ToList();

        var v1 = s.ToList().GroupBy(r => r.ProductCode)
                 .Select(r => new
        {
            ProductCode      = r.Key,
            ProductDesc      = ProductBLL.GetDesc(r.Key),
            Sum              = r.Count(),
            BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
            {
                BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                Total          = r1.Count(),
                VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                {
                    Volume  = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                    Total   = r2.Count(),
                    DINList = r2.Select(r3 => new { DIN = r3.DIN }).OrderBy(r4 => r4.DIN),
                }).OrderBy(r2 => r2.Volume)
            }).OrderBy(r1 => r1.BloodGroupDesc),
        });

        GridViewSum.DataSource = v1;
        GridViewSum.DataBind();
    }
Exemplo n.º 17
0
        void LoadData()
        {
            Org org = null;

            try
            {
                org = OrgBLL.GetByName(txtOrg.Text.Trim());
            }
            catch (Exception)
            {
                org = null;
            }



            DateTime?dtFrom = txtDateFrom.Text.ToDatetimeFromVNFormat();
            DateTime?dtTo   = txtDateTo.Text.ToDatetimeFromVNFormat();

            if (dtFrom.HasValue)
            {
                DateTime hourFrom;
                if (DateTime.TryParse(txtHourFrom.Text, out hourFrom))
                {
                    dtFrom = dtFrom.Value.AddHours(hourFrom.Hour).AddMinutes(hourFrom.Minute);
                }
            }

            if (dtTo.HasValue)
            {
                DateTime hourTo;
                if (DateTime.TryParse(txtHourTo.Text, out hourTo))
                {
                    dtTo = dtTo.Value.AddHours(hourTo.Hour).AddMinutes(hourTo.Minute);
                }
            }

            RedBloodDataContext db = new RedBloodDataContext();

            var v = db.Orders.Where(r => r.Date.Value >= dtFrom && r.Date.Value <= dtTo)
                    .ToList()
                    .Where(r =>
                           (org == null || (r.OrgID == org.ID))
                           )
                    //.OrderBy(r => r.Date)
                    //.ToList()
                    //.Select(r => new
                    //{
                    //    r.ID,
                    //    r.Name,
                    //    Date = r.Date.ToStringVN_Hour(),
                    //    r.Actor,
                    //    r.Type,
                    //    For = r.Type == Order.TypeX.ForCR ? r.Org.Name : r.People.Name,
                    //})
                    .SelectMany(r => r.PackOrders.Select(r1 => r1.Pack))
                    .ToList()
                    .GroupBy(r => new { r.ProductCode })
                    .Select(r => new
            {
                ProductCode      = r.Key.ProductCode,
                ProductDesc      = ProductBLL.GetDesc(r.Key.ProductCode),
                Total            = r.Count(),
                BloodGroupSumary = r.GroupBy(r1 => r1.Donation.BloodGroup).Select(r1 => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Key),
                    Total          = r1.Count(),
                    VolumeSumary   = r1.GroupBy(r2 => r2.Volume).Select(r2 => new
                    {
                        Volume = r2.Key.HasValue ? r2.Key.Value.ToString() : "_",
                        Total  = r2.Count()
                    }).OrderBy(r2 => r2.Volume)
                }).OrderBy(r1 => r1.BloodGroupDesc),
                //VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                //{
                //    Volume = r1.HasValue ? r1.Value.ToString() : "_",
                //    Total = VolSub.Sum(r3 => r3.Count)
                //}).OrderBy(r1 => r1.Volume)
            })
                    .OrderBy(r => r.ProductDesc);

            GridView1.DataSource = v;
            GridView1.DataBind();
        }