Esempio n. 1
0
        private void InsertNotes()
        {
            Notes = Interaction.InputBox("Enter Note:", "TeleRad - Client", " ");

            string            strSQL = "";
            string            centre = " ";
            Myconnectionclass CN2    = new Myconnectionclass();
            OdbcCommand       Cmd2;
            OdbcDataReader    Rs2;

            CN2.OpenConnection();
            Cmd2 = new System.Data.Odbc.OdbcCommand("SELECT * from UserMaster WHERE UserName='******'", CN2.DBConnection);
            Rs2  = Cmd2.ExecuteReader();
            if (Rs2.HasRows)
            {
                centre = Rs2["Centre"].ToString();
            }
            Rs2.Close();
            Cmd2.Dispose();
            CN2.closeconnection();

            CN.OpenConnection();
            Cmd = new System.Data.Odbc.OdbcCommand("SELECT * from Reports WHERE StudyUID='" + StID + "'", CN.DBConnection);
            Rs1 = Cmd.ExecuteReader();
            if (Rs1.HasRows)
            {
                if (Notes.Length <= 0)
                {
                    strSQL = "UPDATE Reports SET IsNotes=0, Centre='" + centre + "' WHERE StudyUID='" + StID + "'";
                }
                else
                {
                    strSQL = "UPDATE Reports SET Notes='" + Notes + "', IsNotes=1, Centre='" + centre + "' WHERE StudyUID='" + StID + "'";
                }
            }
            else
            {
                if (Notes.Length <= 0)
                {
                    strSQL = "INSERT INTO Reports (StudyUID, IsNotes,Centre) VALUES ('" + StID + "',1,'" + centre + "')";
                }
                else
                {
                    strSQL = "INSERT INTO Reports (StudyUID, Notes, IsNotes,Centre) VALUES ('" + StID + "', '" + Notes + "', 1,'" + centre + "')";
                }
            }
            Rs1.Close();
            Cmd.Dispose();
            CN.closeconnection();

            CN.OpenConnection();
            Cmd = new System.Data.Odbc.OdbcCommand(strSQL, CN.DBConnection);
            Rs1 = Cmd.ExecuteReader();
            Rs1.Close();
            Cmd.Dispose();
            CN.closeconnection();
            MessageBox.Show("Successfully Sent Study", "TeleRad - Client", MessageBoxButtons.OK);
        }
        private void btnViewNotes_Click(object sender, EventArgs e)
        {
            if (DataGridView1.SelectedCells[13].Value.ToString() == false.ToString())
            {
                MessageBox.Show("No Notes to view", "TeleRad - Client", MessageBoxButtons.OK);
                return;
            }

            Myconnectionclass CN = new Myconnectionclass();
            OdbcCommand       Cmd;
            OdbcDataReader    Rs1;

            CN.OpenConnection();
            Cmd = new System.Data.Odbc.OdbcCommand("SELECT * FROM Reports WHERE StudyUID='" + DataGridView1.SelectedCells[5].Value.ToString() + "'", CN.DBConnection);
            Rs1 = Cmd.ExecuteReader();
            Rs1.Read();
            if (Convert.ToBoolean(Rs1["IsNotes"]) == true)
            {
                MessageBox.Show("Notes sent: " + Rs1["Notes"].ToString(), "TeleRad - Client", MessageBoxButtons.OK);
            }
            Rs1.Close();
            Cmd.Dispose();
            CN.closeconnection();
        }