Exemplo n.º 1
0
        private void buttonDeleteUser_Click(object sender, EventArgs e)
        {
            string username = usersControlUpdateUser.UserName;

            string msg = string.Format("Delete user: '******'?", username);

            if (DialogResult.No == MessageBox.Show(this, msg, "Delete User", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                return;
            }

            if (string.Compare(username.Trim(), _currentUserName.Trim(), true) == 0)
            {
                string sMsg = "Failed to delete user '" + username + "'.  The currently logged in user cannot be deleted.";

                Logger.LogMessage("Delete User", sMsg);
                return;
            }

            ControllerReturnCode ret = _controller.DeleteUser(username);

            if (ret == ControllerReturnCode.Success)
            {
                InitializeTabUpdateUser();
            }
            Logger.LogControllerResult("DeleteUser", ret);
            Logger.LogMessage(string.Empty, string.Format("User '{0}' successfuly deleted.", username));
        }
Exemplo n.º 2
0
        private void buttonUpdateUser_Click(object sender, EventArgs e)
        {
            string        username    = usersControlUpdateUser.UserName;
            string        password    = usersControlUpdateUser.Password;
            List <string> roles       = usersControlUpdateUser.Roles;
            List <string> permissions = usersControlUpdateUser.Permissions;

            CreateUserOptions options = CreateUserOptions.UpdateUser | CreateUserOptions.UpdatePermissions | CreateUserOptions.UpdateRoles;

            if (usersControlUpdateUser.UpdatePassword)
            {
                options |= CreateUserOptions.UpdatePassword;
            }

            ControllerReturnCode ret = _controller.CreateUser(
                username,
                password,
                _currentUserName,
                _currentPassword,
                false,
                permissions.ToArray(),
                roles.ToArray(),
                options);

            Logger.LogControllerResult("UpdateUser", ret);
        }
Exemplo n.º 3
0
        private void buttonDeletePatient_Click(object sender, EventArgs e)
        {
            string patientId = patientControlUpdatePatient.ComboBoxPatientId.GetItemText(patientControlUpdatePatient.ComboBoxPatientId.SelectedItem);

            if (string.IsNullOrEmpty(patientId))
            {
                return;
            }

            string msg = string.Format("Delete patient with PatientId: '{0}'?", patientId);

            if (DialogResult.No == MessageBox.Show(this, msg, "Delete Patient", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                return;
            }

            ControllerReturnCode ret = _controller.DeletePatient(patientId);

            Logger.LogControllerResult("DeletePatient", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(string.Empty, string.Format("Patient Deleted: PatientId {0}: ", patientId));
                IntializeTabUpdatePatient();
                UpdateUI_TabUpdatePatient();
            }
        }
Exemplo n.º 4
0
        private void UpdateUI()
        {
            if (tabControl1.InvokeRequired)
            {
                UpdateUICallback cb = new UpdateUICallback(UpdateUI);
                this.Invoke(cb);
            }

            else
            {
                menuItemLogin.Enabled  = !_controller.IsLoggedIn;
                menuItemLogout.Enabled = _controller.IsLoggedIn;
                tabControl1.Enabled    = _controller.IsLoggedIn;

                if (_controller != null && _controller.IsLoggedIn)
                {
                    List <Permission>    permissionList = new List <Permission>();
                    ControllerReturnCode ret            = _controller.GetPermissions(permissionList);

                    List <Role> roleList = new List <Role>();
                    ret = _controller.GetRoles(roleList);

                    // Update Users Tab
                    usersControlUpdateUser.InitializeDefaults(permissionList, roleList);

                    // Add Users Tab
                    usersControlAddUser.InitializeDefaults(permissionList, roleList);
                }
            }
        }
Exemplo n.º 5
0
        ControllerReturnCode Start()
        {
            var applicationName = string.Empty;
            var version         = string.Empty;

            _controller.Timeout = _timeout;

            if (_controller.IsStarted)
            {
                _controller.Shutdown();
            }

            ControllerReturnCode ret = _controller.InitApplication(out applicationName, out version, _port);

            Logger.LogControllerResult("InitApplication", ret);

            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(
                    string.Empty,
                    string.Format("ApplicationName: {0}", applicationName),
                    string.Format("Version: {0} ", version),
                    string.Format("Timeout: {0} ", _timeout.ToString()),
                    string.Format("Port: {0} ", _port.ToString())
                    );
            }

            return(ret);
        }
Exemplo n.º 6
0
 void Stop()
 {
     if (_controller.IsStarted)
     {
         ControllerReturnCode ret = _controller.Shutdown();
         Logger.LogControllerResult("Shutdown", ret);
     }
     UpdateUI();
 }
Exemplo n.º 7
0
        private void buttonGetCurrentPatient_Click(object sender, EventArgs e)
        {
            PatientInfo          info = new PatientInfo();
            ControllerReturnCode ret  = _controller.GetCurrentPatient(out info);

            Logger.LogControllerResult("GetCurrentPatient", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(info);
            }
        }
Exemplo n.º 8
0
        private void buttonShowSeries_Click(object sender, EventArgs e)
        {
            string seriesInstanceUid = comboBoxSeriesInstanceUid.Text.Trim();
            ControllerReturnCode ret = _controller.ShowSeries(seriesInstanceUid);

            Logger.LogControllerResult("ShowSeries", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(string.Empty, string.Format("SeriesInstanceUid: {0}", seriesInstanceUid));
            }
        }
Exemplo n.º 9
0
        private void buttonShowPatient_Click(object sender, EventArgs e)
        {
            string patientId = comboBoxPatientIdViewInstances.Text.Trim();

            ControllerReturnCode ret = _controller.ShowPatient(patientId);

            Logger.LogControllerResult("ShowPatient", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(string.Empty, string.Format("PatientId: {0}", patientId));
            }
        }
Exemplo n.º 10
0
        private void InitializeTabUpdateUser()
        {
            List <string>        userList = new List <string>();
            ControllerReturnCode ret      = _controller.GetUsers(userList);

            Logger.LogControllerResult("GetPermissions", ret);
            if (ret == ControllerReturnCode.Success)
            {
                usersControlUpdateUser.UpdateUserList(userList);
                usersControlUpdateUser.ComboBoxUserName.SelectedIndex = 0;
            }
        }
Exemplo n.º 11
0
        private void buttonUpdatePatient_Click(object sender, EventArgs e)
        {
            PatientInfo info = patientControlUpdatePatient.GetPatientInfo();

            info.PatientId = patientControlUpdatePatient.ComboBoxPatientId.GetItemText(patientControlUpdatePatient.ComboBoxPatientId.SelectedItem);

            ControllerReturnCode ret = _controller.UpdatePatient(info);

            Logger.LogControllerResult("UpdatePatient", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(info);
            }
        }
Exemplo n.º 12
0
        private void buttonFindPatient_Click(object sender, EventArgs e)
        {
            string             patientId = comboBoxPatientIdPatientInformation.Text.Trim();
            FindPatientOptions options   = radioButtonFindPatientAll.Checked ? FindPatientOptions.All : FindPatientOptions.WithInstances;
            PatientInfo        info      = new PatientInfo();

            List <PatientInfo>   patients = new List <PatientInfo>();
            ControllerReturnCode ret      = _controller.FindPatient(patientId, options, patients);

            Logger.LogControllerResult("FindPatient", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(patients[0]);
            }
        }
Exemplo n.º 13
0
        ControllerReturnCode Login()
        {
            string username          = textBoxUser.Text.Trim();
            string password          = textBoxPassword.Text.Trim();
            ControllerReturnCode ret = _controller.UserLogin(textBoxUser.Text, textBoxPassword.Text);

            Logger.LogControllerResult("UserLogin", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(
                    string.Empty,
                    string.Format("UserName: {0}", username),
                    string.Format("Password: {0} ", password));
            }
            return(ret);
        }
Exemplo n.º 14
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            _controller.SelectedBrowser = SelectedBrowser;
            ControllerReturnCode ret = Start();

            if (ret == ControllerReturnCode.Success)
            {
                ret = Login();
            }
            if (ret == ControllerReturnCode.Success)
            {
                this.DialogResult = DialogResult.OK;
                _userName         = textBoxUser.Text.Trim();
                _password         = textBoxPassword.Text.Trim();
                Close();
            }
        }
