internal void SaveAccount(int id, string email, string password, string userType, account cont)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            if (id == -1)
            {
                if (userType == "Admin")
                {
                    context.AddAccount(email, password, 2);
                }
                else if (userType == "Patient")
                {
                    context.AddAccount(email, password, 3);
                }
                else if (userType == "Doctor")
                {
                    context.AddAccount(email, password, 1);
                }
                context.SaveChanges();
            }
            else
            {
                context.ModifyAccount(id, email, password);
                context.SaveChanges();
            }
            MainViewModel.Instance.ActiveScreen = new AccountsViewModel(cont);
        }
        public void RemoveUser(int id)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            context.DeactivateDoctor(id);
            context.SaveChanges();
        }
        public void AddPersonDetails(int id, string fullName, int docPatientId, string adress, string phoneNumber, string email, bool isDoctor, bool existing)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            if (isDoctor == true)
            {
                if (existing == false)
                {
                    context.AddDoctorDetails(fullName, adress, phoneNumber, email);
                }
                else
                {
                    context.UpdateDoctorDetails(id, fullName, adress, phoneNumber, email);
                }
            }
            else
            {
                if (existing == false)
                {
                    context.AddPatientDetails(fullName, adress, phoneNumber, email, docPatientId);
                }
                else
                {
                    context.UpdatePatientDetails(id, fullName, adress, phoneNumber, email, docPatientId);
                }
            }
            context.SaveChanges();
        }
示例#4
0
        internal void SaveAppointment(patient selectedPatient, doctor doctor, DateTime selectedDate, doctorProcedure procedure, int duration)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            context.AddAppointment(selectedDate, duration, doctor.idDoctor, selectedPatient.idPatient, procedure.idProcedure);
            context.SaveChanges();
            MainViewModel.Instance.ActiveScreen = new AppointemtsViewModel();
        }
        public void RemovePatient(patient selectedPatient)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            context.DeactivatePatient(selectedPatient.idPatient);
            context.SaveChanges();
            MainViewModel.Instance.ActiveScreen = new PatientViewModel();
        }
        internal void DeleteAccount(int id, account _cont)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            context.DeactivateAccount(id);
            context.SaveChanges();
            MainViewModel.Instance.ActiveScreen = new AccountsViewModel(_cont);
        }
        public void SignUp(string name, string password)
        {
            DentistOfficeEntities2 context = new DentistOfficeEntities2();

            var  conturi      = context.accounts.ToList();
            bool contExistent = false;

            foreach (var cont in conturi)
            {
                if (cont.email == name)
                {
                    MessageBox.Show("Cont deja creat!");
                    contExistent = true;
                }
            }
            if (contExistent == false)
            {
                context.AddAccount(name, password, 2);

                context.SaveChanges();
                MessageBox.Show("Cont creat cu succes!");
                MainViewModel.Instance.ActiveScreen = new LogInViewModel();
            }
        }