Beispiel #1
0
        public async Task <IHttpActionResult> PutVISIT(int id, VISIT vISIT)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != vISIT.Visit_ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public PatientRegistrationDTO()
 {
     MESSAGE_HEADER         = new MESSAGEHEADER();
     PATIENT_IDENTIFICATION = new PATIENTIDENTIFICATION();
     NEXT_OF_KIN            = new List <NEXTOFKIN>();
     PATIENT_VISIT          = new VISIT();
 }
Beispiel #3
0
        private void LoadFeautureVisits(int id)
        {
            SqlConnection connection = new SqlConnection(MyProject.Properties.Settings.Default.Connection);

            try
            {
                connection.Open();
            }
            finally
            {
                string     select1 = $"select * FROM DOCTOR INNER JOIN (SELECT * FROM VISIT INNER JOIN PACIENT  ON VISIT.IDPACIENT=PACIENT.PACIENTID WHERE PACIENT.PACIENTID={id} AND VISIT.DATE > CONVERT (date, SYSDATETIME())) VISITS ON VISITS.IDDOCTOR=DOCTOR.DOCTORID";
                SqlCommand command = new SqlCommand(select1, connection);
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        User FutureVisits = new User();
                        FutureVisits.DocName   = reader.GetString(2);
                        FutureVisits.DateVisit = reader.GetDateTime(9);
                        FutureVisits.TimeVisit = reader.GetTimeSpan(10);
                        FutureVisits.Room      = reader.GetInt32(5);
                        VISIT.Add(FutureVisits);
                    }

                    connection.Close();
                    if (VISIT.Count > 0)
                    {
                        FutureVisits = VISIT[0];
                    }
                }
            }
        }
Beispiel #4
0
 private void Button_Click_Ok(object sender, RoutedEventArgs e)
 {
     //if (string.IsNullOrEmpty(comboBox1.Text))
     if (ComboBoxDoctor.SelectedItem != null && ComboBoxPatient.SelectedItem != null && cldSample.SelectedDate != null)
     {
         if (AddEditVisitLabel.Text == "Create Visit")
         {
             visitToEdit = new VISIT
             {
                 DOCTOR1     = (DOCTOR)ComboBoxDoctor.SelectedItem,
                 PATIENT1    = (PATIENT)ComboBoxPatient.SelectedItem,
                 DATEOFVISIT = cldSample.SelectedDate.Value
             };
             main_.AddFinished(visitToEdit);
             this.Close();
         }
         else if (AddEditVisitLabel.Text == "Edit Visit")
         {
             visitToEdit.DOCTOR1     = (DOCTOR)ComboBoxDoctor.SelectedItem;
             visitToEdit.PATIENT1    = (PATIENT)ComboBoxPatient.SelectedItem;
             visitToEdit.DATEOFVISIT = cldSample.SelectedDate.Value;
             main_.EditFinished(visitToEdit);
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Error. Choose all the properties for the visit");
     }
 }
Beispiel #5
0
        //向数据库中加入用户访问视频的记录
        //向数据库中加入用户访问视频的记录
        public void AddVisit(string user_id, string video_id)
        {
            VISIT vISIT = new VISIT();

            vISIT.VIDEO_ID   = video_id;
            vISIT.USER_ID    = user_id;
            vISIT.VISIT_TIME = DateTime.Now;

            db.VISIT.Add(vISIT);
            db.SaveChanges();
        }
Beispiel #6
0
        public async Task <IHttpActionResult> GetVISIT(int id)
        {
            VISIT vISIT = await db.VISITs.FindAsync(id);

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

            return(Ok(vISIT));
        }
Beispiel #7
0
        public async Task <IHttpActionResult> PostVISIT(VISIT vISIT)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.VISITs.Add(vISIT);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = vISIT.Visit_ID }, vISIT));
        }
Beispiel #8
0
        public void updateVisit(VISIT toEdit, VISIT newvisit)
        {
            VISIT query = (from visit in context.VISITs
                           where visit.IDV == toEdit.IDV
                           select visit).First();



            query.DOCTOR1     = newvisit.DOCTOR1;
            query.PATIENT1    = newvisit.PATIENT1;
            query.DATEOFVISIT = newvisit.DATEOFVISIT;

            context.SaveChanges();
        }
Beispiel #9
0
        public async Task <IHttpActionResult> DeleteVISIT(int id)
        {
            VISIT vISIT = await db.VISITs.FindAsync(id);

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

            db.VISITs.Remove(vISIT);
            await db.SaveChangesAsync();

            return(Ok(vISIT));
        }
Beispiel #10
0
 public AddEditVisit(IAddEditVisitParent main, IEnumerable <PATIENT> pats, IEnumerable <DOCTOR> docs, VISIT visit)
 {
     WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
     InitializeComponent();
     AddEditVisitLabel.Text = "Edit Visit";
     main_ = main;
     ComboBoxDoctor.ItemsSource  = docs;
     ComboBoxPatient.ItemsSource = pats;
     visitToEdit = visit;
     ComboBoxPatient.IsEnabled    = false;
     ComboBoxPatient.SelectedItem = visit.PATIENT1;
     ComboBoxDoctor.SelectedItem  = visit.DOCTOR1;
     cldSample.SelectedDate       = visit.DATEOFVISIT;
 }
Beispiel #11
0
        private void LoadVisits(int id)
        {
            SqlConnection connection = new SqlConnection(MyProject.Properties.Settings.Default.Connection);

            try
            {
                connection.Open();
            }
            finally
            {
                string     select1 = $"select * FROM PACIENT INNER JOIN (SELECT * FROM VISIT INNER JOIN DOCTOR ON VISIT.IDDOCTOR=DOCTOR.DOCTORID WHERE DOCTOR.DOCTORID={id} AND VISIT.DATE >=  CONVERT (date, SYSDATETIME()) ) VISITS ON VISITS.IDPACIENT=PACIENT.PACIENTID";
                SqlCommand command = new SqlCommand(select1, connection);
                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Doctor doctor = new Doctor();
                        doctor.IdVisit     = reader.GetInt32(8);
                        doctor.PacientName = reader.GetString(3);
                        doctor.Surname     = reader.GetString(4);
                        doctor.DataVisit   = reader.GetDateTime(11);
                        doctor.TimeVisit   = reader.GetTimeSpan(12);
                        if (!reader.IsDBNull(13))
                        {
                            doctor.Diagnose = reader.GetString(13);
                        }
                        if (!reader.IsDBNull(14))
                        {
                            doctor.Treatment = reader.GetString(14);
                        }

                        VISIT.Add(doctor);
                    }
                }
                connection.Close();
            }
        }
Beispiel #12
0
 public void deleteVisit(VISIT visitToDel)
 {
     context.VISITs.Remove(visitToDel);
     context.SaveChanges();
 }
Beispiel #13
0
 public void insertVisit(VISIT v)
 {
     context.VISITs.Add(v);
     context.SaveChanges();
 }