Exemplo n.º 15
0
        public static ControllerReturnCode ToControllerReturnCode(this string s)
        {
            ControllerReturnCode ret = ControllerReturnCode.Undefined;

            if (string.Compare(s, GenericActionStatus.Success) == 0)
            {
                ret = ControllerReturnCode.Success;
            }
            else if (string.Compare(s, GenericActionStatus.Ok) == 0)
            {
                ret = ControllerReturnCode.Success;
            }
            else if (string.Compare(s, GenericActionStatus.Failure) == 0)
            {
                ret = ControllerReturnCode.Failure;
            }
            return(ret);
        }
Exemplo n.º 16
0
        public static void LogControllerResult(string command, ControllerReturnCode code)
        {
            switch (code)
            {
            case ControllerReturnCode.Success:
                Logger.LogMessageLine(command, "Success");
                break;

            case ControllerReturnCode.AlreadyInitialized:
                Logger.LogMessageLine(command, "Error: AlreadyInitialized");
                break;

            case ControllerReturnCode.AuthenticationFailure:
                Logger.LogMessageLine(command, "Error: AuthenticationFailure");
                Logger.LogMessageLine(string.Empty, _controller.FailureMessage);
                break;

            case ControllerReturnCode.Failure:
                Logger.LogMessageLine(command, "Error: Failure", _controller.FailureMessage);
                break;

            case ControllerReturnCode.NotProperlyInitiated:
                Logger.LogMessageLine(command, "Error: NotProperlyInitiated");
                break;

            case ControllerReturnCode.TimedOut:
                Logger.LogMessageLine(command, "Error: TimedOut");
                break;

            case ControllerReturnCode.UnknownError:
                Logger.LogMessageLine(command, "Error: UnknownError");
                break;

            case ControllerReturnCode.InvalidViewerUrl:
                Logger.LogMessageLine(command, "Error: InvalidViewerUrl ");
                Logger.LogMessageLine(string.Empty, _controller.FailureMessage);
                break;

            case ControllerReturnCode.InvalidServiceUrl:
                Logger.LogMessageLine(command, "Error: InvalidServiceUrl");
                Logger.LogMessageLine(string.Empty, _controller.FailureMessage);
                break;
            }
        }
