Example #1
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the Results_List control. Gets the currently selected record ID and loads the record for the selected ID. Populates the form with the loaded record and enables the amend button
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        void Results_ListSelectedIndexChanged(object sender, EventArgs e)
        {
            if (results_List.SelectedIndex == -1)
            {
                return;
            }
            string itemStr = results_List.SelectedItem.ToString();
            string numStr  = itemStr.Remove(0, 1).Split(new string[] { ":" }, StringSplitOptions.None)[0];

            recId = int.Parse(numStr);

            PatientTestResults testResult = dbb.GetTestResult(recId);

            testDate_Text.Text = testResult.Date.Value.ToLongDateString();
            rSph_Text.Text     = testResult.RSpH;
            lSph_Text.Text     = testResult.LSpH;
            rVa1_Text.Text     = testResult.RvA1;
            rVa2_Text.Text     = testResult.RvA2;
            lVa1_Text.Text     = testResult.LVA1;
            lVa2_Text.Text     = testResult.LVA2;
            rCyl_Text.Text     = testResult.RcYL;
            rAxis_Text.Text    = testResult.RAxis;
            lCyl_Text.Text     = testResult.LcYL;
            lAxis_Text.Text    = testResult.LaxIs;
            remarks_Text.Text  = testResult.Remarks;

            users_Text.Text = testResult.Users.Username;

            amend_Button.Enabled = true;
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestResult"/> class. Stores the record ID globally, gets the associated test record, puts the values into the form and fills the user lists with all possible usernames
        /// </summary>
        /// <param name="recId">The record id of the Patient Test Result record to be modified</param>
        public TestResult(int recId)
        {
            InitializeComponent();
            this.Icon  = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            dbb        = new DBBackEnd();
            this.recId = recId;

            PatientTestResults testResult = dbb.GetTestResult(recId);

            rSph_Text.Text      = testResult.RSpH;
            lSph_Text.Text      = testResult.LSpH;
            rVa1_Text.Text      = testResult.RvA1;
            rVa2_Text.Text      = testResult.RvA2;
            lVa1_Text.Text      = testResult.LVA1;
            lVa2_Text.Text      = testResult.LVA2;
            rCyl_Text.Text      = testResult.RcYL;
            rAxis_Text.Text     = testResult.RAxis;
            lCyl_Text.Text      = testResult.LcYL;
            lAxis_Text.Text     = testResult.LaxIs;
            remarks_Text.Text   = testResult.Remarks;
            test_DateTime.Value = testResult.Date.Value;
            foreach (string user in dbb.UserNameList)
            {
                users_ComboBox.Items.Add(user);
            }
            users_ComboBox.SelectedItem = testResult.Users.Username;
        }