예제 #1
0
        public bool AddPatient(Patient patient)
        {
            try
            {
                patient.ID = Guid.NewGuid();
                db.Insert(patient);

            }
            catch (Exception)
            {

                return false;
            }
            return true;
        }
예제 #2
0
        public bool Delete(Patient patient)
        {
            string sqlQuery = "Delete from [dbo].[patients] where [id] = @ID";
            var result = false;
            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();

                conn.Execute(sqlQuery,
                new
                {
                    patient.ID,

                });
                result = true;
            }
            return result;
        }
예제 #3
0
        public bool Update(Patient patient)
        {
            string sqlQuery = "Update [dbo].[patients] set [name] = @Name,[age] = @Age,[currentdoctorid] = @CurrentDoctorID where [id] = @ID";
            var result = false;
            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();

                conn.Execute(sqlQuery,
                new
                {
                    patient.ID,
                    patient.Name,
                    patient.Age,
                    patient.CurrentDoctorID
                });
                result = true;
            }
            return result;
        }
예제 #4
0
        public bool Insert(Patient patient)
        {
            string sqlQuery = "INSERT INTO [dbo].[patients]([id],[name],[age],[currentdoctorid]) VALUES (@ID, @Name, @Age, @CurrentDoctorID)";
            var result = false;
            using (var conn = new SqlConnection(connectionString))
            {
                conn.Open();

                conn.Execute(sqlQuery,
                new
                {
                    patient.ID,
                    patient.Name,
                    patient.Age,
                    patient.CurrentDoctorID
                });
                result = true;
            }
            return result;
        }
        public Patient CreateNewPatient(string userId, Dentist dentist)
        {
            var p = this.patients.GetById(userId);
            if (p == null)
            {
                Patient patient = new Patient()
                {
                    Id = userId
                };

                patient.Dentists.Add(dentist);

                this.patients.Add(patient);
                this.patients.Save();
                return patient;
            }else
            {
                p.Dentists.Add(dentist);
                this.patients.Save();
            }

            return p;
        }
예제 #6
0
        public bool UpdatePatient(Guid ID, Patient patient)
        {
            try
            {
       
                db.Update(patient);

            }
            catch (Exception)
            {

                return false;
            }
            return true;

        }
예제 #7
0
 public bool Delete(Patient patient)
 {
     throw new NotImplementedException();
 }
예제 #8
0
 public bool Insert(Patient patient)
 {
     throw new NotImplementedException();
 }
예제 #9
0
        protected override void Seed(PiContext context)
        {
            Patient p = new Patient();

            p.Email        = "*****@*****.**";
            p.PasswordHash = "123456789";
            p.UserName     = "******";
            context.Users.Add(p);



            CategoriePost cp = new CategoriePost();

            cp.Libelle     = "Denatire";
            cp.Description = "Dentaire";
            context.CategoriePosts.Add(cp);


            CategoriePost cp2 = new CategoriePost();

            cp.Libelle     = "Cardio";
            cp.Description = "Cardio";
            context.CategoriePosts.Add(cp2);

            CategoriePost cp3 = new CategoriePost();

            cp.Libelle     = "Esthetique";
            cp.Description = "Esthetique";
            context.CategoriePosts.Add(cp2);

            CategoriePost cp4 = new CategoriePost();

            cp.Libelle     = "Esthetique";
            cp.Description = "Esthetique";
            context.CategoriePosts.Add(cp4);


            CategoriePost cp5 = new CategoriePost();

            cp.Libelle     = "gynecologi.";
            cp.Description = "gynecologie.";
            context.CategoriePosts.Add(cp4);


            CategoriePost cp6 = new CategoriePost();

            cp.Libelle     = "pediatrie";
            cp.Description = "pediatrie";
            context.CategoriePosts.Add(cp6);

            CategoriePost cp7 = new CategoriePost();

            cp.Libelle     = "neurologie";
            cp.Description = "neurologie";
            context.CategoriePosts.Add(cp6);


            // context.SaveChanges();

            List <Appointment> appointments = new List <Appointment>()
            {
                new Appointment {
                    state = State.Done
                },
                new Appointment {
                    state = State.Done
                },
                new Appointment {
                    state = State.Done
                },
                new Appointment {
                    state = State.Done
                },
                new Appointment {
                    state = State.Done
                },
                new Appointment {
                    state = State.Done
                },
                new Appointment {
                    state = State.Done
                },
                new Appointment {
                    state = State.Done
                }
            };

            context.Appointments.AddRange(appointments);
            context.SaveChanges();
        }