Пример #1
0
        public void GoToMedicinesForm()
        {
            foreach (Form form in MdiChildren)
            {
                form.Close();
            }
            MedicinesForm medicinesForm = new MedicinesForm(this);

            medicinesForm.Show();
            medicinesForm.Dock = DockStyle.Fill;
        }
Пример #2
0
        private void ComeBack()
        {
            MedicinesForm medicinesForm = new MedicinesForm
            {
                MdiParent = MdiParent
            };

            medicinesForm.Show();
            medicinesForm.Dock = DockStyle.Fill;
            Close();
        }
        private void LoginButton_Click(object sender, EventArgs e)
        {
            string login    = loginTextBox.Text.ToString();
            string password = passwordTextBox.Text.ToString();

            try
            {
                Account account = db.Accounts.Where(acc => acc.Login == login).Select(acc => acc).First();
                if (account.Password == password)
                {
                    (MdiParent as MainForm).employee = account.Employee;
                    if (account.SecurityLevel.Code == "doctor")
                    {
                        PatientsForm patientsForm = new PatientsForm
                        {
                            MdiParent = MdiParent
                        };
                        patientsForm.Show();
                        patientsForm.Dock = DockStyle.Fill;
                        Close();
                    }
                    else if (account.SecurityLevel.Code == "admin")
                    {
                        MedicinesForm medicinesForm = new MedicinesForm
                        {
                            MdiParent = MdiParent
                        };
                        medicinesForm.Show();
                        medicinesForm.Dock = DockStyle.Fill;
                        Close();
                    }
                }
                else
                {
                    MessageBox.Show("Неправильный пароль");
                }
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Аккаунт не найден");
            }
        }