Example #1
0
            public VsSessionSummary Create
            (
                DbManagerProxy manager
                , VsSession session
                , GeoLocation location
            )
            {
                var summary = (Instance(null)).CreateNewT(manager, session);

                LocationHelper.CopyLocation(session.Location, summary.Location);
                return(summary);
            }
Example #2
0
            public void CheckOutbreak(VsSession 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.idfVectorSurveillanceSession),
                                                                   manager.Parameter("@idfOutbreak", obj.idfOutbreak))
                                                .ExecuteScalar <long>();
                        if (idfsCaseDiagnosis == 0)
                        {
                            var outbreak = Outbreak.Accessor.Instance(null).SelectByKey(manager, obj.idfOutbreak);
                            throw new ValidationModelException("msgOutbreakDiagnosisErrorCases", "idfOutbreak", "idfOutbreak",
                                                               new object[]
                            {
                                obj.strSessionID,
                                outbreak.strOutbreakID,
                                outbreak.Diagnosis == null ? "" : outbreak.Diagnosis.name
                            }, GetType(), ValidationEventType.Error, obj);
                        }

                        if (idfsCaseDiagnosis > 0)
                        {
                            var outbreak = Outbreak.Accessor.Instance(null).SelectByKey(manager, obj.idfOutbreak);
                            throw new ValidationModelException("msgUpOutbreakDiagnosisToGroup", "idfOutbreak", "idfOutbreak",
                                                               new object[]
                            {
                                outbreak.Diagnosis.name,
                                obj.strSessionID,
                                obj.strDiagnosesCalculated,
                                outbreak.DiagnosisLookup.Single(i => i.idfsDiagnosisOrDiagnosisGroup == outbreak.DiagnosisLookup.Single(c => c.idfsDiagnosisOrDiagnosisGroup == outbreak.idfsDiagnosisOrDiagnosisGroup).idfsDiagnosisGroup).name
                            }, GetType(), ValidationEventType.Question, obj);
                        }
                    }
                }
            }