コード例 #1
0
 public CreateDoctorViewModel(CreateDoctor open)
 {
     register    = open;
     newUser     = new tblUser();
     newDoctor   = new tblClinicDoctor();
     allManagers = Service.Service.GetManagersList();
 }
コード例 #2
0
 public CreateDoctorViewModel(CreateDoctor open, tblClinicDoctor d, tblUser u)
 {
     register        = open;
     newUser         = u;
     newDoctor       = d;
     allManagers     = Service.Service.GetManagersList();
     isEditingWindow = true;
 }
 public AdministratorViewModel(Administrator open)
 {
     administrator   = open;
     maintenanceList = Service.Service.GetMaintenanceList();
     doctorList      = Service.Service.DoctorList();
     patientList     = Service.Service.PatientsList();
     managerList     = Service.Service.GetManagersList();
     maintenance     = new tblClinicMaintenance();
     doctor          = new tblClinicDoctor();
     manager         = new vwClinicManager();
     patient         = new tblClinicPatient();
 }
コード例 #4
0
        private void SaveExecute(object obj)
        {
            try
            {
                string content = null;
                currentPassword = (obj as PasswordBox).Password;
                if (Model.Person.ValidPassword(currentPassword))
                {
                    newUser.password = currentPassword;
                    tblUser u = Service.Service.AddUser(newUser);
                    newDoctor.userId = u.userId;
                    newDoctor.shift  = selectedShift;
                    if (selectedManager != null)
                    {
                        newDoctor.managerId = selectedManager.managerId;
                    }
                    tblClinicDoctor doc = Service.Service.AddDoctor(newDoctor);
                    if (u != null && doc != null)
                    {
                        if (isEditingWindow)
                        {
                            content = "Doctor with id: " + doc.doctorId + " has been updated";
                        }
                        else
                        {
                            content = "Doctor with id: " + doc.doctorId + "has been registered";
                        }
                        MessageBox.Show(content);
                        isUpdated = true;
                        register.Close();
                    }
                }
                else
                {
                    content = "Doctor registration failed due to weak password";
                    MessageBox.Show("Pasword must contain at least 6charc including one upper, one lower, one numeric and one special char. Try again");
                }

                LogIntoFile.getInstance().PrintActionIntoFile(content);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #5
0
 private void LoginExecute(object obj)
 {
     try
     {
         string content = null;
         person.password = (obj as PasswordBox).Password;
         tblUser user = Service.Service.GetUser(person.username, person.password);
         if (user == null)
         {
             if (person.isMaster())
             {
                 content = "Master has logged in";
                 Master master = new Master();
                 login.Close();
                 master.Show();
             }
             else
             {
                 content = "Unsuccessful login with username " + person.username + " and password " + person.password;
                 MessageBox.Show("Invalid username or password.Try again");
             }
         }
         else
         {
             if (Service.Service.isPatient(user) != null)
             {
                 content = "Patient with username " + person.username + " has logged in.";
                 tblClinicPatient patient = Service.Service.isPatient(user);
                 Patient          p       = new Patient();
                 p.Show();
             }
             else if (Service.Service.isDoctor(user) != null)
             {
                 content = "Doctor with username " + person.username + " has logged in.";
                 tblClinicDoctor doctor = Service.Service.isDoctor(user);
                 Doctor          d      = new Doctor();
                 d.Show();
             }
             else if (Service.Service.isManager(user) != null)
             {
                 content = "Manager with username " + person.username + " has logged in.";
                 tblClinicManager manager = Service.Service.isManager(user);
                 Manager          m       = new Manager();
                 m.Show();
             }
             else
             {
                 tblClinicAdministrator admin = Service.Service.isAdministrator(user);
                 Administrator          a     = new Administrator();
                 content = "Administrator has logged in.";
                 if (Service.Service.InstituteExist())
                 {
                     login.Close();
                     a.Show();
                 }
                 else
                 {
                     CreateClinic create = new CreateClinic(admin);
                     login.Close();
                     create.Show();
                 }
             }
         }
         LogIntoFile.getInstance().PrintActionIntoFile(content);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #6
0
 public CreateDoctor(tblClinicDoctor doc, tblUser user)
 {
     InitializeComponent();
     this.DataContext = new CreateDoctorViewModel(this, doc, user);
 }