public void Save(PhysicianRecordRequestSignature domain)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <PhysicianRecordRequestSignature, PhysicianRecordRequestSignatureEntity>(domain);

                DeactivateAll(domain.EventCustomerId);

                if (!adapter.SaveEntity(entity))
                {
                    throw new PersistenceFailureException("Unable to save physician record request signature.");
                }
            }
        }
Beispiel #2
0
        public IEnumerable <CallQueueCriteria> GetAllByCallQueueId(long callQueueId)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entities = (from cqc in linqMetaData.CallQueueCriteria
                                where cqc.CallQueueId == callQueueId
                                orderby cqc.Sequence
                                select cqc).ToArray();

                return(Mapper.Map <IEnumerable <CallQueueCriteriaEntity>, IEnumerable <CallQueueCriteria> >(entities));
            }
        }
Beispiel #3
0
        public List <EventCustomerRegistrationViewData> GetEventCustomerOrdersForEvent(long eventId)
        {
            var customerOrderBasicInfoTypedView = new CustomerOrderBasicInfoTypedView();
            var bucket = new RelationPredicateBucket(CustomerOrderBasicInfoFields.EventId == eventId);

            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                myAdapter.CommandTimeOut = CommandTimeOut;
                myAdapter.FetchTypedView(customerOrderBasicInfoTypedView, bucket, false);
            }
            var eventCustomerIds = customerOrderBasicInfoTypedView.Select(vw => vw.EventCustomerId).ToArray();

            return(_factory.Create(customerOrderBasicInfoTypedView, _physicianAssignmentService.GetPhysicianAssignments(eventId, eventCustomerIds)));
        }
Beispiel #4
0
        public CallQueueCustomerLock SaveCallQueueCustomerLock(CallQueueCustomerLock callQueueCustomerLock)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <CallQueueCustomerLock, CallQueueCustomerLockEntity>(callQueueCustomerLock);

                if (!adapter.SaveEntity(entity, true))
                {
                    throw new PersistenceFailureException();
                }

                return(Mapper.Map <CallQueueCustomerLockEntity, CallQueueCustomerLock>(entity));
            }
        }
Beispiel #5
0
        public void Save(EventCustomerGiftCard domain)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <EventCustomerGiftCard, EventCustomerGiftCardEntity>(domain);

                DeactivateAll(domain.EventCustomerId);

                if (!adapter.SaveEntity(entity))
                {
                    throw new PersistenceFailureException("Unable to save gift card answer and signature.");
                }
            }
        }
 public bool SaveScreeningAuthorizations(List <ScreeningAuthorization> screeningAuthorizations)
 {
     using (var adapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var entitiesToSave = _mapper.MapMultiple(screeningAuthorizations);
         var entities       = new EntityCollection <ScreeningAuthorizationEntity>();
         entities.AddRange(entitiesToSave);
         if (adapter.SaveEntityCollection(entities) == 0)
         {
             throw new PersistenceFailureException();
         }
         return(true);
     }
 }
 public void ActivateGiftCertificate(long id)
 {
     using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var entity = new GiftCertificateEntity {
             IsActive = true
         };
         var bucket = new RelationPredicateBucket(GiftCertificateFields.GiftCertificateId == id);
         if (myAdapter.UpdateEntitiesDirectly(entity, bucket) == 0)
         {
             throw new PersistenceFailureException();
         }
     }
 }
Beispiel #8
0
        public FluConsentTemplate Save(FluConsentTemplate domain)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <FluConsentTemplate, FluConsentTemplateEntity>(domain);

                if (!adapter.SaveEntity(entity, true))
                {
                    throw new PersistenceFailureException();
                }

                return(Mapper.Map <FluConsentTemplateEntity, FluConsentTemplate>(entity));
            }
        }
Beispiel #9
0
        public Script Save(Script domain)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <Script, ScriptsEntity>(domain);

                if (!adapter.SaveEntity(entity, true))
                {
                    throw new PersistenceFailureException();
                }

                return(Mapper.Map <ScriptsEntity, Script>(entity));
            }
        }
Beispiel #10
0
        public string GetTestNamesByPackageId(long packageId)
        {
            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(myAdapter);

                var testNames = (from pt in linqMetaData.PackageTest
                                 join t in linqMetaData.Test on pt.TestId equals t.TestId
                                 where pt.PackageId == packageId
                                 select t.Name).ToArray();

                return(string.Join(",", testNames));
            }
        }
