예제 #1
0
        public int addNewDetails(MySqlConnection conn, pmdetails pmdetails)
        {
            string sql = "INSERT INTO patientmedicaldetails (p_id, p_systolic, p_diastolic, p_breathing, p_pulse, p_temperater)"
                         + " VALUES (" + pmdetails.P_id + " , " + pmdetails.P_systolic + "   , " + pmdetails.P_diastolic
                         + "   , " + pmdetails.P_breathing + ", " + pmdetails.P_pulse + "   , " + pmdetails.P_temperater1 + ")";

            MySqlCommand sqlComm = new MySqlCommand(sql, conn);

            return(sqlComm.ExecuteNonQuery());
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            DatabaseConnertor databaseConnertor = new DatabaseConnertor();

            databaseConnertor.connect();

            pmdetails pmdetails = new pmdetails();

            pmdetails.P_id          = int.Parse(patientIDTB.Text);
            pmdetails.P_systolic    = int.Parse(systolicTB.Text);
            pmdetails.P_diastolic   = int.Parse(diastolicTB.Text);
            pmdetails.P_breathing   = int.Parse(breathingTB.Text);
            pmdetails.P_pulse       = int.Parse(pulseTB.Text);
            pmdetails.P_temperater1 = double.Parse(temperatureTB.Text);

            pmdetailsHandler pmdetailsHandler = new pmdetailsHandler();
            int recordCnt2 = pmdetailsHandler.addNewDetails(databaseConnertor.getconn(), pmdetails);

            MessageBox.Show(recordCnt2 + " record has been inserted !!");
        }
예제 #3
0
        public List <pmdetails> getAlldetails(MySqlConnection conn)
        {
            List <pmdetails> listdetail = new List <pmdetails>();
            string           sql        = "SELECT * FROM patientmedicaldetails";
            MySqlCommand     sqlComm    = new MySqlCommand(sql, conn);
            MySqlDataReader  myReader;

            myReader = sqlComm.ExecuteReader();
            while (myReader.Read())
            {
                pmdetails aDetail = new pmdetails();
                aDetail.Pm_id         = (int)myReader.GetValue(0);
                aDetail.P_id          = (int)myReader.GetValue(1);
                aDetail.P_systolic    = (int)myReader.GetValue(2);
                aDetail.P_diastolic   = (int)myReader.GetValue(3);
                aDetail.P_breathing   = (int)myReader.GetValue(4);
                aDetail.P_pulse       = (int)myReader.GetValue(5);
                aDetail.P_temperater1 = (int)myReader.GetValue(6);
                listdetail.Add(aDetail);
            }
            return(listdetail);
        }