コード例 #1
0
ファイル: PatientTests.cs プロジェクト: vbre/CS_2015_Winter
 public void SetUp()
 {
     IClinic testClinic = new Clinic();
     IDoctor testDoctor = new Dentist();
     IPatient testPatient = new Patient();
     testClinic.AddDoctor(testDoctor);
     testClinic.AddPatient(testPatient);
 }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Dentist d = new Dentist();
            d.UserId = useridTextBox.Text.ToString();
            d.FirstName = fnameTextBox.Text.ToString();
            d.LastName = lnameTextBox.Text.ToString();
            d.BirthDate = birthdateDatePicker.DisplayDate;
            d.BirthPlace= birthplaceTextBox.Text.ToString();
            d.Gender = (genderMaleRadioButton.IsChecked.Value ? "M" : "F");
            d.Address1 = address1TextBox.Text.ToString();
            d.Address2 = address2TextBox.Text.ToString();
            d.City = cityTextBox.Text.ToString();
            d.Phone = phoneTextBox.Text.ToString();

            if (db.InsertDentist(d))
            {
                MessageBox.Show("Success inserted");
                clear();
            }
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 public async Task Update(Dentist dentist)
 {
     _context.Dentists.Update(dentist);
     await _context.SaveChangesAsync();
 }
コード例 #5
0
        public static void Main(string[] args)
        {
            var helloIAm       = new CP2013_WordOfMouth.DTO.AppointmentType(1, "Clean my teeth", 100);
            var jsonApointment = new JsonAppointmentAddType().GetJson(helloIAm);
            var test           = PostRequests(new HttpPostAddAppointmentType(), jsonApointment);

            var Login      = new Login("*****@*****.**", "Password");
            var json       = new JsonLogin().GetJson(Login);
            var something  = PostRequests(new HttpPostLogin(), json);
            var newSession = new JsonSession().GetObject(something) as Session;
            var dentistser = GetRequests(new HttpGetAllDentist(), new JsonAllDentists(), "") as List <Dentist>;

            var allAvaliable = GetRequests(new HttpGetAllAvaliableTimes(), new JsonDentistTimeSlots(), "");
            //  foreach (var d in dentistser)
            //  {
            var stuffed        = PostRequests(new HttpGetBookingsForDentist(), 2.ToString());
            var objectsAreGood = new JsonAppointments().GetObject(stuffed) as List <Appointment>;
            //  }

            var dentistperson = new Dentist(0, "Dentist New", "*****@*****.**", "0412345678");
            var jd            = new JsonDentistEditAdd();
            var json2         = jd.GetJson(dentistperson);

            var stuff = PostRequests(new HttpPostAddDentist(), json2);

            dentistser = GetRequests(new HttpGetAllDentist(), new JsonAllDentists(), "") as List <Dentist>;

            var i = dentistser.Count - 1;

            dentistperson = new Dentist(i, "Dentist New", "*****@*****.**", "0412345678");
            jd            = new JsonDentistEditAdd();
            json2         = jd.GetJson(dentistperson);

            stuff = PostRequests(new HttpPostEditDentist(), json2);

            GetRequests(new HttpGetDentist(), new JsonDentist(), 1.ToString());
            GetRequests(new HttpGetAppointments(), new JsonAppointments(), newSession.GetSessionID().ToString());
            var timeSlots         = GetRequests(new HttpGetDentistTimeSlots(), new JsonDentistTimeSlots(), 2.ToString());
            var apps              = GetRequests(new HttpGetAllAppointmentTypes(), new JsonAllAppointmentTypes(), "");
            var deleteAppointment = new HttpPostDeleteAppointment();

            deleteAppointment.SendRequest(1.ToString());
            var response = deleteAppointment.GetResponse();

            //var Login = new Login("*****@*****.**", "Password");
            //var json = new JsonLogin().GetJson(Login);


            PostRequests(new HttpPostDeleteDentist(), 37.ToString());
            #region OLDMAIN
            var login    = new OldLogin("*****@*****.**", "Password");
            var session  = rr.Login(login);
            var dentists = rr.GetAllDentists();
            var dentist  = rr.GetDentist(dentists[0].id);
            // var timeSlots = rr.GetAllTimeSlots();

            Console.WriteLine(timeSlots);
            rr.GetTimeSlotsForDentist(dentists[0].id);
            Console.WriteLine(dentists);


            fileHandler = new MOCKFileHandler();
            var key = GetStringFromOutput(MENU);

            while (key != "q")
            {
                switch (key)
                {
                case "1":
                    UserUI();
                    break;

                case "2":
                    AdminUI();
                    break;

                default:
                    Console.WriteLine("unknown error");
                    break;
                }
                key = GetStringFromOutput(MENU);
            }
            #endregion
        }
コード例 #6
0
        public async Task Add(Dentist dentist)
        {
            await _context.Dentists.AddAsync(dentist);

            await _context.SaveChangesAsync();
        }
コード例 #7
0
 public bool Update(Dentist obj)
 {
     return(true);
 }
コード例 #8
0
 public void UpdateDentist(Dentist dnt)
 {
 }
コード例 #9
0
 public async Task AddAsync(Dentist dentist)
 {
     await _dentists
     .AddAsync(dentist);
 }
コード例 #10
0
 public bool Add(Dentist obj)
 {
     dentists.Add(obj);
     return(true);
 }
コード例 #11
0
 /// <summary>
 /// Updates the given dentist from the repository.
 /// </summary>
 /// <param name="dentist"> The given dentist. </param>
 public void Update(Dentist dentist)
 {
     _repository.Update(dentist);
 }
コード例 #12
0
 public void Cadastrar(Dentist obj)
 {
     rep.Cadastrar(obj);
 }
コード例 #13
0
 public bool Update(Dentist obj)
 {
     throw new System.NotImplementedException();
 }
コード例 #14
0
 void SetDoctor(Dentist d)
 {
     this.doctor = d;
 }
コード例 #15
0
        public ActionResult SeeDentistProfile(string id)
        {
            Dentist ChoosenDentist = db.Dentists.Find(id);

            return(View(ChoosenDentist));
        }
