public void passturn() { float foodn = resources.food; float orangesn = resources.oranges; float watern = resources.water; float boozen = resources.booze; float goldn = resources.gold; resources.dirtiness++; PlayerInteractor.UpdatePlayerChoices(); turncount++; EventManagerList.Turn(); Illness.TurnDisease(pirates); foreach (pirate p in pirates) { p.eat(FoodState); p.drink(WaterState); } checkdead(); PlayerInteractor.UpdateReport(foodn - resources.food, watern - resources.water, orangesn - resources.oranges, boozen - resources.booze, goldn - resources.gold, pirates); }
internal Response SacuvajBolest(Illness illness) { SendRequest(illness, Operation.SacuvajBolest); Response r = (Response)formatter.Deserialize(stream); return(r); }
public void Add(Object entity) { Illness record = (Illness)entity; record.Id = GetId(RecordType.Illness); _dataMgr.Add(record); }
public void UpdateCurrentIllnesses() { currentIllnesses.Clear(); int nrIllnesses; int day = GameManager.Instance.currentDay; if (PlayerPrefs.GetInt("hardmode") == 1) { nrIllnesses = UnityEngine.Random.Range(Mathf.Max(4, day / 3), Mathf.Max(5, day / 2)); } else { nrIllnesses = UnityEngine.Random.Range(Mathf.Max(1, day / 3), Mathf.Max(3, day / 2)); } nrIllnesses = (nrIllnesses > 6) ? 6 : nrIllnesses; int limit = 5; for (uint i = 0; i < nrIllnesses; ++i) { int index = UnityEngine.Random.Range(0, limit); currentIllnesses.Add(InputController.IllnessesDef[index]); Illness temp = InputController.IllnessesDef[index]; InputController.IllnessesDef[index] = InputController.IllnessesDef[5]; InputController.IllnessesDef[5] = temp; --index; } UpdateLooks(); }
internal void SacuvajBolest(TextBox txtImeBolesti, TextBox txtKategorijaBolesti) { if (txtImeBolesti.Text == "" || txtKategorijaBolesti.Text == "") { MessageBox.Show("Pogresan unos."); return; } Illness i = new Illness() { IllnessName = txtImeBolesti.Text, IllnessCategory = txtKategorijaBolesti.Text, Doctor = MainController.Instance.Doctor }; try { Response r = Communication.Instance.SacuvajBolest(i); txtImeBolesti.Clear(); txtKategorijaBolesti.Clear(); MessageBox.Show("Illness saved!"); } catch (System.IO.IOException) { MessageBox.Show("Illness not saved."); return; } }
private void Update() { // deplete health health -= Time.deltaTime * sickeningRate; if (health > maxHealth) { health = maxHealth; } if (health >= 95.0f) { illness = Illness.None; illParticles.SetActive(false); } if (illness == Illness.Infection) { recoveryRate = 2f; sickeningRate = 4f; illParticles.SetActive(true); } else if (illness == Illness.HeartAttack) { recoveryRate = 4f; sickeningRate = 4f; illParticles.SetActive(true); } else if (illness == Illness.Stroke) { recoveryRate = 4f; sickeningRate = 2f; illParticles.SetActive(true); } else { recoveryRate = baseRecovery; sickeningRate = baseSickening; } // if the patient is not making a call && is not dead if (!isCalling && condition != Wellness.Death) { if (health / maxHealth < 0.75f) { // assign a call with a priority value based on condition call.StartCall(wellnessPriorities[Mathf.Clamp((int)condition, 0, wellnessPriorities.Length - 1)]); } } else if (condition == Wellness.Death && isTarget) { victoryCanvas.SetActive(true); Time.timeScale = 0.0f; } else if (condition == Wellness.Death) { illParticles.SetActive(false); illness = Illness.Dead; //affect sprite colour } }
public ActionResult DeleteConfirmed(int id) { Illness illness = db.IllnessSet.Find(id); db.IllnessSet.Remove(illness); db.SaveChanges(); return(RedirectToAction("Index")); }
protected override void Delete() { int _count = List(); int _option = GetOption("Please enter your selection: ", _count); string _id = List(_option); Illness _illness = (Illness)_ir.GetOne(_id); _ir.Remove(_illness); }
protected override void Add() { Illness illness = new Illness(); PopulateEventData(illness, "Name of illness (pneumonia, flu, food poisoning, etc): "); _ir.Add(illness); Console.WriteLine("\nAdded new illness."); }
void Awake() { _game = gameObject.AddComponent <Cold>(); _illness = ENUM_ILLNESS.COLD; _timeBeforeEndOfTheRound = _SecondsForGame; _chronometerRenderer = GameObject.FindGameObjectWithTag(Tags._chronometer).GetComponent <TextMesh>(); _finalScorePanel = GameObject.FindGameObjectWithTag(Tags._finalScorePanel); _cameraForScoring = GameObject.FindGameObjectWithTag(Tags._cameraForScoring); _goalScreen = GameObject.FindGameObjectWithTag(Tags._goalScreen); }
private void Next_Click(object sender, EventArgs e) { illNow = listIll.SelectedItem as Illness; var f4 = new ReciepForm(directory, doctor, illNow); Hide(); f4.ShowDialog(); this.Visible = true; this.Close(); }
public async Task <IHttpActionResult> Illness([FromBody] Illness illness) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var res = await HealthBookService.EditIllnessAsync(illness, await GetCurrentId()); return(Ok(res)); }
public Object GetOne(string id) { List <Illness> _list = _dataMgr.GetIllnesses(); Illness _illness = (from e in _list where e.Id == id select e).Single(); return((Object)_illness); }
public ActionResult Edit([Bind(Include = "Id,Name")] Illness illness) { if (ModelState.IsValid) { db.Entry(illness).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(illness)); }
private Response SacuvajBolest(Illness i) { bool res = Controller.Controller.Instance.SacuvajBolest(i); if (res) { return(createResponse(Signal.OK, "Illness saved!", res)); } return(createResponse(Signal.Error, "Illness not saved", res)); }
public ActionResult Create([Bind(Include = "Id,Name")] Illness illness) { if (ModelState.IsValid) { db.IllnessSet.Add(illness); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(illness)); }
void Start() { leftTextTM = leftText.GetComponent <TextMeshProUGUI>(); rightTextTM = rightText.GetComponent <TextMeshProUGUI>(); leftTitleTM = leftTitle.GetComponent <TextMeshProUGUI>(); rightTitleTM = rightTitle.GetComponent <TextMeshProUGUI>(); Illness.Initialize(); numPag = 1; SetText(numPag); }
public IActionResult Post([FromBody] Illness ill) { if (ill == null) { return(BadRequest()); } db.Illnesses.Add(ill); db.SaveChanges(); return(CreatedAtRoute("GetIllness", new Illness { id = ill.id }, ill)); }
public override double CalculateConsultationFee() { double consultationFee = 0; if (Illness.ToLower().Equals("fever") || Illness.ToLower().Equals("cough")) { consultationFee = base.CalculateConsultationFee() - 10; } else { consultationFee = base.CalculateConsultationFee() + 10; } return(consultationFee); }
internal static void AddIllness(Illness illness, int dayCounter) { string holidayDescription = ""; int numbersOfDays = DateTime.DaysInMonth(MainForm.mainDate.Year, MainForm.mainDate.Month); Polaczenia.BeginTransactionSerializable(); for (int i = 1; i <= dayCounter; i++) { if (illness.Date.DayOfWeek == DayOfWeek.Sunday) { string temp = string.Format("Podawany dzień {0} jest dniem wolnym od pracy - NIEDZIELA\n Czy napewno dodać zasiłek do bazy danych?", illness.Date.ToShortDateString()); DialogResult result = MessageBox.Show(temp, "Pytanie", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { WorkManager.AddWorkTime(illness, ConnectionToDB.notDisconnect); } } else if (illness.Date.DayOfWeek == DayOfWeek.Saturday) { string temp = string.Format("Podawany dzień {0} jest dniem wolnym od pracy - SOBOTA\n Czy napewno dodać zasiłek do bazy danych?", illness.Date.ToShortDateString()); DialogResult result = MessageBox.Show(temp, "Pytanie", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { WorkManager.AddWorkTime(illness, ConnectionToDB.notDisconnect); } } //sprawdza czy nie przypada w dzień wolny - święto else if (Holidays.IsHoliday(illness.Date, out holidayDescription, ConnectionToDB.notDisconnect)) { string temp = string.Format("W dniu {0} przypada {1}.\nCzy napewno dodać zasiłek do bazy danych?", illness.Date.ToShortDateString(), holidayDescription); DialogResult result = MessageBox.Show(temp, "Pytanie", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { WorkManager.AddWorkTime(illness, ConnectionToDB.notDisconnect); } } else { WorkManager.AddWorkTime(illness, ConnectionToDB.notDisconnect); } illness.Date = illness.Date.AddDays(1);//next day } Polaczenia.CommitTransaction(); //jeżeli wpisuje godziny w ostatni dzień miesiąca to nie przechodzi na kolejny if (numbersOfDays != MainForm.mainDate.Day) { MainForm.mainDate = MainForm.mainDate.AddDays(1); } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Illness illness = db.IllnessSet.Find(id); if (illness == null) { return(HttpNotFound()); } return(View(illness)); }
public ActionResult Index(string variable, int id) { string[] variableTrimmed = variable.Split(' '); Illness ıllness = new Illness(); ıllness.Name = variableTrimmed[0]; ıllness.PId = id; db.Illness.Add(ıllness); db.SaveChanges(); var getPid = ıllness.Id; TempData["getPID"] = getPid; return(Json(Url.Action("AppointmentIndex", "Appointment", new { @id = id }))); }
internal static bool AssignIllnessData(Illness illness, out int dayCounter, MainForm form) { dayCounter = 0; try { MainForm.mainDate = Convert.ToDateTime(form.tbIllnessDate.Text); //jeżeli wpisywanie wielu dni if (form.chBoxIllnessMulti.Checked) { DateTime fromDate = form.dtpIllness.Value.Date; DateTime toDate = Convert.ToDateTime(form.tbIllnessDate.Text); dayCounter = Convert.ToInt32((fromDate - toDate).Days + 1);//np od 10 - 13 = 3, a ma być 4 (<=13) illness.IdEmployee = Convert.ToInt32(form.cbSelectEmployeeWork.SelectedValue); illness.Date = Convert.ToDateTime(form.tbIllnessDate.Text); illness.IdIllnessType = Convert.ToInt32(form.cbIllnessType.SelectedValue); if (toDate > fromDate) { throw new WrongDateTimeException("Data rozpoczęcia choroby jest mniejsza od daty zakończenia.\n Popraw datę i spróbuj ponownie"); } return(true); } //jeżeli wpisywanie jednego dnia else { dayCounter = 1; illness.IdEmployee = Convert.ToInt32(form.cbSelectEmployeeWork.SelectedValue); illness.Date = Convert.ToDateTime(form.tbIllnessDate.Text); illness.IdIllnessType = Convert.ToInt32(form.cbIllnessType.SelectedValue); return(true); } } catch (WrongDateTimeException ex) { MessageBox.Show(ex.Message, "Błąd przy wpisywaniu godzin.", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } catch (FormatException) { MessageBox.Show("Wpisałeś niepoprawną datę rozpoczęcia lub zakończenia choroby.\nPopraw dane i spróbuj ponownie.", "Błąd przy wpisywaniu choroby.", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } catch (Exception ex) { //log LogErr.DodajLogErrorDoBazy(new LogErr(Polaczenia.idUser, DateTime.Now, Polaczenia.ip, 0, NazwaTabeli.choroba, "MainForm.btnDodajGodziny_Click()/n/n" + ex.Message)); MessageBox.Show(ex.Message, "Błąd przy wpisywaniu choroby.", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
public async Task <Illness> AddIllnessAsync(Illness illness, long healthbookId, string userId) { var hb = await UnitOfWork.HealthBooksRepository.GetEntityAsync(healthbookId); if (hb == null || hb.OwnerId != userId) { return(null); } illness.HealthBookId = healthbookId; illness.OwnerId = userId; var ill = UnitOfWork.IllnessesRepository.Add(illness); return(ill); }
public async Task <IllnessResponse> SaveAsync(Illness illness) { try { await _illnessRepository.AddAsync(illness); await _unitOfWork.CompleteAsync(); return(new IllnessResponse(illness)); } catch (Exception ex) { return(new IllnessResponse($"An error ocurred while saving illness: {ex.Message}")); } }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Illness illness = db.IllnessSet.Find(id); if (illness == null) { return(HttpNotFound()); } ViewBag.Patients = illness.MedCard; return(View(illness)); }
public void Update_Test() { try { illness_testObject.ID = ADOIllness1.ID; illness_testObject.Name = "IllnessTest3"; busstaion.SaveChanges(illness_testObject, UIActionType.EDIT); ClearSession(); illness_testObject = busstaion.GetByID(ADOIllness1.ID); Assert.AreEqual(illness_testObject.Name, "IllnessTest3"); } catch (Exception ex) { Assert.Fail(ex.Message); } }
public void AddIllness(string name) { IllnessRepository symrepo = new IllnessRepository(); Illness newilln = new Illness(); newilln.Illnessname = name; var find = da.Symptomses.ToList(); if (!find.Exists(x => x.symptomsname == name)) { symrepo.Insert(newilln); } else { } }
public ActionResult DeleteIllness(int patientId, int id) { Patient patient = db.PatientSet.Find(patientId); Illness illness = db.IllnessSet.Find(id); if (ModelState.IsValid) { patient.MedCard.Illness.Remove(illness); illness.MedCard.Remove(patient.MedCard); db.Entry(patient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Edit", patient)); } return(View(patient)); }
internal static void CheckPossibilityToSaveIllness(Illness illness, int dayCounter) { //sprawdza, czy był już wpis o podanej dacie w tabeli chobora if (illness.IsAlreadyInDataBase()) { throw new AlreadyExistsException(string.Format("W dniu {0} pracownik był na zasiłku.\nProszę sprawdzić datę i spróbować ponownie.", illness.Date.ToShortDateString())); } else if (DayOff.IsAlreadyInDataBase(illness.IdEmployee, illness.Date)) { throw new AlreadyExistsException(string.Format("W dniu {0} pracownik był na urlopie.\nCzy napewno dodać zasiłek do bazy danych?", illness.Date.ToShortDateString())); } else if (Work.IsAlreadyInDataBase(illness.IdEmployee, illness.Date)) { throw new AlreadyExistsException(string.Format("W dniu {0} pracownik był w pracy.\nCzy napewno dodać zasiłek do bazy danych?", illness.Date.ToShortDateString())); } }