Beispiel #11
0
        public List <Test> GetPermittedTestsForaPhysician(long orgRoleUserId)
        {
            var testEntities = new EntityCollection <TestEntity>();
            IRelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.Relations.Add(TestEntity.Relations.PhysicianPermittedTestEntityUsingTestId);
            bucket.PredicateExpression.Add(PhysicianPermittedTestFields.OrganizationRoleUserId == orgRoleUserId);

            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                myAdapter.FetchEntityCollection(testEntities, bucket);
            }
            return(Mapper.MapMultiple(testEntities).ToList());
        }
Beispiel #12
0
        public List <string> GetAliasListByTestIdList(IEnumerable <long> testIds)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entities = (from t in linqMetaData.Test
                                where testIds.Contains(t.TestId) && t.IsActive
                                select t.Alias);
                var aliases = entities.ToList();

                return(aliases);
            }
        }
        public IEnumerable <long> GetEventIdsForHospitalFacility(long hospitalFacilityId)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                return((from ehf in linqMetaData.EventHospitalFacility
                        join e in linqMetaData.Events on ehf.EventId equals e.EventId
                        where ehf.HospitalFacilityId == hospitalFacilityId &&
                        e.EventStatus.HasValue &&
                        e.EventStatus.Value == (int)EventStatus.Active
                        select e.EventId).ToList());
            }
        }
        public IEnumerable <HospitalFacility> GetByHospitalPartnerId(long hospitalPartnerId)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entities = (from hf in linqMetaData.HospitalFacility
                                join hphf in linqMetaData.HospitalPartnerHospitalFacility on hf.HospitalFacilityId equals hphf.HospitalFacilityId
                                where hphf.HospitalPartnerId == hospitalPartnerId
                                select hf).ToArray();

                return(_hospitalFacilityFactory.CreateHospitalFacilities(entities));
            }
        }
Beispiel #15
0
 public IEnumerable <string> GetScreenedEventHostNames(string prefixText)
 {
     using (var adapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var linqMetaData = new LinqMetaData(adapter);
         return
             ((from e in linqMetaData.Events
               join he in linqMetaData.HostEventDetails on e.EventId equals he.EventId
               join p in linqMetaData.Prospects on he.HostId equals p.ProspectId
               where p.OrganizationName.Contains(prefixText)
               select p.OrganizationName
               ).ToArray());
     }
 }
Beispiel #16
0
        public List <PaymentInstrument> GetPaymentInstrumentsForPayment(long medicalVendorPaymentId)
        {
            var checkEntities = new EntityCollection <CheckEntity>();
            var bucket        = new RelationPredicateBucket();

            bucket.Relations.Add(CheckEntity.Relations.MVPaymentCheckDetailsEntityUsingCheckId);
            bucket.Relations.Add(MVPaymentCheckDetailsEntity.Relations.PhysicianPaymentEntityUsingMvpaymentId);
            bucket.PredicateExpression.Add(PhysicianPaymentFields.PhysicianPaymentId == medicalVendorPaymentId);
            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                myAdapter.FetchEntityCollection(checkEntities, bucket);
            }
            return(_paymentInstrumentFactory.CreatePaymentInstruments(checkEntities));
        }
Beispiel #17
0
        public IEnumerable <AccessControlObject> GetAllowedAccessControlObjectsByRoleId(long roleId)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entities = (from raco in linqMetaData.RoleAccessControlObject
                                join aco in linqMetaData.AccessControlObject on raco.AccessControlObjectId equals aco.Id
                                where raco.RoleId == roleId && raco.PermissionTypeId == (long)PermissionType.Allow
                                select aco).WithPath(prefetch => prefetch.Prefetch(p => p.AccessControlObjectUrl).Prefetch(p => p.RoleAccessControlObject).Prefetch(p => p.AccessObjectScopeOption));

                return(Mapper.Map <IEnumerable <AccessControlObjectEntity>, IEnumerable <AccessControlObject> >(entities));
            }
        }
Beispiel #18
0
        public PreQualificationTestTemplate GetByName(string templateName)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entity = (from q in linqMetaData.PreQualificationTestTemplate where q.TemplateName.ToLower() == templateName select q).FirstOrDefault();
                if (entity == null)
                {
                    return(null);
                }
                return(Mapper.Map <PreQualificationTestTemplateEntity, PreQualificationTestTemplate>(entity));
            }
        }
        public decimal GetAmountUsedonGiftCertificate(long id)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);
                var gcPayments   = linqMetaData.GiftCertificatePayment.Where(gcp => gcp.GiftCertificateId == id).ToArray();
                if (gcPayments.IsNullOrEmpty())
                {
                    return(0);
                }

                return(gcPayments.Sum(gcp => gcp.Amount));
            }
        }