コード例 #16
0
ファイル: Configuration.cs プロジェクト: jusufk12/DentistCard
        //Seeding everything except Identity tables (Roles, Logins and Claims)
        private void SeedAll(ApplicationDbContext context)
        {
            var passwordHasher = new PasswordHasher();

            var upLeft1 = new Tooth
            {
                ToothPosition = ToothPosition.gl1,
                ToothState    = ToothState.H
            };
            var upLeft2 = new Tooth
            {
                ToothPosition = ToothPosition.gl2,
                ToothState    = ToothState.H
            };
            var upLeft3 = new Tooth
            {
                ToothPosition = ToothPosition.gl3,
                ToothState    = ToothState.H
            };
            var upLeft4 = new Tooth
            {
                ToothPosition = ToothPosition.gl4,
                ToothState    = ToothState.H
            };
            var upLeft5 = new Tooth
            {
                ToothPosition = ToothPosition.gl5,
                ToothState    = ToothState.H
            };
            var upLeft6 = new Tooth
            {
                ToothPosition = ToothPosition.gl6,
                ToothState    = ToothState.H
            };
            var upLeft7 = new Tooth
            {
                ToothPosition = ToothPosition.gl7,
                ToothState    = ToothState.H
            };
            var upLeft8 = new Tooth
            {
                ToothPosition = ToothPosition.gl8,
                ToothState    = ToothState.H
            };
            var upRight1 = new Tooth
            {
                ToothPosition = ToothPosition.gd1,
                ToothState    = ToothState.H
            };
            var upRight2 = new Tooth
            {
                ToothPosition = ToothPosition.gd2,
                ToothState    = ToothState.H
            };
            var upRight3 = new Tooth
            {
                ToothPosition = ToothPosition.gd3,
                ToothState    = ToothState.H
            };
            var upRight4 = new Tooth
            {
                ToothPosition = ToothPosition.gd4,
                ToothState    = ToothState.H
            };
            var upRight5 = new Tooth
            {
                ToothPosition = ToothPosition.gd5,
                ToothState    = ToothState.H
            };
            var upRight6 = new Tooth
            {
                ToothPosition = ToothPosition.gd6,
                ToothState    = ToothState.H
            };
            var upRight7 = new Tooth
            {
                ToothPosition = ToothPosition.gd7,
                ToothState    = ToothState.H
            };
            var upRight8 = new Tooth
            {
                ToothPosition = ToothPosition.gd8,
                ToothState    = ToothState.H
            };



            var downLeft1 = new Tooth
            {
                ToothPosition = ToothPosition.dl1,
                ToothState    = ToothState.H
            };
            var downLeft2 = new Tooth
            {
                ToothPosition = ToothPosition.dl2,
                ToothState    = ToothState.H
            };
            var downLeft3 = new Tooth
            {
                ToothPosition = ToothPosition.dl3,
                ToothState    = ToothState.C2
            };
            var downLeft4 = new Tooth
            {
                ToothPosition = ToothPosition.dl4,
                ToothState    = ToothState.H
            };
            var downLeft5 = new Tooth
            {
                ToothPosition = ToothPosition.dl5,
                ToothState    = ToothState.C1
            };
            var downLeft6 = new Tooth
            {
                ToothPosition = ToothPosition.dl6,
                ToothState    = ToothState.H
            };
            var downLeft7 = new Tooth
            {
                ToothPosition = ToothPosition.dl7,
                ToothState    = ToothState.H
            };
            var downLeft8 = new Tooth
            {
                ToothPosition = ToothPosition.dl8,
                ToothState    = ToothState.C1
            };
            var downRight1 = new Tooth
            {
                ToothPosition = ToothPosition.dd1,
                ToothState    = ToothState.Cu
            };
            var downRight2 = new Tooth
            {
                ToothPosition = ToothPosition.dd2,
                ToothState    = ToothState.H
            };
            var downRight3 = new Tooth
            {
                ToothPosition = ToothPosition.dd3,
                ToothState    = ToothState.H
            };
            var downRight4 = new Tooth
            {
                ToothPosition = ToothPosition.dd4,
                ToothState    = ToothState.C1
            };
            var downRight5 = new Tooth
            {
                ToothPosition = ToothPosition.dd5,
                ToothState    = ToothState.No
            };
            var downRight6 = new Tooth
            {
                ToothPosition = ToothPosition.dd6,
                ToothState    = ToothState.CC3
            };
            var downRight7 = new Tooth
            {
                ToothPosition = ToothPosition.dd7,
                ToothState    = ToothState.H
            };
            var downRight8 = new Tooth
            {
                ToothPosition = ToothPosition.dd8,
                ToothState    = ToothState.H
            };



            //kicked out
            //var medicalRecord01 = new MedicalRecord
            //{
            //    DateCreated = DateTime.Now,
            //    Description = "Vadjena trica donja lijeva",
            //    ToothPosition = ToothPosition.dd3,
            //    ToothState = ToothState.CC1

            //};

            var medicalRecord02 = new MedicalRecord
            {
                DateCreated   = DateTime.Now,
                Description   = "Radjena krunica gornje lijeve sestice",
                ToothPosition = ToothPosition.dd7,
                ToothState    = ToothState.Cu
            };

            var patient = new Patient
            {
                UserName         = "******",
                PasswordHash     = passwordHasher.HashPassword("P@ssw0rd"),
                FirstName        = "Omer",
                LastName         = "Ahmetagic",
                DateOfBirth      = new DateTime(1987, 4, 3),
                Address          = "Brcanska 2",
                DateCreated      = DateTime.Now,
                EmploymentStatus = EmploymentStatus.Student,
                Email            = "*****@*****.**",
                PhoneNumber      = "062/064-064",
                SecurityStamp    = "dcvfgdve",
                MedicalHistory   = new MedicalHistory

                {
                    Note           = "Patient's teeth are just awesome and he is ready to get married.",
                    MedicalRecords = new List <MedicalRecord>()
                    {
                        medicalRecord02
                    },
                    Teeth = new List <Tooth>()
                    {
                        upLeft1, upLeft2, upLeft3, upLeft4, upLeft5, upLeft6, upLeft7, upLeft8,
                        upRight1, upRight2, upRight3, upRight4, upRight5, upRight6, upRight7, upRight8, downLeft1, downLeft2, downLeft3
                        , downLeft4, downLeft5, downLeft6, downLeft7, downLeft8, downRight1, downRight2, downRight3, downRight4, downRight5
                        , downRight6, downRight7, downRight8
                    }
                }
            };

            var patient5 = new Patient
            {
                UserName         = "******",
                PasswordHash     = passwordHasher.HashPassword("P@ssw0rd"),
                FirstName        = "Meho",
                LastName         = "Mehiæ",
                DateOfBirth      = new DateTime(1987, 4, 3),
                Address          = "Brcanska 2",
                DateCreated      = DateTime.Now,
                EmploymentStatus = EmploymentStatus.Student,
                Email            = "*****@*****.**",
                PhoneNumber      = "062/064-064",
                SecurityStamp    = "dcvfgddwve",
                MedicalHistory   = new MedicalHistory

                {
                    Note  = "Patient's teeth are just awesome and he is ready to get married..",
                    Teeth = new List <Tooth>()
                    {
                        upLeft1, upLeft2, upLeft3, upLeft4, upLeft5, upLeft6, upLeft7, upLeft8,
                        upRight1, upRight2, upRight3, upRight4, upRight5, upRight6, upRight7, upRight8, downLeft1, downLeft2, downLeft3
                        , downLeft4, downLeft5, downLeft6, downLeft7, downLeft8, downRight1, downRight2, downRight3, downRight4, downRight5
                        , downRight6, downRight7, downRight8
                    }
                }
            };
            //var downRight222 = new Tooth
            //{
            //    ToothPosition = ToothPosition.dd3,
            //    ToothState = ToothState.No
            //};

            var upRight222 = new Tooth
            {
                ToothPosition = ToothPosition.gd5,
                ToothState    = ToothState.C1
            };

            var medicalRecord11 = new MedicalRecord
            {
                DateCreated = DateTime.Now,
                Description = "Vadjena trica donja desna"
            };
            var medicalRecord12 = new MedicalRecord
            {
                DateCreated = DateTime.Now,
                Description = "Zalivena gornja desna petica"
            };

            var appointment = new Appointment
            {
                Id          = Guid.NewGuid().ToString(),
                Description = "Emire pomozi, boli me sestica",
                Title       = "Treba mi izvaditi zub",
                Start       = new DateTime(2016, 12, 2, 14, 0, 0),
                End         = new DateTime(2016, 12, 2, 15, 0, 0),
                IsAccepted  = true
            };
            var appointment2 = new Appointment
            {
                Id          = Guid.NewGuid().ToString(),
                Description = "Damire pomozi, dodje mi da se ubijem, ja ne znam ko sam",
                Title       = "Treba me roknuti",
                Start       = new DateTime(2016, 12, 3, 15, 0, 0),
                End         = new DateTime(2016, 12, 3, 16, 0, 0),
                IsAccepted  = false
            };
            var appointment3 = new Appointment
            {
                Id          = Guid.NewGuid().ToString(),
                Description = "Boli me sestica sutra",
                Title       = "Nemam pojma sta hocu",
                Start       = new DateTime(2016, 12, 1, 15, 0, 0),
                End         = new DateTime(2016, 12, 1, 17, 0, 0),
                IsAccepted  = false
            };


            var patient2 = new Patient
            {
                UserName         = "******",
                PasswordHash     = passwordHasher.HashPassword("P@ssw0rd"),
                FirstName        = "Jusuf",
                LastName         = "Koric",
                DateOfBirth      = new DateTime(1993, 4, 3),
                Address          = "Butmirska Neka 12",
                DateCreated      = DateTime.Now,
                EmploymentStatus = EmploymentStatus.Student,
                Email            = "*****@*****.**",
                PhoneNumber      = "062/064-064",
                SecurityStamp    = "f1f65sadfafjsadasdamsoa",
                MedicalHistory   = new MedicalHistory
                {
                    PatientId      = patient.Id,
                    Note           = "Patient's teeth are very good, but since he is awesome looking, he is ready to get married.",
                    MedicalRecords = new List <MedicalRecord>()
                    {
                        medicalRecord11, medicalRecord12
                    },
                    Teeth = new List <Tooth>()
                    {
                        upRight222
                    }
                },
                Appointments = new List <Appointment>()
                {
                    appointment, appointment3
                }
            };

            //samac
            var upRight33 = new Tooth
            {
                ToothPosition = ToothPosition.gd2,
                ToothState    = ToothState.C1
            };

            var upRight31 = new Tooth
            {
                ToothPosition = ToothPosition.gd1,
                ToothState    = ToothState.H
            };

            var downRight33 = new Tooth
            {
                ToothPosition = ToothPosition.dd3,
                ToothState    = ToothState.H
            };



            var medicalRecord31 = new MedicalRecord
            {
                DateCreated   = DateTime.Now,
                Description   = "Zalivena gornja desna dvica",
                ToothPosition = ToothPosition.dd8,
                ToothState    = ToothState.H
            };



            var patient3 = new Patient
            {
                UserName         = "******",
                PasswordHash     = passwordHasher.HashPassword("P@ssw0rd"),
                FirstName        = "Sami",
                LastName         = "Yusuf",
                DateOfBirth      = new DateTime(1973, 4, 3),
                Address          = "Londonska 3",
                DateCreated      = DateTime.Now,
                EmploymentStatus = EmploymentStatus.Employed,
                SecurityStamp    = "fakjhdfiasndgsakjfalfjsadasdamsoa",
                Email            = "*****@*****.**",
                PhoneNumber      = "0699/064-064",
                EmailConfirmed   = true,
                MedicalHistory   = new MedicalHistory
                {
                    Note           = "Patient's teeth are excellent, he can perform good on stage.",
                    MedicalRecords = new List <MedicalRecord>()
                    {
                        medicalRecord31
                    },
                    Teeth = new List <Tooth>()
                    {
                        upRight33, upRight31, downRight3
                    }
                },

                Appointments = new List <Appointment>()
                {
                    appointment2
                }
            };



            var dentist = new Dentist
            {
                FirstName        = "Emir",
                LastName         = "Hodzic",
                UserName         = "******",
                PasswordHash     = passwordHasher.HashPassword("P@ssw0rd"),
                DateOfBirth      = new DateTime(1992, 3, 20),
                EmploymentStatus = EmploymentStatus.Employed,
                PhoneNumber      = "+38762876923",
                Email            = "*****@*****.**",
                Address          = "Igmanskih Bataljona 27",
                Place            = "Hrasnicka cesta 13",
                DateCreated      = DateTime.Now,
                EmailConfirmed   = true,
                SecurityStamp    = "fakjhdfiasndgsakjfalfjmsoa",
                Patients         = new List <Patient>()
                {
                    patient, patient2
                },
                Schedule = new Schedule
                {
                    Appointments = new List <Appointment>()
                    {
                        appointment, appointment3
                    }
                }
            };


            var dentist2 = new Dentist
            {
                FirstName        = "Damir",
                LastName         = "Metiljevic",
                UserName         = "******",
                PasswordHash     = passwordHasher.HashPassword("P@ssw0rd"),
                DateOfBirth      = new DateTime(1992, 3, 20),
                EmploymentStatus = EmploymentStatus.Unemployed,
                PhoneNumber      = "+38762123456",
                Email            = "*****@*****.**",
                Address          = "Mumijevi 12",
                Place            = "Ilidzanska cesma 123",
                DateCreated      = DateTime.Now,
                EmailConfirmed   = true,
                SecurityStamp    = "fafgsddggggb",
                Patients         = new List <Patient>()
                {
                    patient3
                },
                Schedule = new Schedule
                {
                    Appointments = new List <Appointment>()
                    {
                        appointment2
                    }
                }
            };

            var newNote1 = new Note
            {
                Id          = Guid.NewGuid().ToString(),
                DateCreated = DateTime.Now,
                Comment     = "This is just some dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter",
                Title       = "Great news!",
            };
            var newNote2 = new Note
            {
                Id          = Guid.NewGuid().ToString(),
                DateCreated = DateTime.Now,
                Comment     = "This is just some extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter",
                Title       = "Great update!",
            };
            var newNote3 = new Note
            {
                Id          = Guid.NewGuid().ToString(),
                DateCreated = DateTime.Now,
                Comment     = "This is just extra extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter. ",
                Title       = "Great feature!",
            };
            var newNote4 = new Note
            {
                Id          = Guid.NewGuid().ToString(),
                DateCreated = DateTime.Now,
                Comment     = "This is dummy dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter. This is just extra extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter. This is just extra extra dummy text to fill in this field with the text, and this text makes no sense at all but it does not matter",
                Title       = "Great info!",
            };

            var admin = new Admin
            {
                FirstName        = "Admin",
                LastName         = "Adminic",
                UserName         = "******",
                PasswordHash     = passwordHasher.HashPassword("P@ssw0rd"),
                DateOfBirth      = new DateTime(1992, 3, 20),
                EmploymentStatus = EmploymentStatus.Unemployed,
                PhoneNumber      = "+38762123456",
                Email            = "*****@*****.**",
                Address          = "Mumijevi 12",
                //Place = "Ilidzanska cesma 123",
                DateCreated    = DateTime.Now,
                EmailConfirmed = true,
                SecurityStamp  = "fafgsddggsafwefaggb",
                //Patients = new List<Patient>() { patient3 }
                Notes = new List <Note>()
                {
                    newNote1, newNote2, newNote3, newNote4
                }
            };


            context.Users.AddOrUpdate(dentist);
            context.Users.AddOrUpdate(dentist2);
            context.Users.AddOrUpdate(patient);
            context.Users.AddOrUpdate(patient2);
            context.Users.AddOrUpdate(patient3);
            context.Users.AddOrUpdate(patient5);
            context.Users.AddOrUpdate(admin);

            //Assign Dentist role between two functions "SaveChanges()" in order to make it work
            context.SaveChanges();

            var userStore   = new UserStore <Dentist>(context);
            var userManager = new UserManager <Dentist>(userStore);

            userManager.AddToRole(dentist.Id, "Dentist");
            userManager.AddToRole(dentist2.Id, "Dentist");

            var userStore2   = new UserStore <Patient>(context);
            var userManager2 = new UserManager <Patient>(userStore2);

            var userStore3   = new UserStore <Admin>(context);
            var userManager3 = new UserManager <Admin>(userStore3);


            userManager2.AddToRole(patient.Id, "Patient");
            userManager2.AddToRole(patient2.Id, "Patient");
            userManager2.AddToRole(patient3.Id, "Patient");
            userManager2.AddToRole(patient5.Id, "Patient");
            userManager3.AddToRole(admin.Id, "Admin");


            context.SaveChanges();
        }
