예제 #1
0
        public MedicalVendor Save(MedicalVendor medicalVendor)
        {
            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var medicalVendorProfileEntity = _medicalVendorFactory.CreateMedicalVendorEntity(medicalVendor);
                try
                {
                    var entity = new MedicalVendorProfileEntity(medicalVendor.Id);
                    if (myAdapter.FetchEntity(entity))
                    {
                        medicalVendorProfileEntity.IsNew = false;
                    }
                }
                catch (ObjectNotFoundInPersistenceException <MedicalVendor> )
                {
                    medicalVendorProfileEntity.IsNew = true;
                }
                if (!myAdapter.SaveEntity(medicalVendorProfileEntity, true))
                {
                    throw new PersistenceFailureException();
                }

                medicalVendor.Id = medicalVendorProfileEntity.OrganizationId;
                return(medicalVendor);
            }
        }
예제 #2
0
 /// <summary> setups the sync logic for member _medicalVendorProfile</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncMedicalVendorProfile(IEntity2 relatedEntity)
 {
     if (_medicalVendorProfile != relatedEntity)
     {
         DesetupSyncMedicalVendorProfile(true, true);
         _medicalVendorProfile = (MedicalVendorProfileEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity(_medicalVendorProfile, new PropertyChangedEventHandler(OnMedicalVendorProfilePropertyChanged), "MedicalVendorProfile", MedicalVendorCustomerPayRatesEntity.Relations.MedicalVendorProfileEntityUsingOrganizationId, true, new string[] {  });
     }
 }
예제 #3
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _medicalVendorProfile = null;
            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
예제 #4
0
        public MedicalVendorProfileEntity CreateMedicalVendorEntity(MedicalVendor vendor)
        {
            var profileEntity = new MedicalVendorProfileEntity(vendor.Id)
            {
                ContractId                   = vendor.ContractId,
                TypeId                       = (long)vendor.MedicalVendorType,
                IsHospitalPartner            = vendor.IsHospitalPartner,
                ResultLetterCoBrandingFileId = vendor.ResultLetterCoBrandingFileId,
                DoctorLetterFileId           = vendor.DoctorLetterFileId
            };

            return(profileEntity);
        }
예제 #5
0
        protected MedicalVendorCustomerPayRatesEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            if (SerializationHelper.Optimization != SerializationOptimization.Fast)
            {
                _medicalVendorProfile = (MedicalVendorProfileEntity)info.GetValue("_medicalVendorProfile", typeof(MedicalVendorProfileEntity));
                if (_medicalVendorProfile != null)
                {
                    _medicalVendorProfile.AfterSave += new EventHandler(OnEntityAfterSave);
                }
                base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance());
            }

            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
예제 #6
0
        public MedicalVendor GetMedicalVendor(long medicalVendorId)
        {
            using (var myAdapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var            medicalVendorProfileEntity = new MedicalVendorProfileEntity(medicalVendorId);
                IPrefetchPath2 path = new PrefetchPath2(EntityType.MedicalVendorProfileEntity);
                path.Add(MedicalVendorProfileEntity.PrefetchPathOrganization);

                if (!myAdapter.FetchEntity(medicalVendorProfileEntity, path))
                {
                    throw new ObjectNotFoundInPersistenceException <MedicalVendor>(medicalVendorId);
                }
                var medicalVendor = _medicalVendorFactory.CreateMedicalVendor(medicalVendorProfileEntity);
                return(medicalVendor);
            }
        }
예제 #7
0
        public MedicalVendor CreateMedicalVendor(MedicalVendorProfileEntity medicalVendorEntity)
        {
            if (medicalVendorEntity == null)
            {
                throw new ArgumentNullException("medicalVendorEntity");
            }
            //TODO: Copy constrotor for Organization. Is this a code smell? - Yasir
            var medicalVendor = medicalVendorEntity.Organization != null ? new MedicalVendor(_mapper.Map(medicalVendorEntity.Organization)) : new MedicalVendor(medicalVendorEntity.OrganizationId);

            medicalVendor.ContractId                   = medicalVendorEntity.ContractId;
            medicalVendor.MedicalVendorType            = (MedicalVendorType)medicalVendorEntity.TypeId;
            medicalVendor.IsHospitalPartner            = medicalVendorEntity.IsHospitalPartner;
            medicalVendor.ResultLetterCoBrandingFileId = medicalVendorEntity.ResultLetterCoBrandingFileId;
            medicalVendor.DoctorLetterFileId           = medicalVendorEntity.DoctorLetterFileId;

            return(medicalVendor);
        }
        public void CreateMedicalVendor_ReturnsAvaildDomainObject()
        {
            _medicalVendorFactory = IoC.Resolve <IMedicalVendorFactory>();
            var medicalVendorProfile = new MedicalVendorProfileEntity
            {
                ContractId        = 2,
                TypeId            = 1,
                IsHospitalPartner = false,
                Organization      = new OrganizationEntity {
                    Name = "Medical Vendor One",
                }
            };

            var actualMedicalVendor = _medicalVendorFactory.CreateMedicalVendor(medicalVendorProfile);

            Assert.AreEqual("Medical Vendor One", actualMedicalVendor.Name);
        }
예제 #9
0
 /// <summary> Removes the sync logic for member _medicalVendorProfile</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncMedicalVendorProfile(bool signalRelatedEntity, bool resetFKFields)
 {
     base.PerformDesetupSyncRelatedEntity(_medicalVendorProfile, new PropertyChangedEventHandler(OnMedicalVendorProfilePropertyChanged), "MedicalVendorProfile", MedicalVendorCustomerPayRatesEntity.Relations.MedicalVendorProfileEntityUsingOrganizationId, true, signalRelatedEntity, "MedicalVendorCustomerPayRates", false, new int[] { (int)MedicalVendorCustomerPayRatesFieldIndex.OrganizationId });
     _medicalVendorProfile = null;
 }