private void btnMute_Click(object sender, EventArgs e)
        {
            if (tbStaffName.Text == "")
            {
                MessageBox.Show("Insert Staff Name");
            }
            else
            {
                SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle,
                             (IntPtr)APPCOMMAND_VOLUME_MUTE);

                DatabaseConnertor databaseConnertor = new DatabaseConnertor();
                databaseConnertor.connect();

                active active = new active();
                active.Ms_name             = tbStaffName.Text;
                active.Bed_number          = int.Parse(bedNo.Text);
                active.Staff_checkdatetime = DateTime.Parse(lbDateTime.Text);

                activeHandler activeHandler = new activeHandler();
                int           recordCnt1    = activeHandler.addActive(databaseConnertor.getconn(), active);

                Timer.Stop();
                MessageBox.Show("Checked Patient");
            }
        }
Example #2
0
        public int addActive(MySqlConnection conn, active active)
        {
            string sql = "INSERT INTO bed_active (ms_name, bed_number, emergency_datetime, staff_checkdatetime, systolic, diastolic, pulse, breathing, temperature)"
                         + " VALUES ('" + active.Ms_name + "', " + active.Bed_number + ", '" + active.Emergency_datetime.ToString("yyyy-MM-dd HH:mm:ss")
                         + "'   , '" + active.Staff_checkdatetime.ToString("yyyy-MM-dd HH:mm:ss") + "'  , " + active.Systolic + "  ," + active.Diastolic
                         + "  , " + active.Pulse + "  , " + active.Breathing + "  , " + active.Temperature + ")";

            MySqlCommand sqlComm = new MySqlCommand(sql, conn);

            return(sqlComm.ExecuteNonQuery());
        }
        private void timer2_Tick(object sender, EventArgs e)
        {
            //This code for Connet with realtime

            /*bsys.Text = RealTime.passingtext1;
             * bdia.Text = RealTime.passingtext2;
             * bpul.Text = RealTime.passingtext3;
             * bbre.Text = RealTime.passingtext4;
             * btem.Text = RealTime.passingtext5;
             * pid.Text = RealTime.passingtext6;*/

            bsrandomnum = random.Next(85, 145);
            bdrandomnum = random.Next(65, 100);
            prandomnum  = random.Next(65, 75);
            brandomnum  = random.Next(12, 20);
            trandomnum  = random.Next(36, 37);
            bsys.Text   = bsrandomnum.ToString();
            bdia.Text   = bdrandomnum.ToString();
            bpul.Text   = prandomnum.ToString();
            bbre.Text   = brandomnum.ToString();
            btem.Text   = trandomnum.ToString();

            int bsyst = int.Parse(bsys.Text);
            int bdiat = int.Parse(bdia.Text);
            int bpult = int.Parse(bpul.Text);
            int bbret = int.Parse(bbre.Text);
            int btemt = int.Parse(btem.Text);

            int sysmin = int.Parse(sysMin.Text);
            int sysmax = int.Parse(sysMax.Text);
            int diamin = int.Parse(diaMin.Text);
            int diamax = int.Parse(diaMax.Text);
            int pulmin = int.Parse(pulMin.Text);
            int pulmax = int.Parse(pulMax.Text);
            int bremin = int.Parse(breMin.Text);
            int bremax = int.Parse(breMax.Text);
            int temmin = int.Parse(temMin.Text);
            int temmax = int.Parse(temMax.Text);

            if (bsyst <= sysmin || bsyst >= sysmax)
            {
                bcolor.BackColor = Color.Red;
                SoundPlayer player1 = new System.Media.SoundPlayer(Properties.Resources.Alarm);
                player1.Play();

                DatabaseConnertor databaseConnertor = new DatabaseConnertor();
                databaseConnertor.connect();

                active active = new active();
                active.Bed_number         = int.Parse(bedNo.Text);
                active.Emergency_datetime = DateTime.Parse(lbDateTime.Text);
                active.Systolic           = int.Parse(bsys.Text);

                activeHandler activeHandler = new activeHandler();
                int           recordCnt1    = activeHandler.addActive(databaseConnertor.getconn(), active);
            }
            else if (bdiat <= diamin || bdiat >= diamax)
            {
                bcolor.BackColor = Color.Red;
                SoundPlayer player1 = new System.Media.SoundPlayer(Properties.Resources.Alarm);
                player1.Play();

                DatabaseConnertor databaseConnertor = new DatabaseConnertor();
                databaseConnertor.connect();

                active active = new active();
                active.Bed_number         = int.Parse(bedNo.Text);
                active.Emergency_datetime = DateTime.Parse(lbDateTime.Text);
                active.Diastolic          = int.Parse(bdia.Text);

                activeHandler activeHandler = new activeHandler();
                int           recordCnt1    = activeHandler.addActive(databaseConnertor.getconn(), active);
            }
            else if (bpult <= pulmin || bpult >= pulmax)
            {
                bcolor.BackColor = Color.Red;
                SoundPlayer player1 = new System.Media.SoundPlayer(Properties.Resources.Alarm);
                player1.Play();

                DatabaseConnertor databaseConnertor = new DatabaseConnertor();
                databaseConnertor.connect();

                active active = new active();
                active.Bed_number         = int.Parse(bedNo.Text);
                active.Emergency_datetime = DateTime.Parse(lbDateTime.Text);
                active.Pulse = int.Parse(bpul.Text);

                activeHandler activeHandler = new activeHandler();
                int           recordCnt1    = activeHandler.addActive(databaseConnertor.getconn(), active);
            }
            else if (bbret <= bremin || bbret >= bremax)
            {
                bcolor.BackColor = Color.Red;
                SoundPlayer player1 = new System.Media.SoundPlayer(Properties.Resources.Alarm);
                player1.Play();

                DatabaseConnertor databaseConnertor = new DatabaseConnertor();
                databaseConnertor.connect();

                active active = new active();
                active.Bed_number         = int.Parse(bedNo.Text);
                active.Emergency_datetime = DateTime.Parse(lbDateTime.Text);
                active.Breathing          = int.Parse(bbre.Text);

                activeHandler activeHandler = new activeHandler();
                int           recordCnt1    = activeHandler.addActive(databaseConnertor.getconn(), active);
            }
            else if (btemt <= temmin || btemt >= temmax)
            {
                bcolor.BackColor = Color.Red;
                SoundPlayer player1 = new System.Media.SoundPlayer(Properties.Resources.Alarm);
                player1.Play();

                DatabaseConnertor databaseConnertor = new DatabaseConnertor();
                databaseConnertor.connect();

                active active = new active();
                active.Bed_number         = int.Parse(bedNo.Text);
                active.Emergency_datetime = DateTime.Parse(lbDateTime.Text);
                active.Temperature        = int.Parse(btem.Text);

                activeHandler activeHandler = new activeHandler();
                int           recordCnt1    = activeHandler.addActive(databaseConnertor.getconn(), active);
            }
            else
            {
                bcolor.BackColor = Color.Green;
            }
        }