コード例 #17
0
 public void DeleteDentist(Dentist dnt)
 {
     _context.Dentists.Remove(dnt);
 }
コード例 #18
0
        public static void Seed(LaboratoryDbContext context)
        {
            if (context.Dentists.Any())
            {
                return;
            }

            var dentists = new Dentist[]
            {
                new Dentist {
                    FirstName = "Oana", LastName = "Alexandru", City = "Brasov", Email = "*****@*****.**", Phone = "0743243990"
                },
                new Dentist {
                    FirstName = "Paul", LastName = "Muresan", City = "Cluj-Napoca", Email = "*****@*****.**", Phone = "0753843455"
                },
                new Dentist {
                    FirstName = "Vlad", LastName = "Horvat", City = "Turda", Email = "*****@*****.**", Phone = "0744256978"
                },
                new Dentist {
                    FirstName = "Luiza", LastName = "Natura", City = "Cluj-Napoca", Email = "*****@*****.**", Phone = "0752723950"
                },
                new Dentist {
                    FirstName = "Carol", LastName = "Isopescu", City = "Cluj-Napoca", Email = "*****@*****.**", Phone = "0757240900"
                },
                new Dentist {
                    FirstName = "Florin", LastName = "Mihai", City = "Bistrita", Email = "*****@*****.**", Phone = "0744333580"
                }
            };

            foreach (var dentist in dentists)
            {
                context.Dentists.Add(dentist);
            }
            context.SaveChanges();



            var patients = new Patient[]
            {
                new Patient {
                    FirstName = "Remus", LastName = "Pavelean", City = "Cluj-Napoca", Email = "*****@*****.**", Phone = "0754386092"
                },
                new Patient {
                    FirstName = "Oana", LastName = "Pavelean", City = "Cluj-Napoca", Email = "*****@*****.**", Phone = "0744082045"
                },
                new Patient {
                    FirstName = "Andreea", LastName = "Mihasan", City = "Bistrita", Email = "*****@*****.**", Phone = "0757240900"
                },
                new Patient {
                    FirstName = "Mihaela", LastName = "Marcus", City = "Cluj-Napoca", Email = "*****@*****.**", Phone = "0744333580"
                },
                new Patient {
                    FirstName = "Andrei", LastName = "Atodiresei", City = "Bistrita", Email = "*****@*****.**", Phone = "0722776032"
                },
                new Patient {
                    FirstName = "Horatiu", LastName = "Cailean", City = "Brasov", Email = "*****@*****.**", Phone = "0752386702"
                }
            };

            foreach (var patient in patients)
            {
                context.Patients.Add(patient);
            }
            context.SaveChanges();



            var cases = new Case[]
            {
                new Case {
                    DentistId = dentists.Single(d => d.Email == "*****@*****.**").Id, PatientId = patients.Single(p => p.Email == "*****@*****.**").Id, Employee = "Oana Ujica", Stage = Stage.Received, Category = Category.SingleUnit, Tooth = Tooth.LowerCanine, RestorationType = RestorationType.CrownOverImplant, Shade = Shade.A1, Comment = "The case should be ready in 5 working days. Please verify the calendar.", Price = 250.00M, CreationDate = DateTime.Now, IsImplant = true
                },
                new Case {
                    DentistId = dentists.Single(d => d.Email == "*****@*****.**").Id, PatientId = patients.Single(p => p.Email == "*****@*****.**").Id, Employee = "Daniel Moldovan", Stage = Stage.Accepted, Category = Category.MissingTooth, Tooth = Tooth.LowerSecondMolar, RestorationType = RestorationType.CrownOverImplant, Shade = Shade.C2, Comment = "Please verify the color chart for more details.", Price = 3440.00M, CreationDate = DateTime.Now, IsImplant = true
                },
                new Case {
                    DentistId = dentists.Single(d => d.Email == "*****@*****.**").Id, PatientId = patients.Single(p => p.Email == "*****@*****.**").Id, Employee = "Daniel Moldovan", Stage = Stage.CaseInProduction, Category = Category.SingleUnit, Tooth = Tooth.UpperCentralIncisor, RestorationType = RestorationType.Veneer, Shade = Shade.B2, Comment = "Attention to color and shape.", Price = 700.00M, CreationDate = DateTime.Now, IsImplant = false
                },
                new Case {
                    DentistId = dentists.Single(d => d.Email == "*****@*****.**").Id, PatientId = patients.Single(p => p.Email == "*****@*****.**").Id, Employee = "Oana Ujica", Stage = Stage.Received, Category = Category.Bridge, Tooth = Tooth.UpperFirstMolar, RestorationType = RestorationType.CoronoRadicular, Shade = Shade.B4, Comment = "The case should be ready in 14 days.", Price = 1475.00M, CreationDate = DateTime.Now, IsImplant = false
                },
                new Case {
                    DentistId = dentists.Single(d => d.Email == "*****@*****.**").Id, PatientId = patients.Single(p => p.Email == "*****@*****.**").Id, Employee = "Bianca Anastasia", Stage = Stage.Delayed, Category = Category.SingleUnit, Tooth = Tooth.UpperThirdMolar, RestorationType = RestorationType.CrownOverImplant, Shade = Shade.C3, Comment = "Problems with the color.", Price = 1200.00M, CreationDate = DateTime.Now, IsImplant = true
                },
                new Case {
                    DentistId = dentists.Single(d => d.Email == "*****@*****.**").Id, PatientId = patients.Single(p => p.Email == "*****@*****.**").Id, Employee = "Daniel Moldovan", Stage = Stage.CaseInProduction, Category = Category.MissingTooth, Tooth = Tooth.UpperFirstPremolar, RestorationType = RestorationType.SingleUnitWaxUpOnNaturalImplant, Shade = Shade.A1, Comment = "Attention to the shape.", Price = 235.00M, CreationDate = DateTime.Now, IsImplant = true
                }
            };

            foreach (var laboratoryCase in cases)
            {
                context.Cases.Add(laboratoryCase);
            }
            context.SaveChanges();
        }
