public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price")] Checkup checkup)
        {
            if (id != checkup.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(checkup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CheckupExists(checkup.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(checkup));
        }
 public LaboratoryRequest(User user, Checkup checkup)
 {
     InitializeComponent();
     currentCheckup = checkup;
     currentUser    = user;
     SettingUp();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the checkup.
        /// </summary>
        /// <param name="appointmentid">The appointmentid.</param>
        /// <param name="systolic">The systolic.</param>
        /// <param name="diastolic">The diastolic.</param>
        /// <param name="temperature">The temperature.</param>
        /// <param name="weight">The weight.</param>
        /// <param name="pulse">The pulse.</param>
        /// <param name="diagnosis">The diagnosis.</param>
        /// <param name="finaldiagnosis"></param>
        /// <returns></returns>
        public static bool createCheckup(int appointmentid, int systolic, int diastolic, decimal temperature, decimal weight, int pulse, string diagnosis, string finaldiagnosis)
        {
            var cdb     = new CheckupDatabaseAccess();
            var checkup = new Checkup(0, appointmentid, systolic, diastolic, temperature, weight, pulse, diagnosis, finaldiagnosis);

            return(cdb.CreateCheckup(checkup));
        }
        public ActionResult Create([Bind(Include = "ID,Type,Result,Patient_ID")] Checkup checkup)
        {
            if (User.Identity.IsAuthenticated)
            {
                string cid = User.Identity.GetUserId();
                UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(appDb));
                var roles = userManager.GetRoles(cid);
                if (roles[0] == "Doctor")
                {
                    if (ModelState.IsValid)
                    {
                        if (db.Checkups.Find(checkup.ID) != null)
                        {
                            TempData["msg"] = "Checkup ID already in use.";
                            return(View("Error"));
                        }
                        db.Checkups.Add(checkup);
                        db.SaveChanges();
                        return(RedirectToAction("Index"));
                    }

                    return(View(checkup));
                }
                else
                {
                    return(View("AccessDenied"));
                }
            }
            else
            {
                return(View("NotLoggedIn"));
            }
        }
Exemplo n.º 5
0
 public Diagonosis(Status status, Checkup checkup, string message = null, Prescription prescription = null)
 {
     Status       = status;
     Checkup      = checkup;
     Message      = message;
     Prescription = prescription;
 }
        // GET: Checkups/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Checkup checkup = db.Checkups.Find(id);

            if (checkup == null)
            {
                return(HttpNotFound());
            }
            if (User.Identity.IsAuthenticated)
            {
                string cid = User.Identity.GetUserId();
                UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(appDb));
                var roles = userManager.GetRoles(cid);
                if (roles[0] == "Doctor")
                {
                    return(View(checkup));
                }
                else
                {
                    return(View("AccessDenied"));
                }
            }
            else
            {
                return(View("NotLoggedIn"));
            }
        }
 public ActionResult Edit([Bind(Include = "ID,Type,Result,Patient_ID")] Checkup checkup)
 {
     if (User.Identity.IsAuthenticated)
     {
         string cid = User.Identity.GetUserId();
         UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(appDb));
         var roles = userManager.GetRoles(cid);
         if (roles[0] == "Doctor")
         {
             if (ModelState.IsValid)
             {
                 db.Entry(checkup).State = EntityState.Modified;
                 db.SaveChanges();
                 return(RedirectToAction("Index"));
             }
             return(View(checkup));
         }
         else
         {
             return(View("AccessDenied"));
         }
     }
     else
     {
         return(View("NotLoggedIn"));
     }
 }
 public ActionResult DeleteConfirmed(string id)
 {
     if (User.Identity.IsAuthenticated)
     {
         string cid = User.Identity.GetUserId();
         UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(appDb));
         var roles = userManager.GetRoles(cid);
         if (roles[0] == "Doctor")
         {
             if (id == null)
             {
                 return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
             }
             Checkup checkup = db.Checkups.Find(id);
             if (checkup == null)
             {
                 return(HttpNotFound());
             }
             db.Checkups.Remove(checkup);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View("AccessDenied"));
         }
     }
     else
     {
         return(View("NotLoggedIn"));
     }
 }
Exemplo n.º 9
0
 public DiagnosticResult(Status status, Checkup checkup, string message = null, Suggestion prescription = null)
 {
     Status     = status;
     Checkup    = checkup;
     Message    = message;
     Suggestion = prescription;
 }
Exemplo n.º 10
0
        public async void UpdateCheckUp(Checkup checkup)
        {
            var response = await client.UpdateAsync("Checkup/" + checkup.id, checkup);

            var result = response.ResultAs <Checkup>();

            Console.WriteLine("Successfully saved");
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Price")] Checkup checkup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(checkup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(checkup));
        }
Exemplo n.º 12
0
        public void ScheduleCheckup(Checkup checkup)
        {
            if (doctorService.IsDoctorFree(checkup.DoctorId, checkup.StartTime, checkup.EndTime))
            {
                MedicalRecord medicalRecord = medicalRecordService.GetMedicalRecordById(checkup.MedicalRecordId);

                medicalRecord.Checkups.Add(checkup.Id);
                medicalRecordService.UpdateMedicalRecord(medicalRecord);

                checkupRepository.Save(checkup);
            }
        }
        public void Save(Checkup entity)
        {
            if (ExistsById(entity.Id))
            {
                Delete(entity);
            }
            else
            {
                entity.Id = GenerateId();
            }

            List <Checkup> allCheckups = (List <Checkup>)FindAll();

            allCheckups.Add(entity);
            SaveAll(allCheckups);
        }