Exemplo n.º 17
0
        private void buttonAddPatient_Click(object sender, EventArgs e)
        {
            PatientInfo info = patientControlAddPatient.GetPatientInfo();

            if (string.IsNullOrEmpty(info.PatientId))
            {
                string  msg         = "'Patient ID' must contain a value.";
                TextBox tbPatientId = patientControlAddPatient.TextBoxPatientId;
                errorProvider1.SetError(tbPatientId, msg);
                Logger.LogMessage("AddPatient", "Error: " + msg);
                return;
            }
            ControllerReturnCode ret = _controller.AddPatient(info);

            Logger.LogControllerResult("AddPatient", ret);
            if (ret == ControllerReturnCode.Success)
            {
                Logger.LogMessage(info);
            }
        }
Exemplo n.º 18
0
 private void UpdateUI_TabUpdatePatient()
 {
     if (patientControlUpdatePatient.ComboBoxPatientId.Items.Count > 0)
     {
         string patientId = patientControlUpdatePatient.ComboBoxPatientId.GetItemText(patientControlUpdatePatient.ComboBoxPatientId.SelectedItem);
         if (!string.IsNullOrEmpty(patientId))
         {
             List <PatientInfo>   patients = new List <PatientInfo>();
             ControllerReturnCode ret      = _controller.FindPatient(patientId, FindPatientOptions.All, patients);
             if (ret == ControllerReturnCode.Success)
             {
                 patientControlUpdatePatient.UpdatePatient(patients[0]);
             }
         }
     }
     else
     {
         patientControlUpdatePatient.UpdatePatient(null);
     }
 }
Exemplo n.º 19
0
        // returns 'true' if sending logout message to browser
        // returns 'false' if not logged in
        bool Logout()
        {
            bool updateUI   = false;
            bool sentLogout = false;

            if (_controller != null && _controller.IsLoggedIn)
            {
                ControllerReturnCode ret = _controller.UserLogout();
                Logger.LogControllerResult("UserLogout", ret);
                updateUI   = true;
                sentLogout = true;
            }

            if (_controller != null && _controller.IsStarted)
            {
                // _controller.CloseApplication();
                updateUI = true;
            }
            if (updateUI)
            {
                UpdateUI();
            }
            return(sentLogout);
        }
Exemplo n.º 20
0
        private string PopulatePatientIdComboBox(ComboBox cb)
        {
            cb.Items.Clear();

            List <PatientInfo>   patients = new List <PatientInfo>();
            ControllerReturnCode ret      = _controller.FindPatient(null, FindPatientOptions.All, patients, MaxQueryResults.Patient);

            if (ret != ControllerReturnCode.Success)
            {
                Logger.LogControllerResult("FindPatient", ret);
            }

            foreach (PatientInfo p in patients)
            {
                cb.Items.Add(p.PatientId);
            }

            if (cb.Items.Count > 0)
            {
                cb.SelectedIndex = 0;
            }

            return(cb.Text);
        }
Exemplo n.º 21
0
        private string PopulateSopInstanceUidComboBox(string patientId, string studyInstanceUid, string seriesInstanceUid, ComboBox cb)
        {
            cb.Items.Clear();

            List <InstanceInfo>  instances = new List <InstanceInfo>();
            ControllerReturnCode ret       = _controller.FindInstances(patientId, studyInstanceUid, seriesInstanceUid, instances);

            if (ret != ControllerReturnCode.Success)
            {
                Logger.LogControllerResult("FindInstances", ret);
            }

            foreach (InstanceInfo p in instances)
            {
                cb.Items.Add(p.SopInstanceUid);
            }

            if (cb.Items.Count > 0)
            {
                cb.SelectedIndex = 0;
            }

            return(cb.Text);
        }