コード例 #19
0
 public void Editar(Dentist objNovo)
 {
     rep.Editar(objNovo);
 }
コード例 #20
0
 public void AddDentist(Dentist dentist)
 {
     this.database.Dentists.Add(dentist);
     this.database.SaveChanges();
 }
コード例 #21
0
 public IEnumerable <Appointment> GetByPatientAndDentist(Patient patient, Dentist dentist)
 {
     return(appointments.Where(a => a.Dentist.Id == dentist.Id && a.Patient.Id == patient.Id));
 }
コード例 #22
0
 public void Update(Dentist dentist)
 {
     _db.Update(dentist);
 }
コード例 #23
0
ファイル: ClinicTests.cs プロジェクト: vbre/CS_2015_Winter
        public void UseCaseTest()
        {
            // arrange

            IClinic testClinic = new Clinic();
            IDoctor testDoctor = new Dentist();
            IPatient testPatient = new Patient();
            IInsuranceCompany testInsuranceCompany = new InsuranceCompany();
            testInsuranceCompany.Clients.Add(testPatient.Insurance);
            testClinic.AddDoctor(testDoctor);

            // act

            //Пациент приходит в больницу с жалобой
            testPatient.PatientComplaint.Symptoms.Add(Symptom.Headache);
            testClinic.AddPatient(testPatient);

            //Его направляют к нужному врачу(лор, ортопед, стоматолог).
            IDoctor doctorForPatient = testClinic.GiveDoctor(testClinic.Patients.LastOrDefault());

            //Доктор ставит диагноз и выписывает назначение.
            Diagnosis diagnosisForPatient = doctorForPatient.Diagnosticate(testPatient.PatientComplaint);
            Treatment appointmentForPatient = doctorForPatient.PrescribeTreatment(diagnosisForPatient);

            //Больница выставляет счет страховой компании пациента.
            Bill billForPatient = testClinic.GiveBill(appointmentForPatient);

            //Страховая компания оплачивает счет.
            testPatient.PayBill();

            //После оплаты больница начинает лечение.
            testClinic.Cure(testPatient, diagnosisForPatient, appointmentForPatient);

            // assert
            Assert.IsNull(testPatient.PatientComplaint.Symptoms);
        }
