Ejemplo n.º 1
0
        public void HealCitizen(Citizen citizen, Hospital hospital)
        {
            equipmentService.RemoveProductsFromEquipment(ProductTypeEnum.MedicalSupplies, 1, hospital.Company.Quality, hospital.Company.Entity.Equipment);
            HealingPrice healingPrice = hospitalRepository.GetHealingPrice(hospital.CompanyID, citizen.ID);

            if (healingPrice.Cost.HasValue)
            {
                transactionsService.PayForHealing(hospital, citizen, healingPrice);
            }

            HealCitizenProcess(citizen, hospital.Company.Quality);
            ConditionalSaveChanges(hospitalRepository);
        }
Ejemplo n.º 2
0
        public HospitalHealViewModel(Hospital hospital, IHospitalService hospitalService, IHospitalRepository hospitalRepository, bool showHospitalName = false)
        {
            HospitalID = hospital.CompanyID;

            HealingPrice = (double?)hospital.HealingPrice;

            HealingEnabled = hospital.HealingEnabled && SessionHelper.CurrentEntity.Is(EntityTypeEnum.Citizen);
            if (HealingEnabled)
            {
                var citizen = SessionHelper.LoggedCitizen;
                var result  = hospitalService.CanHealCitizen(SessionHelper.LoggedCitizen, hospital);
                CanHealYou      = result.isSuccess;
                NoHealingReason = result.ToString("<br/>"); //if there are no errors it will be empty.
                if (CanHealYou)
                {
                    CurrencySymbol = Persistent.Countries.GetCountryCurrency(hospital.Company.Region.Country).Symbol;
                    HealingPrice   = (double?)hospitalRepository.GetHealingPrice(hospital.CompanyID, citizen.ID).Cost;
                }
            }

            if (ShowHospitalName = showHospitalName)
            {
                HospitalName = hospital.Company.Entity.Name;
            }
        }