Esempio n. 1
0
        public static PatientDocument[] GetPatientFileDetails(Patient patient)
        {
            EntityModelContainer context = new EntityModelContainer(GetEntityConnection());

            PatientDocument[] result = context.PatientDocuments.Execute(MergeOption.NoTracking).Where(pd => pd.PatientId == patient.Id).ToArray();

            for (int i = 0; i < result.Length; i++)
            {
                int id = result[i].Id;
                DocumentStickyNote[] documentStickyNotes =
                    context.DocumentStickyNotes.Execute(MergeOption.NoTracking).Where(sn => sn.PatientDocumentId == id).ToArray();

                if (documentStickyNotes.Length!=0)
                    result[i].DocumentStickyNotes.AddRange(documentStickyNotes);
            }

            context.Dispose();
            return result;
        }
Esempio n. 2
0
        public static void BeginTransaction()
        {
            StackFrame stackFrame = new StackFrame(1);
            MethodBase callerMethod = stackFrame.GetMethod();
            Type callerType = callerMethod.DeclaringType;

            if (!_listContext.ContainsKey(callerType))
            {
                EntityModelContainer context = new EntityModelContainer(GetEntityConnection());
                context.ContextOptions.LazyLoadingEnabled = true;
                _listContext.Add(callerType, context);
                context.SavingChanges += new EventHandler(context_SavingChanges);
            }
        }
Esempio n. 3
0
 private static int GetAccountantSerialByColumnName(string columnName)
 {
     EntityModelContainer context = new EntityModelContainer(GetEntityConnection());
     ObjectResult<int?> serial = context.AccountantPagesCounterIncrementor(columnName);
     return serial.First().Value;
 }