コード例 #24
0
 public bool Remove(Dentist obj)
 {
     dentists.Remove(obj);
     return(true);
 }
コード例 #25
0
 public frmEditDentist(Dentist obj)
 {
     InitializeComponent();
     IniciarFormulario(obj);
 }
コード例 #26
0
        public async Task Create(DentistDataModel request)
        {
            var hasDentist = await _dentistRepository.GetAsync(request.Cpf);

            if (hasDentist is not null)
            {
                Notify("Já existe um dentista cadastrado com este cpf informado.");
                return;
            }

            if (request.BirthDate == DateTime.MinValue)
            {
                Notify("Data inválida");
                return;
            }

            var userId = Guid.NewGuid();

            if (request.CreateUser)
            {
                var user = new IdentityUser {
                    UserName = request.Email, Email = request.Email
                };

                userId = Guid.Parse(user.Id);

                var options = _userManager.Options.Password;

                var password = Utils.GeneratePassword(options.RequiredLength, options.RequireNonAlphanumeric, options.RequireDigit, options.RequireLowercase, options.RequireUppercase);

                var result = await _userManager.CreateAsync(user, password);

                if (result.Succeeded)
                {
                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    await _userManager.ConfirmEmailAsync(user, code);

                    await AddClaims(userId);

                    _emailService.SendEmail(user.Email, "Credenciais de Acesso - SisOdonto", "Credenciais", $"Usuário: {user.Email} <br> Senha: {password}");
                }
                else
                {
                    Notify("Erro ao criar usuário.");
                    return;
                }
            }

            var dentist = new Dentist(userId, request.BirthDate, request.Cep, request.City, request.Complement, request.Cpf.Replace(".", "").Replace("-", ""), request.District, request.Email, request.Name, request.Number, request.State, request.Street, request.Cro, request.Expertise);

            if (dentist.IsValid())
            {
                await _dentistRepository.AddAsync(dentist);
            }
            else
            {
                var userManager = await _userManager.FindByIdAsync(userId.ToString());

                if (userManager is not null)
                {
                    await _userManager.DeleteAsync(userManager);
                }

                Notify(dentist.ValidationResult);
                return;
            }

            if (await CommitAsync() is false)
            {
                Notify("Erro ao salvar dados.");

                var userManager = await _userManager.FindByIdAsync(userId.ToString());

                if (userManager is not null)
                {
                    await _userManager.DeleteAsync(userManager);
                }
            }
        }
コード例 #27
0
 public void CreateDentist(Dentist dnt)
 {
     _context.Dentists.Add(dnt);
 }