예제 #1
0
        protected void btnIgnoreActiveMedication_Click(object sender, EventArgs e)
        {
            LinkButton btn = (LinkButton)sender;

            _rmid = Convert.ToInt32(btn.ID.Replace("im", ""));
            if (_rmid > 0)
            {
                _context = formContext.IgnoreMedication;
                _reportInstanceMedication = UnitOfWork.Repository <ReportInstanceMedication>().Queryable().Single(rm => rm.Id == _rmid);

                divCausality.Visible = false;

                _reportInstanceMedication.NaranjoCausality = "IGNORED";

                UnitOfWork.Repository <ReportInstanceMedication>().Update(_reportInstanceMedication);
                UnitOfWork.Complete();

                RenderActiveMeds();

                HttpCookie cookie = new HttpCookie("PopUpMessage");
                cookie.Value = "Naranjo Causality set successfully";
                Response.Cookies.Add(cookie);
                Master.ShouldPopUpBeDisplayed();
            }
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (hidCausality.Value == "" || hidCausality.Value == "Incomplete")
            {
                return;
            }
            ;

            _rmid = Convert.ToInt32(hidMedication.Value);
            _reportInstanceMedication = UnitOfWork.Repository <ReportInstanceMedication>().Queryable().Single(rm => rm.Id == _rmid);

            try
            {
                _reportInstanceMedication.NaranjoCausality = hidCausality.Value;

                UnitOfWork.Repository <ReportInstanceMedication>().Update(_reportInstanceMedication);
                UnitOfWork.Complete();
            }
            catch (DbEntityValidationException ex)
            {
                var err = string.Empty;
                foreach (var eve in ex.EntityValidationErrors)
                {
                    foreach (var ve in eve.ValidationErrors)
                    {
                        err += String.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw new Exception(err);
            }

            _context = formContext.View;

            RenderButtons();

            if (_formMode == FormMode.ActiveMode)
            {
                RenderActiveMeds();
            }
            else
            {
                RenderSpontaneousMeds();
            }

            //divTool.Style["display"] = "none";
            HttpCookie cookie = new HttpCookie("PopUpMessage");

            cookie.Value = "Naranjo Causality set successfully";
            Response.Cookies.Add(cookie);
            Master.ShouldPopUpBeDisplayed();
            divCausality.Visible = false;
        }
예제 #3
0
        protected void btnSetSpontaneousCausality_Click(object sender, EventArgs e)
        {
            LinkButton btn = (LinkButton)sender;

            _rmguid  = new Guid(btn.ID.Replace("sc", ""));
            _context = formContext.SetCausality;
            _reportInstanceMedication = UnitOfWork.Repository <ReportInstanceMedication>().Queryable().Single(rm => rm.ReportInstanceMedicationGuid == _rmguid);

            divCausality.Visible = true;

            txtMedicine.Value   = _reportInstanceMedication.MedicationIdentifier;
            hidMedication.Value = _reportInstanceMedication.Id.ToString();

            RenderSpontaneousMeds();
            RenderButtons();
        }
예제 #4
0
        protected void btnSetActiveCausality_Click(object sender, EventArgs e)
        {
            LinkButton btn = (LinkButton)sender;

            _rmid = Convert.ToInt32(btn.ID.Replace("sc", ""));
            if (_rmid > 0)
            {
                _context = formContext.SetCausality;
                _reportInstanceMedication = UnitOfWork.Repository <ReportInstanceMedication>().Queryable().Single(rm => rm.Id == _rmid);

                divCausality.Visible = true;

                txtMedicine.Value   = _reportInstanceMedication.MedicationIdentifier;
                hidMedication.Value = _reportInstanceMedication.Id.ToString();

                RenderActiveMeds();
                RenderButtons();
            }
        }
예제 #5
0
        public void AddOrUpdateMedicationsForWorkFlowInstance(Guid contextGuid, List <ReportInstanceMedicationListItem> medications)
        {
            Check.IsNotNull(contextGuid, "contextGuid may not be null");
            Check.IsNotNull(medications, "medications may not be null");

            if (medications.Count == 0)
            {
                return;
            }
            ;

            ReportInstance reportInstance = _unitOfWork.Repository <ReportInstance>().Queryable().Include(ri => ri.Medications).SingleOrDefault(ri => ri.ContextGuid == contextGuid);

            if (reportInstance == null)
            {
                return;
            }
            ;

            // Full managements of medications list for report instance
            ArrayList addCollection    = new ArrayList();
            ArrayList modifyCollection = new ArrayList();

            foreach (ReportInstanceMedicationListItem medication in medications)
            {
                if (reportInstance.Medications != null)
                {
                    var exists = reportInstance.Medications.Any(m => m.ReportInstanceMedicationGuid == medication.ReportInstanceMedicationGuid);
                    if (exists)
                    {
                        modifyCollection.Add(medication);
                    }
                    else
                    {
                        addCollection.Add(medication);
                    }
                }
                else
                {
                    addCollection.Add(medication);
                }
            }

            foreach (ReportInstanceMedicationListItem medication in addCollection)
            {
                var med = new ReportInstanceMedication()
                {
                    MedicationIdentifier = medication.MedicationIdentifier, ReportInstance = reportInstance, ReportInstanceMedicationGuid = medication.ReportInstanceMedicationGuid
                };
                reportInstance.Medications.Add(med);

                _unitOfWork.Repository <ReportInstanceMedication>().Save(med);
            }
            foreach (ReportInstanceMedicationListItem medication in modifyCollection)
            {
                var med = reportInstance.Medications.Single(m => m.ReportInstanceMedicationGuid == medication.ReportInstanceMedicationGuid);
                med.MedicationIdentifier = medication.MedicationIdentifier;

                _unitOfWork.Repository <ReportInstanceMedication>().Update(med);
            }
        }