Example #1
0
 private void ClearAllTreatments()
 {
     MakeUp(false);
     WashUp(false);
     Mummify(false);
     treatmentType = TreatmentType.None;
 }
Example #2
0
    public void SetTreatment(TreatmentType treatmentType, GameObject paint = null)
    {
        switch (treatmentType)
        {
        case TreatmentType.MakeUp:
            MakeUp(true);
            break;

        case TreatmentType.WashUp:
            WashUp(true);
            ConnectedBodyPart?.WashUp(true);
            break;

        case TreatmentType.Mummify:
            Mummify(true);
            ConnectedBodyPart?.Mummify(true);
            break;

        case TreatmentType.None:
            ClearAllTreatments();
            ConnectedBodyPart?.ClearAllTreatments();
            break;

        default:
            Debug.LogError("Something Went Wrong");
            break;
        }
    }
        public Treatment ViewModelToModel(TreatmentDetailViewModel vm)
        {
            Patient patient = new Patient()
            {
                Id = vm.PatientId,
            };

            TreatmentType treatmenttype = new TreatmentType()
            {
                Id = vm.TypeId,
            };

            Treatment treatment = new Treatment()
            {
                Id            = vm.Id,
                Name          = vm.Name,
                Patient       = patient,
                BeginDate     = vm.BeginDate + vm.BeginTime,
                EndDate       = vm.EndDate + vm.EndTime,
                TreatmentType = treatmenttype,
                PatientName   = vm.PatientName
            };

            return(treatment);
        }
        /// <summary>
        /// Get a TreatmentType by TreatmentId
        /// </summary>
        /// <param name="id" > TreatmentId </param>
        /// <returns> TreatmentType </returns>
        public TreatmentType GetByTreatmentId(long id)
        {
            try
            {
                // Create result
                TreatmentType result = new TreatmentType();
                // Set query
                string query = "SELECT * FROM PTS2_TreatmentType WHERE [Id] = @id";


                // Tell the handler to execute the query
                var dbResult = handler.ExecuteSelect(query, id) as DataTable;

                // Parse all rows
                foreach (DataRow dr in dbResult.Rows)
                {
                    // Parse only if succeeded
                    if (parser.TryParse(dr, out TreatmentType treatmentType))
                    {
                        result = treatmentType;
                    }
                }

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Example #5
0
        public async Task <TreatmentType> Add(TreatmentType treatmentType)
        {
            var result = _context.TreatmentTypes.Add(treatmentType);
            await _context.SaveChangesAsync();

            return(result.Entity);
        }
        public IHttpActionResult PostTreatmentType(TreatmentType treatmentType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TreatmentTypes.Add(treatmentType);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (TreatmentTypeExists(treatmentType.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = treatmentType.Id }, treatmentType));
        }
Example #7
0
 public void AddTreatment(string treatmentName, TreatmentType treatmentType)
 {
     if (!unitsDico.ContainsKey(treatmentName))
     {
         unitsDico[treatmentName] = new Treatment(treatmentName, treatmentType);
     }
 }
        public IHttpActionResult PutTreatmentType(int id, TreatmentType treatmentType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != treatmentType.Id)
            {
                return(BadRequest());
            }

            db.Entry(treatmentType).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TreatmentTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #9
0
        public async Task <IActionResult> PutTreatmentType(int id, TreatmentType treatmentType)
        {
            if (id != treatmentType.TreatmentTypeId)
            {
                return(BadRequest());
            }

            _context.Entry(treatmentType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TreatmentTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetTreatmentType", new { id = treatmentType.TreatmentTypeId }, treatmentType));
        }
Example #10
0
        public async Task <ActionResult <TreatmentType> > PostTreatmentType(TreatmentType treatmentType)
        {
            _context.TreatmentTypes.Add(treatmentType);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTreatmentType", new { id = treatmentType.TreatmentTypeId }, treatmentType));
        }
        //TODO: Moet een dokter ook niet de treatment details kunnen inzien?
        public IActionResult Details(long id)
        {
            // Check if id is set
            if (id < 1)
            {
                return(BadRequest("No user found"));
            }

            // Retrieve from db
            TreatmentType model             = repository.GetById(id);
            TreatmentTypeDetailViewModel vm = converter.ModelToViewModel(model);

            // Get all departments for select list
            List <Department>            departments = departmentRepository.GetAll();
            IEnumerable <SelectListItem> items       =
                from value in departments
                select new SelectListItem
            {
                Text     = value.Name,
                Value    = value.Id.ToString(),
                Selected = (value.Id == vm.DepartmentId)
            };

            vm.Departments = items.ToList();

            return(View(vm));
        }
        public void Add()
        {
            EmptyLists();
            TreatmentType treatmentType = new TreatmentType();

            treatmentTypeRepository = new TreatmentTypeRepository(context);
            Assert.Equal(10, treatmentTypeRepository.Insert(treatmentType));
        }
 /// <summary>
 /// Update treatmenttype in database
 /// </summary>
 /// <param name="treatment"></param>
 /// <returns></returns>
 public bool Update(TreatmentType treatment)
 {
     // Update through context
     if (treatment == null)
     {
         throw new NullReferenceException("Het behandelingsType is leeg.");
     }
     return(context.Update(treatment));
 }
 /// <summary>
 /// Add treatmenttype in database
 /// </summary>
 /// <param name="treatment"></param>
 /// <returns></returns>
 public long Insert(TreatmentType treatment)
 {
     // Insert through context
     if (treatment == null)
     {
         throw new NullReferenceException("Het behandelingsType is leeg.");
     }
     return(context.Insert(treatment));
 }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            TreatmentType treatmentType = await db.TreatmentTypes.FindAsync(id);

            db.TreatmentTypes.Remove(treatmentType);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Example #16
0
        public void TreatmentTypeConstructor()
        {
            string        name          = "Tnad trekken";
            string        description   = "tand uithalen";
            TreatmentType treatmentType = new TreatmentType(name, description);

            Assert.Equal(name, treatmentType.Name);
            Assert.Equal(description, treatmentType.Description);
        }
Example #17
0
 public bool Delete(TreatmentType treatmentType)
 {
     if (BaseMemoryContext.treatmentTypes.Exists(t => t.Id == treatmentType.Id))
     {
         BaseMemoryContext.treatmentTypes.FirstOrDefault(t => t.Id == treatmentType.Id).Active = treatmentType.Active;
         return(true);
     }
     return(false);
 }
Example #18
0
        public void TestToString()
        {
            Patient       patient       = new Patient(1, "username", "email", "password", "name", DateTime.Today, "phonenumber", true, Gender.Female, 23);
            Doctor        doctor        = new Doctor(1, "username", "email", "password", "name", DateTime.Today, "phonenumber", true, Gender.Female);
            TreatmentType treatmentType = new TreatmentType("name", "description");
            Treatment     treatment     = new Treatment(1, "name", DateTime.MinValue, DateTime.Today, patient, doctor, treatmentType);

            Assert.Equal("Webapp.Models.Data.Treatment", treatment.ToString());
        }
Example #19
0
 public Appointment(DateTime startDateTime, DateTime endDateTime, TreatmentType type, Guid doctorId, Guid patientId, bool isCanceled)
 {
     StartDateTime = startDateTime;
     EndDateTime   = endDateTime;
     Type          = type;
     DoctorId      = doctorId;
     PatientId     = patientId;
     IsCanceled    = isCanceled;
 }
Example #20
0
 private void AddRandomTreatmentTypes()
 {
     for (var i = 0; i < GetRandom.UInt8(3, 10); i++)
     {
         var d = GetRandom.Object <TreatmentTypeData>();
         var t = new TreatmentType(d);
         _treatmenttypes.Add(t).GetAwaiter();
     }
 }
        /// <summary>
        /// Update a TreatmentType
        /// </summary>
        /// <param name="treatmentType"> TreatmentType </param>
        /// <returns> Bool </returns>
        public bool Update(TreatmentType treatmentType)
        {
            try
            {
                string query = "update PTS2_TreatmentType set @fields where Id = @id";

                string fields = "";
                List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
                {
                    new KeyValuePair <string, object>("id", treatmentType.Id)
                };

                if (treatmentType.Name != null)
                {
                    if (!string.IsNullOrWhiteSpace(fields))
                    {
                        fields += ",";
                    }
                    fields += "[name] = @name";
                    parameters.Add(new KeyValuePair <string, object>("name", treatmentType.Name));
                }
                if (treatmentType.Description != null)
                {
                    if (!string.IsNullOrWhiteSpace(fields))
                    {
                        fields += ",";
                    }
                    fields += "description = @description";
                    parameters.Add(new KeyValuePair <string, object>("description", treatmentType.Description));
                }
                if (treatmentType.DepartmentId > 0)
                {
                    if (!string.IsNullOrWhiteSpace(fields))
                    {
                        fields += ",";
                    }
                    fields += "DepartmentId = @departmentId";
                    parameters.Add(new KeyValuePair <string, object>("departmentId", treatmentType.DepartmentId));
                }
                if (!string.IsNullOrWhiteSpace(fields))
                {
                    fields += ",";
                    fields += "active = @active";
                    parameters.Add(new KeyValuePair <string, object>("active", treatmentType.Active ? "1" : "0"));
                }

                query = query.Replace("@fields", fields);

                handler.ExecuteCommand(query, parameters);
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Example #22
0
        }/// <summary>

        /// au auxilliary function which adds a default intervention type
        /// </summary>
        private void AddNewIntervention()
        {
            TreatmentPlan plan        = db.TreatmentPlans.Where(x => x.Patient_TreatmentPlan.User_id == patient.User_id).FirstOrDefault();
            TreatmentType typeDefault = db.TreatmentTypes.Where(x => x.Description == "unset").FirstOrDefault();

            db.Interventions.Add(new Intervention {
                Treatment = plan, Treatment_type = typeDefault, startsAt = DateTime.Now, endsAt = DateTime.Now
            });
            db.SaveChanges();
        }
Example #23
0
        public bool Update(TreatmentType treatmentType)
        {
            int index = BaseMemoryContext.treatmentTypes.FindIndex(t => t.Id == treatmentType.Id);

            if (index >= 0)
            {
                BaseMemoryContext.treatmentTypes[index] = treatmentType;
                return(BaseMemoryContext.treatmentTypes.Exists(t => t == treatmentType));
            }
            return(false);
        }
        public async Task <ActionResult> Edit([Bind(Include = "TreatmentTypeID,Description")] TreatmentType treatmentType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(treatmentType).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(treatmentType));
        }
 public CreateTreatmentCommand(
     TreatmentType treatmentType,
     string name,
     string description,
     int durationMinute)
 {
     TreatmentType  = treatmentType;
     Name           = name;
     Description    = description;
     DurationMinute = durationMinute;
 }
Example #26
0
 internal Appointment(
     TreatmentType treatmentType)
     : this(
         default !,
         default !,
         treatmentType,
         default !,
         default !
         )
 {
 }
        public IHttpActionResult GetTreatmentType(int id)
        {
            TreatmentType treatmentType = db.TreatmentTypes.Find(id);

            if (treatmentType == null)
            {
                return(NotFound());
            }

            return(Ok(treatmentType));
        }
        public void Update()
        {
            EmptyLists();
            TreatmentType treatmentType = new TreatmentType()
            {
                Id   = 9,
                Name = "doedewas"
            };

            treatmentTypeRepository = new TreatmentTypeRepository(context);
            Assert.True(treatmentTypeRepository.Update(treatmentType));
        }
Example #29
0
        public IEnumerable <Treatment> GetTreatments(TreatmentType type)
        {
            const string sql = @"SELECT * FROM [Treatments] WHERE TreatType = @TreatType";

            using (var connection = _connectionFactory.OpenAnyaSpaConnection())
            {
                return(connection.Query <Treatment>(sql, new
                {
                    TreatType = type
                }));
            }
        }
Example #30
0
        public override void TestInitialize()
        {
            base.TestInitialize();
            _treatments     = new TreatmentsRepository();
            _treatmenttypes = new TreatmentTypesRepository();
            _data           = GetRandom.Object <TreatmentTypeData>();
            var t = new TreatmentType(_data);

            _treatmenttypes.Add(t).GetAwaiter();
            AddRandomTreatmentTypes();
            Obj = new TestClass(_treatments, _treatmenttypes);
        }