public void SetFromRoot(DbManagerProxy manager, long idfHumanActual, HumanCase hc) { var patient = Patient.Accessor.Instance(null).SelectByKey(manager, idfHumanActual); hc.Patient = CopyFrom(manager, patient); hc.Patient.intPatientAgeFromCase = hc.CalcPatientAge(); hc.Patient.HumanAgeType = HumanAgeTypeLookup.SingleOrDefault(a => a.idfsBaseReference == hc.CalcPatientAgeType()); HumanCase.Accessor.Instance(null).SetupChildHandlers(hc, hc.Patient); }
protected static void CustomValidations(HumanCase hc) { var acc = FFPresenterModel.Accessor.Instance(null); using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { if (!eidss.model.Core.EidssUserContext.SmartphoneContext && !eidss.model.Core.EidssUserContext.User.HasPermission(PermissionHelper.ExecutePermission(EIDSSPermissionObject.UseSimplifiedHumanCaseReportForm))) { acc.Validate(manager, hc.FFPresenterCs, true, false, true); acc.Validate(manager, hc.FFPresenterEpi, true, false, true); } } }
protected void CheckOutbreak(HumanCase obj) { using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { if (obj.idfOutbreak.HasValue && obj.idfOutbreak.Value != 0) { var idfsCaseDiagnosis = manager.SetCommand("select dbo.fnIsCaseSessionDiagnosesInGroupOutbreak(@idfCase, @idfOutbreak)", manager.Parameter("@idfCase", obj.idfCase), manager.Parameter("@idfOutbreak", obj.idfOutbreak)) .ExecuteScalar <long>(); if (idfsCaseDiagnosis == 0) { Outbreak outbreak = Outbreak.Accessor.Instance(null).SelectByKey(manager, obj.idfOutbreak); throw new ValidationModelException("msgOutbreakDiagnosisErrorCases", "idfOutbreak", "idfOutbreak", new object[] { obj.strCaseID, outbreak.strOutbreakID, outbreak.Diagnosis == null ? "" : outbreak.Diagnosis.name }, GetType(), ValidationEventType.Error, obj); } if (idfsCaseDiagnosis > 0) { Outbreak outbreak = Outbreak.Accessor.Instance(null).SelectByKey(manager, obj.idfOutbreak); throw new ValidationModelException("msgUpOutbreakDiagnosisToGroup", "idfOutbreak", "idfOutbreak", new object[] { outbreak.Diagnosis.name, obj.strCaseID, obj.strDiagnosis, outbreak.DiagnosisLookup.Single(i => i.idfsDiagnosisOrDiagnosisGroup == outbreak.DiagnosisLookup.Single(c => c.idfsDiagnosisOrDiagnosisGroup == outbreak.idfsDiagnosisOrDiagnosisGroup).idfsDiagnosisGroup).name }, GetType(), ValidationEventType.Question, obj); } } } }
public void SetupChildHandlers(HumanCase obj, object newobj) { _SetupChildHandlers(obj, newobj); _SetupRequired(obj); }