Esempio n. 1
0
        public void updatePatientBedsideIdAndReadings(MySqlConnection conn, Patient ptient, ModuleReadings moduleRConf)
        {
            int theBedSideId = bedSideId(conn, ptient);

            //Update bedside table
            int patientId = 0;

            string selectPatientIdSql = "SELECT patientId FROM `patient` WHERE bedsideId=" + theBedSideId + ";";

            MySqlCommand sqlComm1 = new MySqlCommand(selectPatientIdSql, conn);

            using (MySqlDataReader sqlReader = sqlComm1.ExecuteReader())
            {
                while (sqlReader.Read())
                {
                    patientId = (int)sqlReader.GetValue(0);
                }
            }

            string       updateBedSideSql = "UPDATE `bedside` SET `status`=1, `patientId`=" + patientId + " WHERE `bedsideId`=" + theBedSideId + ";";
            MySqlCommand sqlComm2         = new MySqlCommand(updateBedSideSql, conn);

            sqlComm2.ExecuteNonQuery();

            ModuleReadingsHandler mRHand = new ModuleReadingsHandler();

            mRHand.updatePatientBedsideId(conn, moduleRConf, patientId, "New");
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DbConnector dbConn = new DbConnector();

            dbConn.connect();

            string checkId = label11.Text;

            ModuleReadingsHandler mRHand = new ModuleReadingsHandler();

            if (textBox3.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRMin", checkId) &&
                textBox4.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRMax", checkId) &&
                textBox23.Text == mRHand.getModuleReading(dbConn.getConn(), "pulseRIntTime", checkId) &&
                textBox6.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRMin", checkId) &&
                textBox5.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRMax", checkId) &&
                textBox24.Text == mRHand.getModuleReading(dbConn.getConn(), "breathRIntTime", checkId) &&
                textBox8.Text == mRHand.getModuleReading(dbConn.getConn(), "systolicMin", checkId) &&
                textBox7.Text == mRHand.getModuleReading(dbConn.getConn(), "systolicMax", checkId) &&
                textBox9.Text == mRHand.getModuleReading(dbConn.getConn(), "diastolicMin", checkId) &&
                textBox10.Text == mRHand.getModuleReading(dbConn.getConn(), "diastolicMax", checkId) &&
                textBox25.Text == mRHand.getModuleReading(dbConn.getConn(), "bloodPIntTime", checkId) &&
                textBox11.Text == mRHand.getModuleReading(dbConn.getConn(), "tempMin", checkId) &&
                textBox12.Text == mRHand.getModuleReading(dbConn.getConn(), "tempMax", checkId) &&
                textBox26.Text == mRHand.getModuleReading(dbConn.getConn(), "tempIntTime", checkId))
            {
                MessageBox.Show("No changes detected");
            }
            else
            {
                ModuleReadings mConfig = new ModuleReadings();

                string thePatientId = checkId;

                mConfig.MinPulse     = Int32.Parse(textBox3.Text);
                mConfig.MaxPulse     = Int32.Parse(textBox4.Text);
                mConfig.MinBreath    = Int32.Parse(textBox6.Text);
                mConfig.MaxBreath    = Int32.Parse(textBox5.Text);
                mConfig.MinSystolic  = Int32.Parse(textBox8.Text);
                mConfig.MaxSystolic  = Int32.Parse(textBox7.Text);
                mConfig.MinDiastolic = Int32.Parse(textBox9.Text);
                mConfig.MaxDiastolic = Int32.Parse(textBox10.Text);
                mConfig.MinTemp      = float.Parse(textBox11.Text);
                mConfig.MaxTemp      = float.Parse(textBox12.Text);

                mConfig.PulseIntTime    = Int32.Parse(textBox23.Text);
                mConfig.BreathIntTime   = Int32.Parse(textBox24.Text);
                mConfig.PressureIntTime = Int32.Parse(textBox25.Text);
                mConfig.TempIntTime     = Int32.Parse(textBox26.Text);

                mConfig.PRModifiedTime   = DateTime.Now.ToString();
                mConfig.BRModifiedTime   = DateTime.Now.ToString();
                mConfig.BPModifiedTime   = DateTime.Now.ToString();
                mConfig.TempModifiedTime = DateTime.Now.ToString();

                mRHand.updatePatientBedsideId(dbConn.getConn(), mConfig, Int32.Parse(thePatientId), "New");

                MessageBox.Show("Module Reading Changed Successfully !");
            }
        }