public static Thing SpawnBloodFromExtraction(Pawn extractee, bool isBloodPack = false) { BloodType type = BloodTypeUtility.BloodType(extractee); Thing result = null; switch (type) { case BloodType.Animal: result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_Animal : null); break; case BloodType.LowBlood: result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_LowBlood : VampDefOf.BloodVial_LowBlood); break; case BloodType.AverageBlood: result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_AverageBlood : VampDefOf.BloodPack_AverageBlood); break; case BloodType.HighBlood: result = (Thing)ThingMaker.MakeThing(isBloodPack ? VampDefOf.BloodPack_HighBlood : VampDefOf.BloodVial_HighBlood); break; case BloodType.Special: result = (Thing)ThingMaker.MakeThing(isBloodPack ? null : VampDefOf.BloodVial_Special); break; } if (result != null) { result.stackCount = 1; GenPlace.TryPlaceThing(result, extractee.PositionHeld, extractee.Map, ThingPlaceMode.Near); extractee.BloodNeed().AdjustBlood(isBloodPack ? -AMT_BLOODPACK : -AMT_BLOODVIAL); } return(result); }
/* * Converts a given BloodType Enum into a string that is easily read by our attribute Pickers */ public static String ToString(this BloodType value) { switch (value) { case BloodType.AB_NEG: return("AB-"); case BloodType.AB_POS: return("AB+"); case BloodType.A_NEG: return("A-"); case BloodType.A_POS: return("A+"); case BloodType.B_NEG: return("B-"); case BloodType.B_POS: return("B+"); case BloodType.O_NEG: return("O-"); case BloodType.O_POS: return("O+"); default: // Unreachable return(null); } }
public void AddBlood(BloodType type, Vector2 position, Vector2 direction, Color4ub? color = null) { //Eclaboussure Blood blood = null; switch (type) { case BloodType.A: blood = new Blood1(); break; case BloodType.B: blood = new Blood2(); break; case BloodType.C: blood = new Blood3(); break; case BloodType.D: blood = new Blood4(); break; } blood.SetPosition(position); blood.SetDirection(direction); blood.SetColor(color); AddBlood(blood); //Sang sur le sol blood = new BloodFloor1(); blood.SetPosition(position); var angle = (float)Math.Atan2(direction.Y, direction.X); blood.SetDirection(angle + (float)((RandomGenerator.Instance.Random.NextDouble() * 2) - 1)); blood.SetColor(color); AddStaticBlood(blood); }
public ActionResult Edit(PatientViewModel viewModel) { Patient patient = Mapper.Map <Patient>(viewModel); Country nationality = _patientService.GetCountry(viewModel.SelectedNationality); patient.Nationality = nationality; BloodType bloodType = _patientService.GetBloodType(viewModel.SelectedBloodType); patient.BloodType = bloodType; using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:58888/api/Patient/5"); var postTask = client.PutAsJsonAsync("patient", patient); postTask.Wait(); var result = postTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("Index", "Home", new { message = "Edited!" })); } ViewBag.Error = result.Content; } var countries = _patientService.GetCountries(); viewModel.Countries = countries; var bloodTypes = _patientService.GetBloodTypes(); viewModel.BloodTypes = bloodTypes; return(View(viewModel)); }
public IHttpActionResult PutBloodType(int id, BloodType bloodType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bloodType.ID) { return(BadRequest()); } db.Entry(bloodType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BloodTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
//constructor 1 public Patient(string name, DateTime dob, BloodType blood) { Name = name; DOB = dob; Blood = blood; Age = GetAge(dob); }
public IEnumerable <Tuple <BloodType, int> > ReadBloodSuply() { using (SqlConnection conn = new SqlConnection(connectionString)) { if (!TryConnect(conn)) { yield break; } using (SqlCommand command = conn.CreateCommand()) { command.CommandText = "SELECT [BLOOD_TYPE],[UNITS] FROM [dbo].[BLOOD_SUPPLY]"; command.CommandType = CommandType.Text; SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { BloodType bloodType = (BloodType)reader.GetInt32(0); int units = reader.GetInt32(1); yield return(new Tuple <BloodType, int>(bloodType, units)); } } } } }
public MedicalRecord(Patient patient, BloodType bloodType) { _patient = patient; _patientBloodType = bloodType; _patientDiagnosis = new List <Diagnosis>(); _allergy = new List <Allergy>(); }
public MedicalRecord(Patient patient, BloodType bloodType, List <Diagnosis> patientDiagnosis, List <Allergy> patientAllergies) { _patient = patient; _patientBloodType = bloodType; _patientDiagnosis = patientDiagnosis; _allergy = patientAllergies; }
public int GetBloodId(BloodType bloodType, RhD resusFactor) { return(this.db.Bloods .Where(b => b.BloodType == bloodType && b.RhD == resusFactor) .Select(b => b.Id) .FirstOrDefault()); }
public ActionResult DeleteConfirmed(int id) { BloodType bloodType = db.BloodType.Find(id); db.BloodType.Remove(bloodType); db.SaveChanges(); return(RedirectToAction("Index")); }
//contructor for patient which uses the Ward Base class - counter for number of patients included public Patient(string wardName, int capacity, string patientName, BloodType type, DateTime dob) : base(wardName, capacity) { PatientName = patientName; BloodGroup = type; DOB = dob; numberOfPatients++; }
public static bool WillConsume(BloodType bl, BloodPreferabilty pref) { if ((int)bl < (int)pref) { return(false); } return(true); }
public AddDonation(DateTime dateOfDonation, int volume, BloodType bloodType, string donorPesel, string bloodTakerPesel) { DateOfDonation = dateOfDonation; Volume = volume; BloodType = bloodType; DonorPesel = donorPesel; BloodTakerPesel = bloodTakerPesel; }
public MedicalRecord(Patient patient) { _patient = patient; _patientBloodType = BloodType.NOT_TESTED; _patientDiagnosis = new List <Diagnosis>(); _allergy = new List <Allergy>(); }
public int GetAvailableUnits(BloodType bloodType) { if (!unitsByBloodType.TryGetValue(bloodType, out int units)) { unitsByBloodType[bloodType] = 0; } return(units); }
public static string GetDisplayName(this BloodType bloodType) { return(bloodType.GetType() .GetMember(bloodType.ToString()) .First() .GetCustomAttribute <DisplayAttribute>() .GetName()); }
public RegisterDonor(string pesel, string name, BloodType bloodType, string mail, string phone) { Pesel = pesel; Name = name; BloodType = bloodType; Mail = mail; Phone = phone; }
public Patient(string name, DateTime dOB, BloodType blood) { Name = name; DOB = dOB; Blood = blood; if (Name == "") Name = "John Doe"; }
public Donner(string cin, string lastName, string firstName, BloodType bloodGrp, RH rhesus) { CIN = cin; LastName = lastName; FirstName = firstName; BloodGrp = bloodGrp; Rhesus = rhesus; }
public Donor(string Name, string LastName, int Age, bool IsMale, BloodType Blood) { this.Ime = Name; this.Prezime = LastName; this.Godine = Age; this.Pol = IsMale; this.KrvnaGrupa = (int)Blood; this.id = id + 1; }
/// <summary> /// Finds the splatter <see cref="IItemTypeEntity"/> for a given blood type. /// </summary> /// <param name="bloodType">The type of blood to look the item type for.</param> /// <returns>The <see cref="IItemTypeEntity"/> that's predefined for that blood type, or null if none is.</returns> public IItemTypeEntity FindPoolForBloodType(BloodType bloodType) { if (this.liquidPoolPerBloodType != null && this.liquidPoolPerBloodType.TryGetValue(bloodType, out IItemTypeEntity splatterItemType)) { return(splatterItemType); } return(null); }
public Donor(long id, string firstName, string lastName, string emailAddress, BloodType bloodType) { Id = id; FirstName = firstName; LastName = lastName; Email = emailAddress; BloodType = bloodType; LastDonation = null; }
public JsonResult Edit([FromForm] BloodTypeForm bloodTypeForm) { BloodType bloodType = _context.BloodType.FirstOrDefault(b => b.Id == bloodTypeForm.Id); bloodType.Name = bloodTypeForm.Name; _context.SaveChanges(); return(Json(bloodType)); }
public ActionResult Edit([Bind(Include = "BloodTypeId,Name")] BloodType bloodType) { if (ModelState.IsValid) { db.Entry(bloodType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bloodType)); }
public BloodTypeDTO CreateSetup(BloodTypeDTO _Setup) { var db = new StoreContext(); BloodType Setup = mapper.Map <BloodType>(_Setup); db.Add(Setup); db.SaveChanges(); return(mapper.Map <BloodTypeDTO>(Setup)); }
public JsonResult Add([FromForm] BloodTypeForm bloodTypeForm) { BloodType bloodType = new BloodType(); bloodType.Name = bloodTypeForm.Name; _context.BloodType.Add(bloodType); _context.SaveChanges(); return(Json(bloodType)); }
public override string ToString() { return($"Id: {Id}, Name: {Name}, NameKana: {NameKana ?? "NULL"}, NameRomaji: {NameRomaji ?? "NULL"}, " + $"Nickname: {Nickname ?? "NULL"}, Gender: ({Gender?.ToString() ?? "NULL"}), " + $"Birthdate: {Birthdate.ToString() ?? "NULL"}, BloodType: ({BloodType?.ToString() ?? "NULL"}), " + $"Height: {Height?.ToString() ?? "NULL"}, Hometown: {Hometown ?? "NULL"}, " + $"DebutYear: {DebutYear?.ToString() ?? "NULL"}, SpouseName: {SpouseName ?? "NULL"}, " + $"Agency: ({Agency?.ToString() ?? "NULL"}), PictureUrl: {PictureUrl ?? "NULL"}, " + $"IsFavorite: {IsFavorite}, IsCompleted: {IsCompleted}, CreatedAt: {CreatedAt}, UpdatedAt: {UpdatedAt}"); }
public async Task <IHttpActionResult> GetBloodType(int id) { BloodType bloodType = await db.BloodTypes.FindAsync(id); if (bloodType == null) { return(NotFound()); } return(Ok(bloodType)); }
public void CreatePatient(string username, string name, string surname, DateTime dateOfBirth, string phoneNumber, string email, string parentsName, string gender, string jmbg, bool isGuest, BloodType blood, string lbo) { Patient patient = new Patient(username, name, surname, dateOfBirth, phoneNumber, email, parentsName, gender, jmbg, isGuest, blood, lbo); _patientsFile.patients.Add(patient); AccountController.GetInstance().AddNewAccount(new Account(username, "pass", patient)); }
public MedicalRecord(PatientCondition currHealthState, BloodType bloodType, string patientId) { CurrHealthState = currHealthState; BloodType = bloodType; Allergens = new List <Allergens>(); Vaccines = new List <Vaccines>(); IllnessHistory = new List <Diagnosis>(); Therapies = new List <Therapy>(); FamilyIllnessHistory = new List <FamilyIllnessHistory>(); PatientId = patientId; }
public void EnumValueFromIndexTest() { BloodType first = 0; int amountOfTypes = EnumUtils.EnumLength <BloodType>(); BloodType last = (BloodType)(amountOfTypes - 1); Assert.AreNotEqual(first, last); last -= amountOfTypes; last++; Assert.AreEqual(first, last); }
private static Unit CreateUnit(BloodType type,Random rng) { Unit unit = null; float timeBonus = 0.5f + (float)rng.NextDouble(); if (type == BloodType.A) { unit = new BloodA(); unit.RansomAmount = (int)(50000 * timeBonus); unit.RansomTimeLeft = (int)(80 * timeBonus); } else if (type == BloodType.B) { unit = new BloodB(); unit.RansomAmount = (int)(50000 * timeBonus); unit.RansomTimeLeft = (int)(50 * timeBonus); } else if (type == BloodType.O) { unit = new BloodO(); unit.RansomAmount = (int)(50000 * timeBonus); unit.RansomTimeLeft = (int)(70 * timeBonus); } unit.CurrentFacingDirection = Helper.RandomDirection(false); unit.BorderColor = new Color(rng.Next(100, 256), rng.Next(100, 256), rng.Next(100, 256), 255); unit.InternalColor = new Color(rng.Next(100, 256), rng.Next(100, 256), rng.Next(100, 256), 255); return unit; }
public Patient(BloodType blood) : this("John Doe", DateTime.Now, blood) { }
public BloodTypeDatum(DateTimeOffset timestamp, BloodType bloodType) : base(timestamp) { _bloodType = bloodType; }