Exemplo n.º 1
0
        //go to the bedside main screen when bedside id currently is assigned to the patient
        private void continueExistingBtn_Click(object sender, EventArgs e)
        {
            if (bedsideIdExistingComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Please select valid bedsideId");
                return;
            }
            BedsideHandler bedsideHandler = new BedsideHandler();
            DBConnector    dbC            = new DBConnector();

            dbC.connect();
            int  bedsideId = int.Parse(bedsideIdExistingComboBox.SelectedItem.ToString());
            int  patientId = int.Parse(patientIdTextBox.Text);
            bool status    = bedsideHandler.continueBedside(dbC.getConn(), bedsideId, patientId);

            if (status)
            {
                bedside_patient_id = patientId;
                bedsideIDPass      = bedsideId;
                BedsideMainScreen bedsideMainScreen = new BedsideMainScreen();
                bedsideMainScreen.Show();

                Close();
            }
        }
Exemplo n.º 2
0
        //assign bedside id to a patient
        private void proceedAssignBtn_Click(object sender, EventArgs e)
        {
            //if bedsideIdAssignComboBox selected index = 0, show warning message
            if (bedsideIdAssignComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Please select valid bedside id", "Bedside ID", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //patientIDAssignComboBox selected index = 0, show warning message
            if (patientIDAssignComboBox.SelectedIndex == 0)
            {
                MessageBox.Show("Please select valid patient id", "Patient ID", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //connect database
            DBConnector dbC = new DBConnector();

            dbC.connect();

            //get current bedside id when user selected the combo box items
            int bedsideId = int.Parse(bedsideIdAssignComboBox.SelectedItem.ToString());

            //get current patient id when user selected the combo box items
            int patientId = int.Parse(patientIDAssignComboBox.SelectedItem.ToString());

            //create new object bedside handler
            BedsideHandler bedsideHandler = new BedsideHandler();

            //assign a bedside id to a patient
            int assignResult = bedsideHandler.assignBedside(dbC.getConn(), bedsideId, patientId);

            //if assignresult return value = 1
            if (assignResult == 1)
            {
                //assign bedside id to patient
                int statusResult = bedsideHandler.updateStatus(dbC.getConn(), bedsideId);

                if (statusResult == 1)
                {
                    //static int field get value from patientId
                    bedside_patient_id = patientId;
                    bedsideIDPass      = bedsideId;
                    //create new object bedside main screen
                    BedsideMainScreen ms = new BedsideMainScreen();

                    //show bedside main screen
                    ms.Show();

                    //close login screen
                    Close();
                }
                else
                {
                    //show error message if failed to access
                    MessageBox.Show("Failed to access", "Failed to access", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                //show error message  if failed to access
                MessageBox.Show("Failed to access", "Failed to access", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }