Пример #1
0
        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);
        }
Пример #2
0
        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();
            }
        }