Exemplo n.º 14
0
        public void EditCheckup(Checkup checkup)
        {
            List <Checkup> allCheckups    = (List <Checkup>)checkupRepository.FindAll();
            Checkup        checkupForEdit = new Checkup();

            foreach (Checkup c in allCheckups)
            {
                if (c.Id == checkup.Id)
                {
                    checkupForEdit = c;
                    break;
                }
            }

            CancelCheckup(checkupForEdit);
            ScheduleCheckup(checkup);
        }
        private ITermStrategy getControllerStrategy(Term term)
        {
            var testOperation = new Operation();
            var testCheckup   = new Checkup();

            ITermStrategy controllerStrategy = null;

            if ((term.GetType()).IsInstanceOfType(testCheckup))
            {
                controllerStrategy = new CheckupStrategyControler();
            }
            else if ((term.GetType()).IsInstanceOfType(testOperation))
            {
                controllerStrategy = new OperationStrategyController();
            }

            return(controllerStrategy);
        }
        public void DeleteById(int identificator)
        {
            List <Checkup> allCheckups = (List <Checkup>)FindAll();
            Checkup        toRemove    = null;

            foreach (Checkup checkup in allCheckups)
            {
                if (checkup.Id == identificator)
                {
                    toRemove = checkup;
                }
            }

            if (toRemove != null)
            {
                allCheckups.Remove(toRemove);
                SaveAll(allCheckups);
            }
        }
        /// <summary>
        /// Creates the checkup.
        /// </summary>
        /// <param name="c">The c.</param>
        /// <returns></returns>
        public bool CreateCheckup(Checkup c)
        {
            var appointmentid  = c.AppointmentId;
            var systolic       = c.Systolic;
            var diastolic      = c.Diastolic;
            var temperature    = c.Temperature;
            var weight         = c.Weight;
            var pulse          = c.Pulse;
            var diagnosis      = c.Diagnosis;
            var finaldiagnosis = c.FinalDiagnosis;

            try
            {
                using var conn = new MySqlConnection(ConStr);
                conn.Open();
                using var cmd = new MySqlCommand { Connection = conn };

                const string createCheckup = "INSERT INTO `checkup` (`appointmentid`, `systolic`, `diastolic`, `temp`, `weight`, `pulse`, `diagnosis`, `finaldiagnosis`) VALUES (@appointmentid, @systolic, @diastolic, @temperature, @weight, @pulse, @diagnosis, @finaldiagnosis);";
                cmd.CommandText = createCheckup;
                cmd.Parameters.AddWithValue("@appointmentid", appointmentid);
                cmd.Parameters.AddWithValue("@systolic", systolic);
                cmd.Parameters.AddWithValue("@diastolic", diastolic);
                cmd.Parameters.AddWithValue("@temperature", temperature);
                cmd.Parameters.AddWithValue("@weight", weight);
                cmd.Parameters.AddWithValue("@pulse", pulse);
                cmd.Parameters.AddWithValue("@diagnosis", diagnosis);
                cmd.Parameters.AddWithValue("@finaldiagnosis", finaldiagnosis);

                var confirmation = cmd.ExecuteNonQuery();
                return(confirmation == 1);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in the CreateCheckup: " + ex);
                return(false);
            }
        }
Exemplo n.º 18
0
        public CheckupSummary CreateNewCheckup(String username, String patientId, String deviceSerial)
        {
            try
            {
                var     user    = m_model.Profiles.Single(P => P.NationalityCode.Equals(username));
                var     patient = m_model.Profiles.Single(P => P.NationalityCode.Equals(patientId));
                Checkup checkUp = new Checkup
                {
                    Date         = DateTime.Now,
                    DeviceSerial = deviceSerial,
                    DoctorID     = user.UserID,
                    Status       = 1,
                    UserID       = patient.UserID
                };
                m_model.Checkups.InsertOnSubmit(checkUp);

                m_model.SubmitChanges();
                return(new CheckupSummary
                {
                    NationalCode = patient.NationalityCode,
                    FirstName = patient.FirstName,
                    LastName = patient.LastName,
                    Date = DateToMiladiString((DateTime)checkUp.Date),
                    Id = checkUp.Id,
                    Prescribe = false,
                    Recommandation = false
                });
            }
            catch (Exception ex)
            {
                OutgoingWebResponseContext response = WebOperationContext.Current.OutgoingResponse;
                response.StatusCode        = System.Net.HttpStatusCode.NotFound;
                response.StatusDescription = ex.Message;
                return(null);
            }
        }
Exemplo n.º 19
0
 public DiagnosticResult(Status status, Checkup checkup, string message)
     : this(status, checkup, message, null)
 {
 }
Exemplo n.º 20
0
 public static DiagnosticResult Ok(Checkup checkup)
 => new DiagnosticResult(Status.Ok, checkup);
Exemplo n.º 21
0
 public DiagnosticResult(Status status, Checkup checkup, Suggestion prescription)
     : this(status, checkup, null, prescription)
 {
 }
 public void Save(Checkup entity)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 23
0
 public Diagonosis(Status status, Checkup checkup, Prescription prescription)
     : this(status, checkup, null, prescription)
 {
 }
Exemplo n.º 24
0
 public static Diagonosis Ok(Checkup checkup)
 => new Diagonosis(Status.Ok, checkup);
Exemplo n.º 25
0
 public Diagonosis(Status status, Checkup checkup, string message)
     : this(status, checkup, message, null)
 {
 }
Exemplo n.º 26
0
 public void CancelCheckup(Checkup checkup)
 {
     checkupRepository.Delete(checkup);
 }
 public void Delete(Checkup entity)
 {
     DeleteById(entity.Id);
 }