예제 #1
0
        public ListModelBase <HospitalPartnerCustomerViewModel, HospitalPartnerCustomerListModelFilter> GetHospitalPartnerEventCustomers(int pageNumber, int pageSize, ModelFilterBase filter, out int totalRecords)
        {
            using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadUncommitted
            }))
            {
                var normalValidityPeriod   = 0;
                var abnormalValidityPeriod = 0;
                var criticalValidityPeriod = 0;
                var customerFilter         = (filter as HospitalPartnerCustomerListModelFilter);

                HospitalPartner hospitalPartner = null;
                if (customerFilter != null)
                {
                    if (customerFilter.HospitalPartnerId > 0)
                    {
                        hospitalPartner        = _hospitalPartnerRepository.GetHospitalPartnerforaVendor(customerFilter.HospitalPartnerId);
                        normalValidityPeriod   = hospitalPartner.NormalResultValidityPeriod;
                        abnormalValidityPeriod = hospitalPartner.AbnormalResultValidityPeriod;
                        criticalValidityPeriod = hospitalPartner.CriticalResultValidityPeriod;
                    }
                    else if (customerFilter.HospitalFacilityId > 0)
                    {
                        var hospitalPartnerId = _hospitalFacilityRepository.GetHospitalPartnerId(customerFilter.HospitalFacilityId);

                        if (hospitalPartnerId > 0)
                        {
                            hospitalPartner        = _hospitalPartnerRepository.GetHospitalPartnerforaVendor(hospitalPartnerId);
                            normalValidityPeriod   = hospitalPartner.NormalResultValidityPeriod;
                            abnormalValidityPeriod = hospitalPartner.AbnormalResultValidityPeriod;
                            criticalValidityPeriod = hospitalPartner.CriticalResultValidityPeriod;
                        }
                    }
                }
                var eventCustomers = _eventCustomerRepository.EventCustomersForHospitalPartner(pageNumber, pageSize, filter as HospitalPartnerCustomerListModelFilter, out totalRecords, normalValidityPeriod, abnormalValidityPeriod, criticalValidityPeriod);

                var model = eventCustomers.IsNullOrEmpty() ? null : GetCustomers(eventCustomers, hospitalPartner);

                t.Complete();
                return(model);
            }
        }