예제 #1
0
        private void addResults(string results, string technician)
        {
            LabTest.LabTest labtest = new LabTest.LabTest();
            labtest.results = results;
            labtest.techID  = technician;

            bool success = labtest.SubmitTestResults(labTestID, labtest, this);

            if (success == true)
            {
                CustomMessageBox cm = new CustomMessageBox("Successfully Submited Test Results", this, gotoLabTests);
                removeErrors();
                ClearField();
                cm.Show();
            }
        }
예제 #2
0
        public bool SubmitTestResults(int labTestID, LabTest labtest, Form form)
        {
            bool isSuccess = false;

            //Step 1: Create database connection string query,
            conn = new SqlConnection(myconnstring);

            try
            {
                string qry = @" UPDATE [PremiereCareHospital].[dbo].Lab_Test SET tech_id=@tech_id, results=@results, status_id=@status WHERE test_id = @labTestID ";

                cmd = new SqlCommand(qry, conn);
                cmd.Parameters.AddWithValue("@results", labtest.results);
                cmd.Parameters.AddWithValue("@tech_id", labtest.techID);
                cmd.Parameters.AddWithValue("@status", 2);
                cmd.Parameters.AddWithValue("@labTestID", labTestID);

                conn.Open();
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
예제 #3
0
        public bool CreateLabRequest(LabTest labtest, Form form)
        {
            bool isSuccess = false;

            //Step 1: Create database connection string query,
            conn = new SqlConnection(myconnstring);

            try
            {
                string qry = @"INSERT INTO  [PremiereCareHospital].[dbo].Lab_Test (test_id, doc_id, appointment_id) 
                            VALUES(NEXT VALUE FOR lab_test_seq, @doctor, @appointment)";

                cmd = new SqlCommand(qry, conn);
                cmd.Parameters.AddWithValue("@doctor", labtest.docID);
                cmd.Parameters.AddWithValue("@appointment", labtest.appointmentID);

                conn.Open();
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }