Ejemplo n.º 1
0
        public static void Update(string DIN, string bloodGroup, string note)
        {
            RedBloodDataContext db = new RedBloodDataContext();

            Donation e = DonationBLL.Get(db, DIN);

            if (e == null)
            {
                throw new Exception(DonationErrEnum.NonExist.Message);
            }

            if (!CanUpdateTestResult(e))
            {
                throw new Exception(DonationErrEnum.TRLocked.Message);
            }

            if (bloodGroup.Trim() != e.BloodGroup)
            {
                e.BloodGroup = bloodGroup;
                DonationTestLogBLL.Insert(db, e, PropertyName.For <Donation>(r => r.BloodGroup), note);
            }

            //Have to save before updaye TestResult Status
            db.SubmitChanges();

            UpdateTestResultStatus(e);
            db.SubmitChanges();
        }
Ejemplo n.º 2
0
        public static DonationErr Update(string DIN,
                                         string HIV, string HCV_Ab, string HBs_Ag, string Syphilis, string Malaria,
                                         string note, bool updateIfAllNon = false)
        {
            RedBloodDataContext db = new RedBloodDataContext();

            Donation e = DonationBLL.Get(db, DIN);

            if (e == null || !CanUpdateTestResult(e))
            {
                return(DonationErrEnum.TRLocked);
            }

            string old = e.InfectiousMarkers;

            if (!updateIfAllNon ||
                (updateIfAllNon && e.Markers.IsAllNon)
                )
            {
                // Warning: As CR user requirement, value for both test result are always the same.
                e.InfectiousMarkers = Infection.HIV_Ab.Encode(e.InfectiousMarkers, HIV);
                e.InfectiousMarkers = Infection.HIV_Ag.Encode(e.InfectiousMarkers, HIV);

                e.InfectiousMarkers = Infection.HCV_Ab.Encode(e.InfectiousMarkers, HCV_Ab);
                e.InfectiousMarkers = Infection.HBs_Ag.Encode(e.InfectiousMarkers, HBs_Ag);
                e.InfectiousMarkers = Infection.Syphilis.Encode(e.InfectiousMarkers, Syphilis);
                e.InfectiousMarkers = Infection.Malaria.Encode(e.InfectiousMarkers, Malaria);

                if (old != e.InfectiousMarkers)
                {
                    DonationTestLogBLL.Insert(db, e, PropertyName.For <Donation>(r => r.Markers), note);
                }

                //Have to save before update TestResult Status
                db.SubmitChanges();

                UpdateTestResultStatus(e);
                db.SubmitChanges();
            }

            return(DonationErrEnum.Non);
        }