Beispiel #20
0
        public IEnumerable <ZipData> GetZipData(string zipCode, string stateCode)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entities = (from zd in linqMetaData.ZipData where zipCode == zd.ZipCode && stateCode == zd.State select zd).ToArray();
                if (entities != null && entities.Any())
                {
                    return(Mapper.Map <IEnumerable <ZipDataEntity>, IEnumerable <ZipData> >(entities));
                }
                return(null);
            }
        }
 public CustomerCallQueueCallAttempt Save(CustomerCallQueueCallAttempt domain, bool refatch = true)
 {
     using (var adapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var entity = Mapper.Map <CustomerCallQueueCallAttempt, CustomerCallQueueCallAttemptEntity>(domain);
         if (!adapter.SaveEntity(entity, refatch))
         {
             throw new PersistenceFailureException();
         }
         return(!refatch
             ? domain
             : Mapper.Map <CustomerCallQueueCallAttemptEntity, CustomerCallQueueCallAttempt>(entity));
     }
 }
Beispiel #22
0
        public PcpAppointment GetByCustomerIdEventId(long customerId, long eventId)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entity = (from pa in linqMetaData.PcpAppointment
                              join ec in linqMetaData.EventCustomers on pa.EventCustomerId equals ec.EventCustomerId
                              where ec.EventId == eventId && ec.CustomerId == customerId
                              select pa).SingleOrDefault();

                return(Mapper.Map <PcpAppointmentEntity, PcpAppointment>(entity));
            }
        }
        public bool Save(ZipRadiusDistance zipRadiusDistance)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <ZipRadiusDistance, ZipRadiusDistanceEntity>(zipRadiusDistance);

                if (!adapter.SaveEntity(entity, false))
                {
                    throw new PersistenceFailureException();
                }

                return(true);
            }
        }
Beispiel #24
0
        public State GetState(string stateName)
        {
            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(myAdapter);
                var stateEntity  = linqMetaData.State.Where(state => state.Name == stateName).SingleOrDefault();
                if (stateEntity == null)
                {
                    throw new Exception("Invalid State Name:" + stateName);
                }

                return(_mapper.Map(stateEntity));
            }
        }
        public List <TestHcpcsCode> GetAll()
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entity = (from h in linqMetaData.TestHcpcsCode
                              where h.IsActive
                              select h).ToArray();


                return((List <TestHcpcsCode>)Mapper.Map <IEnumerable <TestHcpcsCodeEntity>, IEnumerable <TestHcpcsCode> >(entity));
            }
        }
Beispiel #26
0
        public EventNotesLog SaveEventNotesLog(EventNotesLog domain)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <EventNotesLog, EventNotesLogEntity>(domain);

                if (!adapter.SaveEntity(entity, true))
                {
                    throw new PersistenceFailureException();
                }

                return(Mapper.Map <EventNotesLogEntity, EventNotesLog>(entity));
            }
        }
Beispiel #27
0
        public CallQueueCriteria GetById(long id)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var entity = (from cqc in linqMetaData.CallQueueCriteria where cqc.CallQueueCriteriaId == id select cqc).SingleOrDefault();
                if (entity == null)
                {
                    return(null);
                }
                return(Mapper.Map <CallQueueCriteriaEntity, CallQueueCriteria>(entity));
            }
        }
Beispiel #28
0
        public bool UpdateHostTaxIdNumber(long hostId, string taxIdNumber)
        {
            var host = new ProspectsEntity(hostId)
            {
                TaxIdNumber = taxIdNumber
            };
            IRelationPredicateBucket relationPredicateBucket =
                new RelationPredicateBucket(ProspectsFields.ProspectId == hostId);

            using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                return(myAdapter.UpdateEntitiesDirectly(host, relationPredicateBucket) > 0);
            }
        }
Beispiel #29
0
        public IEnumerable <OrderedPair <long, string> > GetBySearchText(string serachText)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var linqMetaData = new LinqMetaData(adapter);

                var ndcs = (from ec in linqMetaData.Ndc
                            where ec.ProductName.Contains(serachText)
                            select ec).ToArray();
                return(ndcs.Select(x => new OrderedPair <long, string> {
                    FirstValue = x.Id, SecondValue = x.ProductName
                }));
            }
        }
        public HealthPlanFillEventCallQueue Save(HealthPlanFillEventCallQueue healthPlanFillEventCallQueue)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = Mapper.Map <HealthPlanFillEventCallQueue, HealthPlanFillEventCallQueueEntity>(healthPlanFillEventCallQueue);

                if (!adapter.SaveEntity(entity, true))
                {
                    throw new PersistenceFailureException();
                }

                return(Mapper.Map <HealthPlanFillEventCallQueueEntity, HealthPlanFillEventCallQueue>(entity));
            }
        }